Skip to content

Commit

Permalink
fix #571
Browse files Browse the repository at this point in the history
  • Loading branch information
kingslay committed Oct 7, 2023
1 parent 0ba8bdd commit 2177478
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
8 changes: 2 additions & 6 deletions Demo/SwiftUI/Shared/MovieModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,8 @@ class MEOptions: KSOptions {
#if os(tvOS) || os(xrOS)
override open func preferredDisplayCriteria(track: some MediaPlayerTrack) -> AVDisplayCriteria? {
let refreshRate = track.nominalFrameRate
if #available(tvOS 17.0, *) {
if let formatDescription = track.formatDescription {
return AVDisplayCriteria(refreshRate: refreshRate, formatDescription: formatDescription)
} else {
return nil
}
if KSOptions.displayCriteriaFormatDescriptionEnabled, let formatDescription = track.formatDescription, #available(tvOS 17.0, *) {
return AVDisplayCriteria(refreshRate: refreshRate, formatDescription: formatDescription)
} else {
let videoDynamicRange = track.dynamicRange(self).rawValue
return AVDisplayCriteria(refreshRate: refreshRate, videoDynamicRange: videoDynamicRange)
Expand Down
10 changes: 3 additions & 7 deletions Sources/KSPlayer/AVPlayer/KSOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,8 @@ open class KSOptions {
#if os(tvOS) || os(xrOS)
open func preferredDisplayCriteria(track: some MediaPlayerTrack) -> AVDisplayCriteria? {
let refreshRate = track.nominalFrameRate
if #available(tvOS 17.0, *) {
if let formatDescription = track.formatDescription {
return AVDisplayCriteria(refreshRate: refreshRate, formatDescription: formatDescription)
} else {
return nil
}
if KSOptions.displayCriteriaFormatDescriptionEnabled, let formatDescription = track.formatDescription, #available(tvOS 17.0, *) {
return AVDisplayCriteria(refreshRate: refreshRate, formatDescription: formatDescription)
} else {
// let videoDynamicRange = track.dynamicRange(self).rawValue
// return AVDisplayCriteria(refreshRate: refreshRate, videoDynamicRange: videoDynamicRange)
Expand Down Expand Up @@ -400,7 +396,7 @@ public extension KSOptions {
static var hardwareDecode = true
static var asynchronousDecompression = true
static var isPipPopViewController = false
static var displayCriteriaMatchingEnabled = true
static var displayCriteriaFormatDescriptionEnabled = false
/// 日志级别
static var logLevel = LogLevel.warning
static var logger: LogHandler = OSLog(lable: "KSPlayer")
Expand Down
6 changes: 3 additions & 3 deletions Sources/KSPlayer/MEPlayer/MetalPlayView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ public protocol DisplayLayerDelegate: NSObjectProtocol {
public final class MetalPlayView: UIView {
private var formatDescription: CMFormatDescription? {
didSet {
if KSOptions.displayCriteriaMatchingEnabled, let formatDescription {
#if os(tvOS) || os(xrOS)
#if os(tvOS) || os(xrOS)
if KSOptions.displayCriteriaFormatDescriptionEnabled, let formatDescription {
setDisplayCriteria(formatDescription: formatDescription)
#endif
}
#endif
}
}

Expand Down

0 comments on commit 2177478

Please sign in to comment.