Comments (12)
你是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.
你是想把这个功能做成是可配置的吗?例如付费用户才能开启吗?如果是的话,那我就加一个开关。还是有开启了这个自动适配会有什么问题呢?
from ksplayer.
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.
你是想把这个功能做成是可配置的吗?例如付费用户才能开启吗?如果是的话,那我就加一个开关。还是有开启了这个自动适配会有什么问题呢?
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.
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.
@UnknownCoder807 我在播放结束之后做了这个处理
UIApplication.shared.windows.first?.avDisplayManager.preferredDisplayCriteria = nil
你先试着把这个代码注释掉。看下是不是因为这行代码造成的。
from ksplayer.
@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.
from ksplayer.
那是不是我把这两行代码去掉就可以符合你的需求呢
from ksplayer.
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.
那这个就需要在切换url和频道的时候。KSPlayerLayer都要是同一个。这样才不会把preferredDisplayCriteria 清空掉
from ksplayer.
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.
你要一直持有playerCoordinator。然后让playerCoordinator不会运行到resetPlayer 函数。resetPlayer这个函数是在swiftui的view消失的时候才会调用
public static func dismantleUIView(_: UIViewType, coordinator: Coordinator) {
coordinator.resetPlayer()
}
你可以用最新的代码试下,我更新代码了
from ksplayer.
Related Issues (20)
- TracyPlayer does not play stream HOT 5
- avformat can't open input - In test app it works, production app it doesn't HOT 2
- Cannot run AV1 codecs Video HOT 4
- 打开了logLevel为debug,还是没有显示debug的日志 HOT 2
- Invalid bundle identifier when pushing to testflight using KSPlayer via SPM (doesnt happen over ccoapods) HOT 6
- Xcode 15.4上传App Store报错 HOT 2
- Can the caching function be added? HOT 5
- 您好,如何在不播放的情况下,获取视频的总时间长度? 目前貌似没有 api 可以获取? HOT 1
- Stream doesn't start HOT 2
- Compilation warning in AudioEnginePlayer.swift
- Unable to add via Swift Package manager HOT 3
- 双语字幕重叠 HOT 3
- Error sanbox when build application
- Package resolution failed HOT 2
- Fix Apple TV App HOT 1
- Video cache support HOT 5
- Crash when view livestream HOT 1
- 能否自定义一个KSPictureInPictureController? HOT 3
- 使用swift Package Manager更新KSPlayer,添加依赖失败
- 请问咱这个播放器支持3d播放吗? 左右眼 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ksplayer.