diff --git a/Demo/SwiftUI/Shared/MovieModel.swift b/Demo/SwiftUI/Shared/MovieModel.swift index 88578a806..be4ac77bc 100644 --- a/Demo/SwiftUI/Shared/MovieModel.swift +++ b/Demo/SwiftUI/Shared/MovieModel.swift @@ -31,8 +31,7 @@ class MEOptions: KSOptions { override func updateVideo(refreshRate: Float, isDovi: Bool, formatDescription: CMFormatDescription?) { #if os(tvOS) || os(xrOS) guard let displayManager = UIApplication.shared.windows.first?.avDisplayManager, - displayManager.isDisplayCriteriaMatchingEnabled, - !displayManager.isDisplayModeSwitchInProgress + displayManager.isDisplayCriteriaMatchingEnabled else { return } diff --git a/Demo/demo-iOS/demo-iOS/AppDelegate.swift b/Demo/demo-iOS/demo-iOS/AppDelegate.swift index 264cb540e..b7b417eea 100644 --- a/Demo/demo-iOS/demo-iOS/AppDelegate.swift +++ b/Demo/demo-iOS/demo-iOS/AppDelegate.swift @@ -107,8 +107,7 @@ class MEOptions: KSOptions { return } if let displayManager = UIApplication.shared.windows.first?.avDisplayManager, - displayManager.isDisplayCriteriaMatchingEnabled, - !displayManager.isDisplayModeSwitchInProgress + displayManager.isDisplayCriteriaMatchingEnabled { let refreshRate = assetTrack.nominalFrameRate if KSOptions.displayCriteriaFormatDescriptionEnabled, let formatDescription = assetTrack.formatDescription, #available(tvOS 17.0, *) { diff --git a/Sources/KSPlayer/AVPlayer/KSOptions.swift b/Sources/KSPlayer/AVPlayer/KSOptions.swift index 9c978bc5a..193280cab 100644 --- a/Sources/KSPlayer/AVPlayer/KSOptions.swift +++ b/Sources/KSPlayer/AVPlayer/KSOptions.swift @@ -315,11 +315,11 @@ open class KSOptions { open func updateVideo(refreshRate: Float, isDovi: Bool, formatDescription: CMFormatDescription?) { #if os(tvOS) || os(xrOS) guard let displayManager = UIApplication.shared.windows.first?.avDisplayManager, - displayManager.isDisplayCriteriaMatchingEnabled, - !displayManager.isDisplayModeSwitchInProgress + displayManager.isDisplayCriteriaMatchingEnabled else { return } +// 快速更改preferredDisplayCriteria,会导致isDisplayModeSwitchInProgress变成true,例如退出一个视频,然后在3s内重新进入的话, if let formatDescription { if KSOptions.displayCriteriaFormatDescriptionEnabled, #available(tvOS 17.0, *) { displayManager.preferredDisplayCriteria = AVDisplayCriteria(refreshRate: refreshRate, formatDescription: formatDescription)