|
|
|
@ -44,8 +44,8 @@ |
|
|
|
<script setup> |
|
|
|
import { computed, onBeforeUnmount, ref, watch } from 'vue' |
|
|
|
|
|
|
|
const STARTUP_RETRY_DELAYS_MS = [500, 1000, 2000, 4000] |
|
|
|
const STARTUP_WINDOW_MS = 15_000 |
|
|
|
const STARTUP_RETRY_DELAYS_MS = [500, 1000, 2000, 4000, 6000, 8000] |
|
|
|
const STARTUP_WINDOW_MS = 30_000 |
|
|
|
|
|
|
|
const props = defineProps({ |
|
|
|
playUrl: { type: String, default: '' }, |
|
|
|
@ -321,10 +321,13 @@ async function attachPlayer(url, { seq: existingSeq } = {}) { |
|
|
|
// 关闭内置长重试,改由启动窗口退避控制 404 等待 |
|
|
|
hls = new Hls({ |
|
|
|
enableWorker: true, |
|
|
|
lowLatencyMode: true, |
|
|
|
manifestLoadingMaxRetry: 0, |
|
|
|
levelLoadingMaxRetry: 0, |
|
|
|
fragLoadingMaxRetry: 1, |
|
|
|
lowLatencyMode: false, |
|
|
|
manifestLoadingMaxRetry: 2, |
|
|
|
manifestLoadingRetryDelay: 1000, |
|
|
|
levelLoadingMaxRetry: 2, |
|
|
|
levelLoadingRetryDelay: 1000, |
|
|
|
fragLoadingMaxRetry: 4, |
|
|
|
fragLoadingRetryDelay: 1000, |
|
|
|
}) |
|
|
|
hls.on(Hls.Events.ERROR, (_event, data) => { |
|
|
|
if (seq !== attachSeq) return |
|
|
|
@ -367,6 +370,16 @@ async function attachPlayer(url, { seq: existingSeq } = {}) { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if (data.type === Hls.ErrorTypes.MEDIA_ERROR) { |
|
|
|
try { |
|
|
|
console.warn('[live-player] hls media fatal, recover once', data) |
|
|
|
hls.recoverMediaError() |
|
|
|
return |
|
|
|
} catch (recoverErr) { |
|
|
|
console.warn('[live-player] hls recover failed', recoverErr) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
console.warn('[live-player] hls fatal', data) |
|
|
|
emitFatal(buildPlayError({ |
|
|
|
message: detail || 'hls fatal', |
|
|
|
|