Closed UnknownCoder807 closed 2 years ago
I found today that AVPlayerController has the property appliesPreferredDisplayCriteriaAutomatically
This can be true/false. False disables Match Framerate so you do this for a per app basis.
Is it possible AVPlayerController is in KSPlayer and this option can be used? thanks.
I found today that AVPlayerController has the property appliesPreferredDisplayCriteriaAutomatically
This can be true/false. False disables Match Framerate so you do this for a per app basis.
Is it possible AVPlayerController is in KSPlayer and this option can be used? thanks.
AVPlayerViewController is UIViewController not View. So it's not good to use this
I had a feeling it wasn't possible. Thanks.
@UnknownCoder807 you need define protocol to configure framerate an dymanic range: https://github.com/Alanko5/KSPlayer/blob/develop/Sources/KSPlayer/Video/tvOS/AVDisplayCriteriaKS.h
for setup frame rate and dynamic range: https://github.com/Alanko5/KSPlayer/blob/develop/Sources/KSPlayer/Video/tvOS/Info/Views/TVPlayerView.swift
Detection for configure it (example):
var dynamicRange = .SDR
for track in player.tracks(mediaType: .video) {
fps = track.nominalFrameRate
if track.codecType.string == "ehvd" /// DolbyVision
{
dynamicRange = .DV
}
else if let colorPrimaries = track.colorPrimaries, /// HDR
colorPrimaries.contains("2020") {
dynamicRange = .HDR
}
}
set(fps: fps, contentMode: dynamicRange)
@UnknownCoder807 you need define protocol to configure framerate an dymanic range: https://github.com/Alanko5/KSPlayer/blob/develop/Sources/KSPlayer/Video/tvOS/AVDisplayCriteriaKS.h
for setup frame rate and dynamic range: https://github.com/Alanko5/KSPlayer/blob/develop/Sources/KSPlayer/Video/tvOS/Info/Views/TVPlayerView.swift
Detection for configure it (example):
var dynamicRange = .SDR for track in player.tracks(mediaType: .video) { fps = track.nominalFrameRate if track.codecType.string == "ehvd" /// DolbyVision { dynamicRange = .DV } else if let colorPrimaries = track.colorPrimaries, /// HDR colorPrimaries.contains("2020") { dynamicRange = .HDR } } set(fps: fps, contentMode: dynamicRange)
@Alanko5 thanks. i fixed it on 4f387add45a9ae5b81484108861ca4c7b8ec91d1.
open func preferredDisplayCriteria(refreshRate: Float, videoDynamicRange: Int32) -> AVDisplayCriteria? {
// AVDisplayCriteria(refreshRate: fps, videoDynamicRange: dynamicRange.rawValue)
nil
}
After stop playing/deinit player video you need set
displayManager.preferredDisplayCriteria = nil
For reset to default
Thanks for this both of you. Can I use it in KSVideoPlayerView (swiftui demo) ?
Thanks for this both of you. Can I use it in KSVideoPlayerView (swiftui demo) ?
yes. you can use it. you only need override KSOptions
Thanks for this both of you. Can I use it in KSVideoPlayerView (swiftui demo) ?
yes. you can use it. you only need override KSOptions
Thanks. I'm not that great with SwiftUI yet and still coming to terms with how your swiftui demo works. Could I ask how to enable preferredDisplayCriteria ? some sample code would be really helpful. thanks
edit : I meant to say I know how to override KSOptions but I don't know how to return the correct value.
class MyOptions: KSOptions {
override func preferredDisplayCriteria(refreshRate: Float, videoDynamicRange: Int32) -> AVDisplayCriteria? {
}
}
You need import this header to bridging header in your project. https://github.com/Alanko5/KSPlayer/blob/develop/Sources/KSPlayer/Video/tvOS/AVDisplayCriteriaKS.h
If you use KSAVplayer then you detect criteria from avassat:
The Apple TV (tvOS) supports Dynamic Range and Framerate matching. Does KSPlayer support this? I know AVPlayer does.