如何在播放视频时允许iPhone自动锁定 [英] How to allow iPhone auto-lock while playing a video
本文介绍了如何在播放视频时允许iPhone自动锁定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在使用AVFoundation播放视频时允许iOS设备调暗屏幕并自动锁定设备。默认情况下,使用AVPlayer播放视频会禁用屏幕自动锁定。无论如何重新启用它而不暂停视频播放。
How can I allow iOS device to dim screen and auto-lock the device while playing a video with AVFoundation. Playing a video with AVPlayer disable screen auto-lock by default. Is there anyway to re-enable it without pausing the video play.
推荐答案
为什么你想让屏幕在播放视频时闲置?
why you want screen to go idle while playing video?
Apple允许我们使用的唯一方法是
The only method apple allows us to use is
[UIApplication sharedApplication].idleTimerDisabled
你可以通过使用黑色的UIView并慢慢改变alpha来以编程方式调暗屏幕财产造成屏幕空闲的错觉。
You can dim screen programmatically by using a UIView with color black and slowly changing it alpha property to create the illusion of screen going idle.
这篇关于如何在播放视频时允许iPhone自动锁定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文