2017-01-11 7 views

答えて

1

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; 
     } 
    } } 
+0

あなたはあなたの答えを受け入れることができますか? –

+0

@RhythmicFistmanはい、私はできるが、明日。 –

関連する問題