1
私はAVPlayerを使用してビデオをストリーミングしています.GMコールが来たときにビデオを一時停止し、コールが終了してコントロールが自分のアプリケーションに戻ったときに再開します。どうすればこれを達成できますか?IOSビデオをストリーミング中にコール中断を検出する
私はAVPlayerを使用してビデオをストリーミングしています.GMコールが来たときにビデオを一時停止し、コールが終了してコントロールが自分のアプリケーションに戻ったときに再開します。どうすればこれを達成できますか?IOSビデオをストリーミング中にコール中断を検出する
AVAudioSessionInterruptionNotification
を使ってわかりました。以下はコードスニペットです
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(routeInterrypt:) name:AVAudioSessionInterruptionNotification object:nil];
-(void)routeInterrypt:(NSNotification *)notification {
NSDictionary *dic = notification.userInfo;
int changeReason= [dic[AVAudioSessionRouteChangeReasonKey] intValue];
if (changeReason == AVAudioSessionRouteChangeReasonUnknown) {
if (_state == TYVideoPlayerStateContentPlaying || _state == TYVideoPlayerStateBuffering) {
[self pauseContent];
return;
}
} }
あなたはあなたの答えを受け入れることができますか? –
@RhythmicFistmanはい、私はできるが、明日。 –