ios - avqueueplayer 在后台模式下播放问题

标签 ios background-process avqueueplayer

我使用 avqueueplayer 播放一些非常短的音频。一个项目完成后,将暂停 2 秒,然后播放下一个项目。

问题是,如果播放器暂停,同时按下主页按钮,它不会播放下一个项目,除非我重新进入应用程序。

按home键后台播放正常,播放器不处于暂停状态。我应该如何解决这个问题?谢谢。

最佳答案

如果音频是连续的,则不会中断。但是,如果正如您所解释的,暂停或停止,您需要声明应用的 RemoteControlEvents 以便在后台播放音频。

[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];

关于ios - avqueueplayer 在后台模式下播放问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36003960/

相关文章:

swift - 为 AVPlayer 视频添加字幕

ios - iPhone - 通过 UIWebView 播放 Youtube 视频

ios - 如何在 WatchKit 扩展应用程序中实现 SpriteKit?

ios - 在展开可选值时意外发现 nil - Sprite Kit

ios - 如何从 UIStoryboardPopoverSegue 获取由 UIPopoverController 包装的 View Controller ?

android - 作业调度程序与后台服务

ubuntu - 使用 "service"风格的命令在 Ubuntu 后台运行 IPython Notebook 服务器

azure - Windows Azure 上长时间运行(或永远)的任务

swift - MPNowPlayingInfoCenter 停止更新进度条

ios - 使用 AVQueuePlayer 播放器项目的无缝和非卡住播放