iOS AVPlayer : pause video when screen locks
<p><p>我正在使用 AVPlayerViewController 来显示带有 AVPlayer 的视频。</p>
<p>当我锁定手机屏幕时,视频会继续在后台播放。</p>
<p>如何防止这种情况发生?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>试试这个禁用音频和 Airplay 的背景模式</p>
<pre><code>- (void)applicationDidEnterBackground:(UIApplication *)application {
// pause the video here
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
// resume video when screen unlock
}
</code></pre></p>
<p style="font-size: 20px;">关于iOS AVPlayer : pause video when screen locks,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/31244262/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/31244262/
</a>
</p>
页:
[1]