iOS 第三方浏览器(Chrome/Firefox/Edge/Opera)改走 TS 兼容流:能力声明隐藏原生 HLS,服务端规划 legacy TS 通道,绕开 fMP4 黑屏问题

This commit is contained in:
yvan
2026-09-18 15:08:31 +08:00
parent f2802dcc5f
commit 3f8c29b7e2
2 changed files with 18 additions and 1 deletions
+4 -1
View File
@@ -25,7 +25,10 @@
const supported = type => playable(type) || mse(type);
const videoCodecs = {h264: 'avc1.42E01E', hevc: 'hvc1.1.6.L120.B0', av1: 'av01.0.08M.08', vp9: 'vp09.00.10.08'};
const audioCodecs = {aac: 'mp4a.40.2', mp3: 'mp4a.69', ac3: 'ac-3', eac3: 'ec-3', opus: 'opus'};
return {mp4: playable('video/mp4'), nativeHls: native(), hlsjs: Boolean(environment.Hls?.isSupported()),
// iOS 上的第三方浏览器(Chrome/Firefox/Edge/Opera)自带的媒体栈对 fMP4 HLS 兼容性差,
// 会黑屏缓冲;让服务端按无 HLS 通道规划,走 legacy 的 TS 实时转码(hls/open)。
const thirdPartyIOS = touchApple && /CriOS|FxiOS|EdgiOS|OPT\//.test(agent.userAgent || '');
return {mp4: playable('video/mp4'), nativeHls: native() && !thirdPartyIOS, hlsjs: Boolean(environment.Hls?.isSupported()),
video: Object.keys(videoCodecs).filter(key => supported('video/mp4; codecs="' + videoCodecs[key] + '"')),
audio: Object.keys(audioCodecs).filter(key => supported('audio/mp4; codecs="' + audioCodecs[key] + '"'))};
}