From be3b321ffb2128fb777220a223243ef0daa092f2 Mon Sep 17 00:00:00 2001 From: gnattu Date: Mon, 8 Apr 2024 13:49:45 +0800 Subject: [PATCH] fix: use correct hls containers for audio The current container setting was set 4 years ago and does not reflect current browsers. We should prioritize using fmp4 when possible and fallback to mpegts if necessary. --- src/scripts/browserDeviceProfile.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/scripts/browserDeviceProfile.js b/src/scripts/browserDeviceProfile.js index 6733f3a3e9..6815d1d0f9 100644 --- a/src/scripts/browserDeviceProfile.js +++ b/src/scripts/browserDeviceProfile.js @@ -718,9 +718,13 @@ export default function (options) { const hlsBreakOnNonKeyFrames = browser.iOS || browser.osx || browser.edge || !canPlayNativeHls(); if (canPlayHls() && browser.enableHlsAudio !== false) { + let enableFmp4Hls = userSettings.preferFmp4HlsContainer(); + if ((browser.safari || browser.tizen || browser.web0s) && !canPlayNativeHlsInFmp4()) { + enableFmp4Hls = false; + } profile.TranscodingProfiles.push({ // hlsjs, edge, and android all seem to require ts container - Container: !canPlayNativeHls() || browser.edge || browser.android ? 'ts' : 'aac', + Container: enableFmp4Hls ? 'mp4' : 'ts', Type: 'Audio', AudioCodec: 'aac', Context: 'Streaming',