|
|
@ -70,6 +70,7 @@ let startupRetryTimer = null |
|
|
let startupRetryCount = 0 |
|
|
let startupRetryCount = 0 |
|
|
let startupStartedAt = 0 |
|
|
let startupStartedAt = 0 |
|
|
let activeUrl = '' |
|
|
let activeUrl = '' |
|
|
|
|
|
let mediaRecoverAttempted = false |
|
|
|
|
|
|
|
|
const playable = computed(() => props.playUrl && !props.playUrl.startsWith('fake://')) |
|
|
const playable = computed(() => props.playUrl && !props.playUrl.startsWith('fake://')) |
|
|
const isLiveShell = computed(() => props.active && !playable.value) |
|
|
const isLiveShell = computed(() => props.active && !playable.value) |
|
|
@ -128,6 +129,7 @@ function clearMediaListeners() { |
|
|
|
|
|
|
|
|
function destroyPlayer() { |
|
|
function destroyPlayer() { |
|
|
clearMediaListeners() |
|
|
clearMediaListeners() |
|
|
|
|
|
mediaRecoverAttempted = false |
|
|
needsUserPlay.value = false |
|
|
needsUserPlay.value = false |
|
|
if (hls) { |
|
|
if (hls) { |
|
|
hls.destroy() |
|
|
hls.destroy() |
|
|
@ -259,6 +261,7 @@ async function attachPlayer(url, { seq: existingSeq } = {}) { |
|
|
startupRetryCount = 0 |
|
|
startupRetryCount = 0 |
|
|
startupStartedAt = Date.now() |
|
|
startupStartedAt = Date.now() |
|
|
waitingForStream.value = false |
|
|
waitingForStream.value = false |
|
|
|
|
|
mediaRecoverAttempted = false |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
activeUrl = url || '' |
|
|
activeUrl = url || '' |
|
|
@ -371,13 +374,17 @@ async function attachPlayer(url, { seq: existingSeq } = {}) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (data.type === Hls.ErrorTypes.MEDIA_ERROR) { |
|
|
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) |
|
|
|
|
|
|
|
|
if (!mediaRecoverAttempted) { |
|
|
|
|
|
mediaRecoverAttempted = true |
|
|
|
|
|
try { |
|
|
|
|
|
console.warn('[live-player] hls media fatal, recover once', data) |
|
|
|
|
|
hls.recoverMediaError() |
|
|
|
|
|
return |
|
|
|
|
|
} catch (recoverErr) { |
|
|
|
|
|
console.warn('[live-player] hls recover failed', recoverErr) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
// already attempted or recover threw → fall through to emitFatal |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
console.warn('[live-player] hls fatal', data) |
|
|
console.warn('[live-player] hls fatal', data) |
|
|
|