views:

12

answers:

0

In Safari on OS4 it's possible to stream the audio of YouTube videos in background:

To try that start a video from YouTube, send the app in background, double tap the home button and switch to another app. At this point the audio will stop but it can be restated, paused, etc. in background using the remote controls associated to Safari also when using a different app.

I want to replicate this behaviour in my app but so fa have found no soution to this problem. I'm using the standard UIWebView technique to start a YouTube video staying within the app, I've set the AVAudioSession category to AVAudioSessionCategoryPlayback and the Required Background Modes in Info.plist is set to "audio". I've also overridden the canBecomeFirstResponder of the UIViewController to return true.

What I get is that the YouTube video can be started, paused and resumed from the Remote Controls but as soon as you switch to a different app the YouTube player gets closed and the audio stops.

Anything I'm missing? How Safari can do that?