检测电视是否在 tvOS 上关闭 [英] Detect if TV is turned off on tvOS
问题描述
有人知道如何或是否可以在电视关闭时以编程方式在 tvOS 上进行检测?
Does anyone know how, or if, it is possible to detect programmatically on tvOS if the TV is turned off?
案例是我正在开发一个视频内容应用,当用户关闭电视时,我不希望内容继续播放.由于带宽费用和提供不精确的分析,这很昂贵.
The case is that I’m developing a video content app, where I don’t want the content to continue to play when the user turns off the TV. This is expensive due to bandwidth fees and give imprecise analytics.
我试过四处寻找,可以找到任何线索.
I’ve tried searching around and could find any clues.
最好的问候.
推荐答案
FWIW
tvOS 会在电视关闭时自动暂停内容.
tvOS does automatically pause the content when the TV is turned off.
就我而言,我正在测试实时内容.我发现属性 linearPlayback
被设置为 true.这导致 AVPlayerViewController
无法暂停(实时)内容.
In my case I was test on live content. I found out that the property linearPlayback
was set to true. This lead to that the AVPlayerViewController
was unable to pause the (live) content.
将此设置为 false 对我的案例没有显着的副作用,从而使我的案例有效.
Setting this to false didn't had significant side effects in my case and thus making my case work.
这篇关于检测电视是否在 tvOS 上关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!