From 113c59fbdc6599ea5da897a1cf1a3a549cd049a0 Mon Sep 17 00:00:00 2001 From: nyanmisaka Date: Tue, 6 Feb 2024 22:13:32 +0800 Subject: [PATCH] Add stricter checks for DolbyVision in HEVC Signed-off-by: nyanmisaka --- src/scripts/browserDeviceProfile.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/scripts/browserDeviceProfile.js b/src/scripts/browserDeviceProfile.js index 1f40349af4..81c6627d57 100644 --- a/src/scripts/browserDeviceProfile.js +++ b/src/scripts/browserDeviceProfile.js @@ -209,6 +209,14 @@ function supportsDolbyVision(options) { ); } +function canPlayDolbyVisionHevc(videoTestElement) { + // 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/, '')); +} + function getDirectPlayProfileForVideoContainer(container, videoAudioCodecs, videoTestElement, options) { let supported = false; let profileContainer = container; @@ -930,7 +938,7 @@ export default function (options) { av1VideoRangeTypes += '|HLG'; } - if (supportsDolbyVision(options)) { + if (supportsDolbyVision(options) && canPlayDolbyVisionHevc(videoTestElement)) { hevcVideoRangeTypes += '|DOVI'; }