MPMoviePlayerControllerに問題があります。インスタンスを使用してm3u8オーディオソースを再生します。
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
NSError *setCategoryError = nil;
[audioSession setCategory:AVAudioSessionCategoryPlayback error:&setCategoryError];
if (setCategoryError) {
}
NSError *activationError = nil;
[audioSession setActive:YES error:&activationError];
if (activationError) {
}
self.player =
[[MPMoviePlayerController alloc] initWithContentURL: [NSURL URLWithString:url]];
player.view.hidden = YES;
player.shouldAutoplay = YES;
[player release];
[btnContainer addSubview: player.view];
player.useApplicationAudioSession = NO;
アプリがバックグラウンドに移行したときに再生されるように設計されており、すべてが正常に機能しています。
問題は、それがバックグラウンドにあり、着信があった場合です。その場合、ストリームは一時停止しますが、通話が終了した後は戻りません。実際、コンソールには
2011-01-12 12:02:27.729 RAC1[1571:307] MP _playbackInterruptionDidEndNotification :: NSConcreteNotification 0x155890 {name = AVController_PlaybackInterruptionDidEndNotification; object = <AVController: 0x180d50>; userInfo = {
"AVController_InterruptionStatusNotificationParameter" = "call.declined";
"AVController_InterruptorNameNotificationParameter" = Phone;
}}, _state = 6
2011-01-12 12:02:27.730 RAC1[1571:307] MP _playbackInterruptionDidEndNotification :: resuming playback!
アプリはストリームをとして表示しますMPMoviePlaybackStatePlaying
が、音が止まるようです。やってみました
[[AVAudioSession sharedInstance] setActive: YES error: &err]
しかし、それは失敗するようです。
誰か手がかりがありますか?
ありがとう!