0
votes

I have this code

radioPlayer = [[MPMoviePlayerController alloc] init];
[radioPlayer setContentURL:[NSURL URLWithString:@"http://217.66.226.47:8024"]];
[radioPlayer setMovieSourceType:MPMovieSourceTypeStreaming];
[radioPlayer setUseApplicationAudioSession:NO];
[[radioPlayer view]setHidden:NO];
[radioPlayer setControlStyle:MPMovieControlModeDefault];
[radioPlayer stop];
[[self view] addSubview:[radioPlayer view]];

it doesn't play if the application enter background, What to do ?

2

2 Answers

2
votes

In your plist file, did you set the UIBackgroundModes (Required background modes) key to audio? Without this, your application will not play any audio in background.

Here is how to find it:

enter image description here

More about iOS Keys.

0
votes

UIBackgroundModes (Array - iOS) specifies that the app provides specific background services and must be allowed to continue running while in the background.

Use the audio value in your case to your app plays audible content in the background.

For more details: Apple.Developer - iPhoneOSKeys