Skip to content

Commit

Permalink
fix #642
Browse files Browse the repository at this point in the history
  • Loading branch information
kingslay committed Nov 18, 2023
1 parent d039996 commit 0ffb5a1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions Demo/SwiftUI/Shared/MovieModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 1 addition & 2 deletions Demo/demo-iOS/demo-iOS/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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, *) {
Expand Down
4 changes: 2 additions & 2 deletions Sources/KSPlayer/AVPlayer/KSOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0ffb5a1

Please sign in to comment.