I am having problems playing the audio stream when the application enters the background.
I use the code to start the stream:
NSURL *mediaURL = [NSURL URLWithString:@"http://url.to.my.stream"];
MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:mediaURL];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:nil];
[mp setControlStyle:MPMovieControlStyleFullscreen];
[mp setMovieSourceType:MPMovieSourceTypeStreaming];
[mp setFullscreen:YES];
[self.view addSubview:[mp view]];
[mp prepareToPlay];
[mp play];
It works great. But despite the fact that I set the flag "App play audio" in the list of properties, when the application enters the background, the stream stops playing.
How to make the application play the audio stream in the background?
Best wishes and thanks for the help!
source
share