iOS 4后台HTTP直播
我想在后台播放音频 HTTP 直播流。但我该怎么做呢?
我尝试将值为“audio”的键(数组)“UIBackgroundModes”添加到 info.plist 中。现在我尝试使用 MPMoviePlayerController 播放音频。但一旦应用程序进入后台,音频播放就会停止!我不知道还有什么其他 API 可以在 iPhone 上播放 HTTP Live Stream。那么还有其他的还是我做错了什么? 我搜索了所有苹果文档,但找不到任何有用的东西。文档中没有太多关于背景音频的内容:-(
I'd like to play an audio HTTP Live Stream in background. But how do I do that?
I tried to add the key (an Array) "UIBackgroundModes" with value "audio" to the info.plist. Now I try to play audio with the MPMoviePlayerController. But as soon as the app goes into background, the audio Playback stops! I don't know of any other API to play a HTTP Live Stream on the iPhone. So is there an other or am I doing something wrong?
I searched all over the apple documentation but couldn't find anything useful. There isn't much about background audio in the docs :-(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
请参阅 http://developer.apple.com/iphone/library/qa /qa2010/qa1668.html 了解 iOS4 中的更改以及如何实现您想要的功能。
这在我的一个应用程序中适用于我。
See http://developer.apple.com/iphone/library/qa/qa2010/qa1668.html for a description of what changed in iOS4 and how to implement the functionality you want.
This works for me in one of my apps.
找到了解决方案:
在 MPMoviePlayerController 上将
useApplicationAudioSession
设置为NO
即可完成这项工作。但它仅适用于纯音频流。视频流仍然停止。Found a soluton:
setting
useApplicationAudioSession
toNO
on the MPMoviePlayerController does the job. But it works only on audio only streams. Video streams still stop.将音频会话类别设置为 kAudioSessionCategory_MediaPlayback 可能有效。
Setting your audio session category to kAudioSessionCategory_MediaPlayback might work.