0

我有这样的代码发挥的MPMoviePlayerController背景

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]]; 

如果应用程序进入背景,不玩了,怎么办?

回答

2

在您的plist文件中,您是否将UIBackgroundModesRequired background modes)键设置为音频?没有这个,你的应用程序将不会在后台播放任何音频。

这里是如何找到它:

enter image description here

更多iOS Keys

+0

你能给我更多的细节?? – OXXY

+0

是的,你在这里。我更新了我的答案。 – RaffAl

0

UIBackgroundModes(Array - iOS)指定该应用程序提供特定的后台服务,并且必须允许其在后台继续运行。

使用音频在您的情况下,您的应用的价值在后台播放可听内容。

欲了解更多详情:Apple.Developer - iPhoneOSKeys