From 49552d0c9de1ba70b5df3377daa7dc430cd4b9d3 Mon Sep 17 00:00:00 2001 From: George Haidos Date: Sat, 16 Mar 2024 21:10:14 +0200 Subject: [PATCH] Report DOVIWith{HDR10,HLG} only if dvh1 is supported as the codec tag --- src/scripts/browserDeviceProfile.js | 33 +++++++++++++++++++---------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/scripts/browserDeviceProfile.js b/src/scripts/browserDeviceProfile.js index daf6d4a7d0..3f7d038f09 100644 --- a/src/scripts/browserDeviceProfile.js +++ b/src/scripts/browserDeviceProfile.js @@ -210,12 +210,21 @@ function supportsDolbyVision(options) { ); } -function canPlayDolbyVisionHevc(videoTestElement) { +function supportedDolbyVisionProfilesHevc(videoTestElement) { + const supportedProfiles = []; // Profiles 5/7/8 4k@60fps - return !!videoTestElement.canPlayType - && (videoTestElement.canPlayType('video/mp4; codecs="dvh1.05.09"').replace(/no/, '') - && videoTestElement.canPlayType('video/mp4; codecs="dvh1.07.09"').replace(/no/, '') - && videoTestElement.canPlayType('video/mp4; codecs="dvh1.08.09"').replace(/no/, '')); + if (videoTestElement.canPlayType) { + if (videoTestElement + .canPlayType('video/mp4; codecs="dvh1.05.09"') + .replace(/no/, '')) supportedProfiles.push(5); + if ( videoTestElement + .canPlayType('video/mp4; codecs="dvh1.07.09"') + .replace(/no/, '')) supportedProfiles.push(7); + if ( videoTestElement + .canPlayType('video/mp4; codecs="dvh1.08.09"') + .replace(/no/, '')) supportedProfiles.push(8); + } + return supportedProfiles; } function getDirectPlayProfileForVideoContainer(container, videoAudioCodecs, videoTestElement, options) { @@ -932,22 +941,24 @@ export default function (options) { if (supportsHdr10(options)) { hevcVideoRangeTypes += '|HDR10'; - // Should also be able to play DoVi with HDR10 fallback - hevcVideoRangeTypes += '|DOVIWithHDR10'; vp9VideoRangeTypes += '|HDR10'; av1VideoRangeTypes += '|HDR10'; } if (supportsHlg(options)) { hevcVideoRangeTypes += '|HLG'; - // Should also be able to play DoVi with HLG fallback - hevcVideoRangeTypes += '|DOVIWithHLG'; vp9VideoRangeTypes += '|HLG'; av1VideoRangeTypes += '|HLG'; } - if (supportsDolbyVision(options) && canPlayDolbyVisionHevc(videoTestElement)) { - hevcVideoRangeTypes += '|DOVI'; + if (supportsDolbyVision(options)) { + const profiles = supportedDolbyVisionProfilesHevc(videoTestElement); + if (profiles.includes(5) || profiles.includes(7)) { + hevcVideoRangeTypes += '|DOVI'; + } + if (profiles.includes(8)) { + hevcVideoRangeTypes += '|DOVIWithHDR10|DOVIWithHLG'; + } } const h264CodecProfileConditions = [