iOS 4 background HTTP Live Stream

我与影子孤独终老i 提交于 2019-12-08 08:28:31

问题


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 :-(


回答1:


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.




回答2:


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;



回答3:


Setting your audio session category to kAudioSessionCategory_MediaPlayback might work.



来源:https://stackoverflow.com/questions/3280097/ios-4-background-http-live-stream

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!