Giter Club home page Giter Club logo

Comments (12)

kingslay avatar kingslay commented on July 19, 2024

你是tvOS 17吗?这个是用到了tvos17的一个新的功能。目前可以在播放的时候自动进行适配
#if os(tvOS) || os(xrOS)
private func setDisplayCriteria(formatDescription: CMFormatDescription) {
guard let displayManager = UIApplication.shared.windows.first?.avDisplayManager,
displayManager.isDisplayCriteriaMatchingEnabled,
!displayManager.isDisplayModeSwitchInProgress
else {
return
}
if #available(tvOS 17.0, *) {
let criteria = AVDisplayCriteria(refreshRate: fps, formatDescription: formatDescription)
displayManager.preferredDisplayCriteria = criteria
}
}
#endif

你是在什么场景下想要把HDR/SDR and Frame rate matching关了呢?我是读取系统的配置来决定要不要开启这个功能的

from ksplayer.

kingslay avatar kingslay commented on July 19, 2024

你是想把这个功能做成是可配置的吗?例如付费用户才能开启吗?如果是的话,那我就加一个开关。还是有开启了这个自动适配会有什么问题呢?

from ksplayer.

UnknownCoder807 avatar UnknownCoder807 commented on July 19, 2024

I have an option in my app to override the system settings.

So if the ATV is set to On for Content and Frame Rate Matching, my app can override this setting and turn it off in certain scenario's.

One such scenario is the small live tv preview window i have which shows a preview of the focused channel. If the channel is an SDR one, then I get a black screen whilst the TV switches modes. This black screen is normal, but not when you want to quickly scroll through live tv channels and see a preview of each one. In the previous version of the preferredDisplayCriteria function I could turn off the dynamic range and frame rate matching temporarily.

from ksplayer.

UnknownCoder807 avatar UnknownCoder807 commented on July 19, 2024

你是想把这个功能做成是可配置的吗?例如付费用户才能开启吗?如果是的话,那我就加一个开关。还是有开启了这个自动适配会有什么问题呢?

if you could make it like before, where I can turn it off when I want it would be perfect. A lot of IPTV apps on apple tv have a preview window and this current version will affect them all.

from ksplayer.

UnknownCoder807 avatar UnknownCoder807 commented on July 19, 2024

Thanks @kingslay this switch works nicely.

I have a question. I don't know if it's down to ksplayer or my code.

If the ATV is set to HDR and I play an SDR channel, ksplayer rightly switches to SDR mode. In my app when watching a channel, you can swipe right to play the next channel. If this next channel is also SDR, shouldn't ksplayer not switch anything? At the moment, when I swipe right, the new channel triggers a new switch of hdr/sdr.

from ksplayer.

kingslay avatar kingslay commented on July 19, 2024

@UnknownCoder807 我在播放结束之后做了这个处理
UIApplication.shared.windows.first?.avDisplayManager.preferredDisplayCriteria = nil

你先试着把这个代码注释掉。看下是不是因为这行代码造成的。

from ksplayer.

UnknownCoder807 avatar UnknownCoder807 commented on July 19, 2024

@UnknownCoder807 我在播放结束之后做了这个处理 UIApplication.shared.windows.first?.avDisplayManager.preferredDisplayCriteria = nil

你先试着把这个代码注释掉。看下是不是因为这行代码造成的。

I did this and although it stops the switching when changing channels (url) it doesn't switch back when I exit playback completely. which is expected since I commented it out of the resetPlayer() function.

Screenshot 2023-10-03 at 05 03 48

from ksplayer.

kingslay avatar kingslay commented on July 19, 2024

那是不是我把这两行代码去掉就可以符合你的需求呢

from ksplayer.

UnknownCoder807 avatar UnknownCoder807 commented on July 19, 2024

if you remove them, then even after just watching 1 channel, ksplayer will not switch back to HDR or SDR when exiting playback which is not the correct thing.

The users ATV is in HDR Mode. They select an SDR channel to watch. KSPlayer switches the display to SDR mode. Whilst watching that channel, they decide to change channels via an onscreen UI. KSPlayer now stops the playback and plays the newly selected channel. At the moment, KSPlayer is switching back to HDR then back to SDR between the current channel ending and the new one playing.

What should happen is, when the current channel ends playback and the new channel starts to play, KSPlayer should check if the new channel is also SDR and if it is, stay in SDR mode. don't switch. When the user exits playback completely, KSPlayer should then switch back to HDR.

So if the user watches 4 different channels in succession, it stays in SDR (or HDR) mode for the duration of the session.

Hope that makes sense.

from ksplayer.

kingslay avatar kingslay commented on July 19, 2024

那这个就需要在切换url和频道的时候。KSPlayerLayer都要是同一个。这样才不会把preferredDisplayCriteria 清空掉

from ksplayer.

UnknownCoder807 avatar UnknownCoder807 commented on July 19, 2024

I play media using

KSVideoPlayer(coordinator: playerCoordinator, url: url, options: options)

and I change the live tv channel currently playing by changing thr value of url

How can I do what you suggest with ksplaylayer?

from ksplayer.

kingslay avatar kingslay commented on July 19, 2024

你要一直持有playerCoordinator。然后让playerCoordinator不会运行到resetPlayer 函数。resetPlayer这个函数是在swiftui的view消失的时候才会调用
public static func dismantleUIView(_: UIViewType, coordinator: Coordinator) {
coordinator.resetPlayer()
}
你可以用最新的代码试下,我更新代码了

from ksplayer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.