diff --git a/AUTHORS b/AUTHORS index e014bfb376..fb8965be07 100644 --- a/AUTHORS +++ b/AUTHORS @@ -12,6 +12,7 @@ Bridger Maxwell Christophe Dumez Cody Barnes Colin Plumb +Dmitry Lizin Eric Rescorla, RTFM Inc. Frederik Riedel, Frogg GmbH Giji Gangadharan diff --git a/webrtc/sdk/objc/Framework/Classes/RTCAVFoundationVideoCapturerInternal.mm b/webrtc/sdk/objc/Framework/Classes/RTCAVFoundationVideoCapturerInternal.mm index 5c276fc254..166a609824 100644 --- a/webrtc/sdk/objc/Framework/Classes/RTCAVFoundationVideoCapturerInternal.mm +++ b/webrtc/sdk/objc/Framework/Classes/RTCAVFoundationVideoCapturerInternal.mm @@ -13,6 +13,7 @@ #import #if TARGET_OS_IPHONE #import +#import "WebRTC/UIDevice+RTCDevice.h" #endif #import "RTCDispatcher+Private.h" @@ -232,21 +233,23 @@ NSString *reasonString = nil; #if defined(__IPHONE_9_0) && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \ __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_9_0 - NSNumber *reason = notification.userInfo[AVCaptureSessionInterruptionReasonKey]; - if (reason) { - switch (reason.intValue) { - case AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableInBackground: - reasonString = @"VideoDeviceNotAvailableInBackground"; - break; - case AVCaptureSessionInterruptionReasonAudioDeviceInUseByAnotherClient: - reasonString = @"AudioDeviceInUseByAnotherClient"; - break; - case AVCaptureSessionInterruptionReasonVideoDeviceInUseByAnotherClient: - reasonString = @"VideoDeviceInUseByAnotherClient"; - break; - case AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableWithMultipleForegroundApps: - reasonString = @"VideoDeviceNotAvailableWithMultipleForegroundApps"; - break; + if ([UIDevice isIOS9OrLater]) { + NSNumber *reason = notification.userInfo[AVCaptureSessionInterruptionReasonKey]; + if (reason) { + switch (reason.intValue) { + case AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableInBackground: + reasonString = @"VideoDeviceNotAvailableInBackground"; + break; + case AVCaptureSessionInterruptionReasonAudioDeviceInUseByAnotherClient: + reasonString = @"AudioDeviceInUseByAnotherClient"; + break; + case AVCaptureSessionInterruptionReasonVideoDeviceInUseByAnotherClient: + reasonString = @"VideoDeviceInUseByAnotherClient"; + break; + case AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableWithMultipleForegroundApps: + reasonString = @"VideoDeviceNotAvailableWithMultipleForegroundApps"; + break; + } } } #endif diff --git a/webrtc/sdk/objc/Framework/Classes/UIDevice+RTCDevice.mm b/webrtc/sdk/objc/Framework/Classes/UIDevice+RTCDevice.mm index 523c950645..94faf53506 100644 --- a/webrtc/sdk/objc/Framework/Classes/UIDevice+RTCDevice.mm +++ b/webrtc/sdk/objc/Framework/Classes/UIDevice+RTCDevice.mm @@ -165,4 +165,12 @@ return @"Unknown"; } ++ (double)currentDeviceSystemVersion { + return [self currentDevice].systemVersion.doubleValue; +} + ++ (BOOL)isIOS9OrLater { + return [self currentDeviceSystemVersion] >= 9.0; +} + @end diff --git a/webrtc/sdk/objc/Framework/Headers/WebRTC/UIDevice+RTCDevice.h b/webrtc/sdk/objc/Framework/Headers/WebRTC/UIDevice+RTCDevice.h index d38a3cb2db..29e4801b2e 100644 --- a/webrtc/sdk/objc/Framework/Headers/WebRTC/UIDevice+RTCDevice.h +++ b/webrtc/sdk/objc/Framework/Headers/WebRTC/UIDevice+RTCDevice.h @@ -59,5 +59,6 @@ typedef NS_ENUM(NSInteger, RTCDeviceType) { + (RTCDeviceType)deviceType; + (NSString *)stringForDeviceType:(RTCDeviceType)deviceType; ++ (BOOL)isIOS9OrLater; @end