iOS 4后台HTTP直播

发布于 2024-09-10 03:29:37 字数 262 浏览 1 评论 0 原文

我想在后台播放音频 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

注定孤独终老 2024-09-17 03:29:37

请参阅 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.

蓝颜夕 2024-09-17 03:29:37

找到了解决方案:
在 MPMoviePlayerController 上将 useApplicationAudioSession 设置为 NO 即可完成这项工作。但它仅适用于纯音频流。视频流仍然停止。

player.useApplicationAudioSession = NO;

Found a soluton:
setting useApplicationAudioSession to NO on the MPMoviePlayerController does the job. But it works only on audio only streams. Video streams still stop.

player.useApplicationAudioSession = NO;
北斗星光 2024-09-17 03:29:37

将音频会话类别设置为 kAudioSessionCategory_MediaPlayback 可能有效。

Setting your audio session category to kAudioSessionCategory_MediaPlayback might work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文