问题
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.
Best regards.
回答1:
FWIW
tvOS does automatically pause the content when the TV is turned off.
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.
Setting this to false didn't had significant side effects in my case and thus making my case work.
来源:https://stackoverflow.com/questions/52763217/detect-if-tv-is-turned-off-on-tvos