From 29cf81802a865288cd16ad220b8fceaf8d1805f6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Mar 2026 14:17:53 +0000 Subject: [PATCH 1/4] Initial plan From 5014de6fd876479e7e2a341f106f08914248f783 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Mar 2026 14:24:00 +0000 Subject: [PATCH 2/4] fix(audio-only-mode): avoid MCDN/P2P URLs and handle detached video element Co-authored-by: GrassBlock1 <46253950+GrassBlock1@users.noreply.github.com> --- .../video/audio-only-mode/AudioOnlyMode.vue | 39 +++++++++++++++---- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/registry/lib/components/video/audio-only-mode/AudioOnlyMode.vue b/registry/lib/components/video/audio-only-mode/AudioOnlyMode.vue index 903cce0348..2809828e63 100644 --- a/registry/lib/components/video/audio-only-mode/AudioOnlyMode.vue +++ b/registry/lib/components/video/audio-only-mode/AudioOnlyMode.vue @@ -120,22 +120,47 @@ export default Vue.extend({ bandwidth: number baseUrl?: string base_url?: string - backupUrl?: string - backup_url?: string + backupUrl?: string[] + backup_url?: string[] } const bestAudio = (data.dash.audio as AudioStream[]).reduce( (best, curr) => (curr.bandwidth > best.bandwidth ? curr : best), data.dash.audio[0] as AudioStream, ) - const primaryUrl = bestAudio.baseUrl || bestAudio.base_url - const backupUrl = bestAudio.backupUrl || bestAudio.backup_url - const rawAudioUrl = primaryUrl || backupUrl + const primaryUrl = (bestAudio.baseUrl || bestAudio.base_url || '').replace('http:', 'https:') + const backupUrls = (bestAudio.backupUrl || bestAudio.backup_url || []).map((u: string) => + u.replace('http:', 'https:'), + ) + const allUrls = [primaryUrl, ...backupUrls].filter(Boolean) - if (!rawAudioUrl) { + if (allUrls.length === 0) { throw new Error('没有找到可用的音频地址') } - const audioUrl = rawAudioUrl.replace('http:', 'https:') + const isMcdnOrP2pUrl = (url: string): boolean => { + try { + const { hostname, port, searchParams } = new URL(url) + const os = searchParams.get('os')?.toLowerCase() + const hasNonStandardPort = port !== '' && port !== '80' && port !== '443' + return ( + os === 'mcdn' || + hostname.includes('mcdn') || + hasNonStandardPort || + searchParams.has('p2p_type') + ) + } catch { + return false + } + } + + const audioUrl = allUrls.find(url => !isMcdnOrP2pUrl(url)) ?? allUrls[0] + if (isMcdnOrP2pUrl(audioUrl)) { + console.warn('所有可用音频地址均为 MCDN/P2P,可能因其他脚本干扰而导致播放失败') + } + + if (!video.isConnected) { + throw new Error('视频元素已从页面中移除,请刷新后重试') + } if (savedTime > 0) { video.addEventListener( From 35c9b07f1c345a1354c10760996c0f69743e2a29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=89=E6=96=B9=E5=9D=97?= <46253950+GrassBlock1@users.noreply.github.com> Date: Wed, 18 Mar 2026 07:09:04 +0800 Subject: [PATCH 3/4] feat(audio-only): treat non URLs as bad URLs too Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .../lib/components/video/audio-only-mode/AudioOnlyMode.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/registry/lib/components/video/audio-only-mode/AudioOnlyMode.vue b/registry/lib/components/video/audio-only-mode/AudioOnlyMode.vue index 2809828e63..39bcfceb23 100644 --- a/registry/lib/components/video/audio-only-mode/AudioOnlyMode.vue +++ b/registry/lib/components/video/audio-only-mode/AudioOnlyMode.vue @@ -149,7 +149,8 @@ export default Vue.extend({ searchParams.has('p2p_type') ) } catch { - return false + // Treat unparseable URLs as "bad/unknown" (MCDN/P2P) to avoid preferring them. + return true } } From ab85ea5200733011f94454f3345fa2c4255ae9a9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Mar 2026 23:13:26 +0000 Subject: [PATCH 4/4] fix(audio-only-mode): fix Prettier formatting error Co-authored-by: GrassBlock1 <46253950+GrassBlock1@users.noreply.github.com> --- .../lib/components/video/audio-only-mode/AudioOnlyMode.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/registry/lib/components/video/audio-only-mode/AudioOnlyMode.vue b/registry/lib/components/video/audio-only-mode/AudioOnlyMode.vue index 39bcfceb23..139e9469bf 100644 --- a/registry/lib/components/video/audio-only-mode/AudioOnlyMode.vue +++ b/registry/lib/components/video/audio-only-mode/AudioOnlyMode.vue @@ -127,7 +127,10 @@ export default Vue.extend({ (best, curr) => (curr.bandwidth > best.bandwidth ? curr : best), data.dash.audio[0] as AudioStream, ) - const primaryUrl = (bestAudio.baseUrl || bestAudio.base_url || '').replace('http:', 'https:') + const primaryUrl = (bestAudio.baseUrl || bestAudio.base_url || '').replace( + 'http:', + 'https:', + ) const backupUrls = (bestAudio.backupUrl || bestAudio.backup_url || []).map((u: string) => u.replace('http:', 'https:'), )