Add onAudioBecomingNoisy for iOS
This commit is contained in:
@@ -91,6 +91,11 @@ static NSString *const timedMetadata = @"timedMetadata";
|
||||
selector:@selector(applicationWillEnterForeground:)
|
||||
name:UIApplicationWillEnterForegroundNotification
|
||||
object:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(audioRouteChanged:)
|
||||
name:AVAudioSessionRouteChangeNotification
|
||||
object:nil];
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -190,6 +195,17 @@ static NSString *const timedMetadata = @"timedMetadata";
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Audio events
|
||||
|
||||
- (void)audioRouteChanged:(NSNotification *)notification
|
||||
{
|
||||
NSNumber *reason = [[notification userInfo] objectForKey:AVAudioSessionRouteChangeReasonKey];
|
||||
NSNumber *previousRoute = [[notification userInfo] objectForKey:AVAudioSessionRouteChangePreviousRouteKey];
|
||||
if (reason.unsignedIntValue == AVAudioSessionRouteChangeReasonOldDeviceUnavailable) {
|
||||
self.onVideoAudioBecomingNoisy(@{@"target": self.reactTag});
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Progress
|
||||
|
||||
- (void)sendProgressUpdate
|
||||
|
||||
Reference in New Issue
Block a user