From c56ba882a639ce87a36da0e4ec111860575862c0 Mon Sep 17 00:00:00 2001 From: nyanmisaka Date: Tue, 6 Feb 2024 01:06:34 +0800 Subject: [PATCH] Relax HEVC on Safari for hvc1/dvh1 direct-play Signed-off-by: nyanmisaka --- src/scripts/browserDeviceProfile.js | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/scripts/browserDeviceProfile.js b/src/scripts/browserDeviceProfile.js index 1f40349af4..aef1ca0050 100644 --- a/src/scripts/browserDeviceProfile.js +++ b/src/scripts/browserDeviceProfile.js @@ -583,11 +583,7 @@ export default function (options) { } if (canPlayHevc(videoTestElement, options)) { - // safari is lying on HDR and 60fps videos, use fMP4 instead - if (!browser.safari) { - mp4VideoCodecs.push('hevc'); - } - + mp4VideoCodecs.push('hevc'); if (browser.tizen || browser.web0s) { hlsInTsVideoCodecs.push('hevc'); } @@ -1098,6 +1094,25 @@ export default function (options) { }); } + // Safari quirks for HEVC direct-play + if (browser.safari) { + // Only hvc1 & dvh1 tags are supported + hevcCodecProfileConditions.push({ + Condition: 'EqualsAny', + Property: 'VideoCodecTag', + Value: 'hvc1|dvh1', + IsRequired: true + }); + + // Framerate above 60fps is not supported + hevcCodecProfileConditions.push({ + Condition: 'LessThanEqual', + Property: 'VideoFramerate', + Value: '60', + IsRequired: true + }); + } + // On iOS 12.x, for TS container max h264 level is 4.2 if (browser.iOS && browser.iOSVersion < 13) { const codecProfile = {