How to let a video, that is streamed via AirPlay not pause, when the screen is locked?

StackOverflow https://stackoverflow.com/questions/15138588

Вопрос

I use both, a MPMoviePlayerViewController and a MPMoviePlayerController to play back videos in my app. I also allow the use of AirPlay to stream these videos on to an Apple TV.

This all works fine. The only problem is, that the streamed video pauses, when the screen gets locked.

I noticed, that a lot of apps support this, but I don't know how to achive this feature.

I tried to set:

moviePlayerViewController.moviePlayer.useApplicationAudioSession = NO;

But that didn't work on either iOS 5 or iOS 6 so I tried using :

[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];

But that didn't even compile.

Both ways are discussed here: http://stackoverflow.com/questions/12814574/how-to-support-airplay-in-the-background-in-ios6

What can I do? Or what do I do wrong?

Thanks a lot!

Andreas

Это было полезно?

Решение

This answer and this one as well should help you, I've had the same problem in one of my apps and these helped. Let me know if it doesn't work.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top