From a7681b81d267e86a46acd47315f87822fe635c76 Mon Sep 17 00:00:00 2001 From: yicheng <11733500+yichengchen@users.noreply.github.com> Date: Sat, 8 Jul 2023 10:57:33 +0800 Subject: [PATCH] fix hdr playback issue --- .../Player/BilibiliVideoResourceLoaderDelegate.swift | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/BilibiliLive/Component/Player/BilibiliVideoResourceLoaderDelegate.swift b/BilibiliLive/Component/Player/BilibiliVideoResourceLoaderDelegate.swift index 7ccbc907..0d9686d9 100644 --- a/BilibiliLive/Component/Player/BilibiliVideoResourceLoaderDelegate.swift +++ b/BilibiliLive/Component/Player/BilibiliVideoResourceLoaderDelegate.swift @@ -92,7 +92,7 @@ class BilibiliVideoResourceLoaderDelegate: NSObject, AVAssetResourceLoaderDelega supplementCodesc = codecs videoRange = "HLG" codecs = "hvc1.2.4.L153.b0" - } else if codecs == "dvh1.08.06" { + } else if codecs == "dvh1.08.06" || codecs == "dvh1.05.06" { supplementCodesc = codecs codecs = "hvc1.2.4.L150" videoRange = "PQ" @@ -239,8 +239,11 @@ class BilibiliVideoResourceLoaderDelegate: NSObject, AVAssetResourceLoaderDelega hasSubtitle = subtitles.count > 0 var videos = info.dash.video if Settings.preferAvc { - if videos.contains(where: { !$0.isHevc }) { - videos.removeAll(where: { $0.isHevc }) + let videosMap = Dictionary(grouping: videos, by: { $0.id }) + for (key, values) in videosMap { + if values.contains(where: { !$0.isHevc }) { + videos.removeAll(where: { $0.id == key && $0.isHevc }) + } } }