feat(iOS) expose activating/deactivating audio session functionality
This commit is contained in:
parent
2cfa5f6312
commit
81dfbaeb81
|
@ -24,6 +24,8 @@
|
||||||
0BD906EA1EC0C00300C8C18E /* JitsiMeet.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BD906E81EC0C00300C8C18E /* JitsiMeet.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
0BD906EA1EC0C00300C8C18E /* JitsiMeet.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BD906E81EC0C00300C8C18E /* JitsiMeet.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
4E51B76425E5345E0038575A /* ScheenshareEventEmiter.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E51B76225E5345E0038575A /* ScheenshareEventEmiter.h */; };
|
4E51B76425E5345E0038575A /* ScheenshareEventEmiter.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E51B76225E5345E0038575A /* ScheenshareEventEmiter.h */; };
|
||||||
4E51B76525E5345E0038575A /* ScheenshareEventEmiter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E51B76325E5345E0038575A /* ScheenshareEventEmiter.m */; };
|
4E51B76525E5345E0038575A /* ScheenshareEventEmiter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E51B76325E5345E0038575A /* ScheenshareEventEmiter.m */; };
|
||||||
|
4ED4FFF32721B9B90074E620 /* JitsiAudioSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 4ED4FFF12721B9B90074E620 /* JitsiAudioSession.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
|
4ED4FFF42721B9B90074E620 /* JitsiAudioSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 4ED4FFF22721B9B90074E620 /* JitsiAudioSession.m */; };
|
||||||
6F08DF7D4458EE3CF3F36F6D /* libPods-JitsiMeetSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E4376CA6886DE68FD7A4294B /* libPods-JitsiMeetSDK.a */; };
|
6F08DF7D4458EE3CF3F36F6D /* libPods-JitsiMeetSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E4376CA6886DE68FD7A4294B /* libPods-JitsiMeetSDK.a */; };
|
||||||
A4A934E9212F3ADB001E9388 /* Dropbox.m in Sources */ = {isa = PBXBuildFile; fileRef = A4A934E8212F3ADB001E9388 /* Dropbox.m */; };
|
A4A934E9212F3ADB001E9388 /* Dropbox.m in Sources */ = {isa = PBXBuildFile; fileRef = A4A934E8212F3ADB001E9388 /* Dropbox.m */; };
|
||||||
C6245F5D2053091D0040BE68 /* image-resize@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C6245F5B2053091D0040BE68 /* image-resize@2x.png */; };
|
C6245F5D2053091D0040BE68 /* image-resize@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C6245F5B2053091D0040BE68 /* image-resize@2x.png */; };
|
||||||
|
@ -77,6 +79,9 @@
|
||||||
0BD906E91EC0C00300C8C18E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
0BD906E91EC0C00300C8C18E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
4E51B76225E5345E0038575A /* ScheenshareEventEmiter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScheenshareEventEmiter.h; sourceTree = "<group>"; };
|
4E51B76225E5345E0038575A /* ScheenshareEventEmiter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScheenshareEventEmiter.h; sourceTree = "<group>"; };
|
||||||
4E51B76325E5345E0038575A /* ScheenshareEventEmiter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ScheenshareEventEmiter.m; sourceTree = "<group>"; };
|
4E51B76325E5345E0038575A /* ScheenshareEventEmiter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ScheenshareEventEmiter.m; sourceTree = "<group>"; };
|
||||||
|
4ED4FFF12721B9B90074E620 /* JitsiAudioSession.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JitsiAudioSession.h; sourceTree = "<group>"; };
|
||||||
|
4ED4FFF22721B9B90074E620 /* JitsiAudioSession.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JitsiAudioSession.m; sourceTree = "<group>"; };
|
||||||
|
4ED4FFF52721BAE10074E620 /* JitsiAudioSession+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "JitsiAudioSession+Private.h"; sourceTree = "<group>"; };
|
||||||
891FE43DAD30BC8976683100 /* Pods-JitsiMeetSDK.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JitsiMeetSDK.release.xcconfig"; path = "../Pods/Target Support Files/Pods-JitsiMeetSDK/Pods-JitsiMeetSDK.release.xcconfig"; sourceTree = "<group>"; };
|
891FE43DAD30BC8976683100 /* Pods-JitsiMeetSDK.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JitsiMeetSDK.release.xcconfig"; path = "../Pods/Target Support Files/Pods-JitsiMeetSDK/Pods-JitsiMeetSDK.release.xcconfig"; sourceTree = "<group>"; };
|
||||||
98E09B5C73D9036B4ED252FC /* Pods-JitsiMeet.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JitsiMeet.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-JitsiMeet/Pods-JitsiMeet.debug.xcconfig"; sourceTree = "<group>"; };
|
98E09B5C73D9036B4ED252FC /* Pods-JitsiMeet.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JitsiMeet.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-JitsiMeet/Pods-JitsiMeet.debug.xcconfig"; sourceTree = "<group>"; };
|
||||||
9C77CA3CC919B081F1A52982 /* Pods-JitsiMeet.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JitsiMeet.release.xcconfig"; path = "../Pods/Target Support Files/Pods-JitsiMeet/Pods-JitsiMeet.release.xcconfig"; sourceTree = "<group>"; };
|
9C77CA3CC919B081F1A52982 /* Pods-JitsiMeet.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JitsiMeet.release.xcconfig"; path = "../Pods/Target Support Files/Pods-JitsiMeet/Pods-JitsiMeet.release.xcconfig"; sourceTree = "<group>"; };
|
||||||
|
@ -174,6 +179,9 @@
|
||||||
DEFE535821FB311F00011A3A /* JitsiMeet+Private.h */,
|
DEFE535821FB311F00011A3A /* JitsiMeet+Private.h */,
|
||||||
DEA9F283258A5D9900D4CD74 /* JitsiMeetSDK.h */,
|
DEA9F283258A5D9900D4CD74 /* JitsiMeetSDK.h */,
|
||||||
DEFE535321FB1BF800011A3A /* JitsiMeet.m */,
|
DEFE535321FB1BF800011A3A /* JitsiMeet.m */,
|
||||||
|
4ED4FFF12721B9B90074E620 /* JitsiAudioSession.h */,
|
||||||
|
4ED4FFF52721BAE10074E620 /* JitsiAudioSession+Private.h */,
|
||||||
|
4ED4FFF22721B9B90074E620 /* JitsiAudioSession.m */,
|
||||||
DEAD3224220C497000E93636 /* JitsiMeetConferenceOptions.h */,
|
DEAD3224220C497000E93636 /* JitsiMeetConferenceOptions.h */,
|
||||||
DEAD3228220C734300E93636 /* JitsiMeetConferenceOptions+Private.h */,
|
DEAD3228220C734300E93636 /* JitsiMeetConferenceOptions+Private.h */,
|
||||||
DEAD3225220C497000E93636 /* JitsiMeetConferenceOptions.m */,
|
DEAD3225220C497000E93636 /* JitsiMeetConferenceOptions.m */,
|
||||||
|
@ -277,6 +285,7 @@
|
||||||
4E51B76425E5345E0038575A /* ScheenshareEventEmiter.h in Headers */,
|
4E51B76425E5345E0038575A /* ScheenshareEventEmiter.h in Headers */,
|
||||||
DE65AACC2318028300290BEC /* JitsiMeetBaseLogHandler+Private.h in Headers */,
|
DE65AACC2318028300290BEC /* JitsiMeetBaseLogHandler+Private.h in Headers */,
|
||||||
0B412F221EDEF6EA00B1A0A6 /* JitsiMeetViewDelegate.h in Headers */,
|
0B412F221EDEF6EA00B1A0A6 /* JitsiMeetViewDelegate.h in Headers */,
|
||||||
|
4ED4FFF32721B9B90074E620 /* JitsiAudioSession.h in Headers */,
|
||||||
0BD906EA1EC0C00300C8C18E /* JitsiMeet.h in Headers */,
|
0BD906EA1EC0C00300C8C18E /* JitsiMeet.h in Headers */,
|
||||||
DE81A2D42316AC4D00AE1940 /* JitsiMeetLogger.h in Headers */,
|
DE81A2D42316AC4D00AE1940 /* JitsiMeetLogger.h in Headers */,
|
||||||
DE65AACA2317FFCD00290BEC /* LogUtils.h in Headers */,
|
DE65AACA2317FFCD00290BEC /* LogUtils.h in Headers */,
|
||||||
|
@ -438,6 +447,7 @@
|
||||||
files = (
|
files = (
|
||||||
0BB9AD7B1F5EC8F4001C08DB /* CallKit.m in Sources */,
|
0BB9AD7B1F5EC8F4001C08DB /* CallKit.m in Sources */,
|
||||||
DE81A2DF2317ED5400AE1940 /* JitsiMeetBaseLogHandler.m in Sources */,
|
DE81A2DF2317ED5400AE1940 /* JitsiMeetBaseLogHandler.m in Sources */,
|
||||||
|
4ED4FFF42721B9B90074E620 /* JitsiAudioSession.m in Sources */,
|
||||||
0BB9AD7D1F60356D001C08DB /* AppInfo.m in Sources */,
|
0BB9AD7D1F60356D001C08DB /* AppInfo.m in Sources */,
|
||||||
DE81A2D92316AC7600AE1940 /* LogBridge.m in Sources */,
|
DE81A2D92316AC7600AE1940 /* LogBridge.m in Sources */,
|
||||||
DEAFA779229EAD520033A7FA /* RNRootView.m in Sources */,
|
DEAFA779229EAD520033A7FA /* RNRootView.m in Sources */,
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#import <React/RCTLog.h>
|
#import <React/RCTLog.h>
|
||||||
#import <WebRTC/WebRTC.h>
|
#import <WebRTC/WebRTC.h>
|
||||||
|
|
||||||
|
#import "JitsiAudioSession+Private.h"
|
||||||
#import "LogUtils.h"
|
#import "LogUtils.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,7 +114,7 @@ RCT_EXPORT_MODULE();
|
||||||
isSpeakerOn = NO;
|
isSpeakerOn = NO;
|
||||||
isEarpieceOn = NO;
|
isEarpieceOn = NO;
|
||||||
|
|
||||||
RTCAudioSession *session = [RTCAudioSession sharedInstance];
|
RTCAudioSession *session = JitsiAudioSession.rtcAudioSession;
|
||||||
[session addDelegate:self];
|
[session addDelegate:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +128,7 @@ RCT_EXPORT_MODULE();
|
||||||
|
|
||||||
- (BOOL)setConfigWithoutLock:(RTCAudioSessionConfiguration *)config
|
- (BOOL)setConfigWithoutLock:(RTCAudioSessionConfiguration *)config
|
||||||
error:(NSError * _Nullable *)outError {
|
error:(NSError * _Nullable *)outError {
|
||||||
RTCAudioSession *session = [RTCAudioSession sharedInstance];
|
RTCAudioSession *session = JitsiAudioSession.rtcAudioSession;
|
||||||
|
|
||||||
return [session setConfiguration:config error:outError];
|
return [session setConfiguration:config error:outError];
|
||||||
}
|
}
|
||||||
|
@ -135,7 +136,7 @@ RCT_EXPORT_MODULE();
|
||||||
- (BOOL)setConfig:(RTCAudioSessionConfiguration *)config
|
- (BOOL)setConfig:(RTCAudioSessionConfiguration *)config
|
||||||
error:(NSError * _Nullable *)outError {
|
error:(NSError * _Nullable *)outError {
|
||||||
|
|
||||||
RTCAudioSession *session = [RTCAudioSession sharedInstance];
|
RTCAudioSession *session = JitsiAudioSession.rtcAudioSession;
|
||||||
[session lockForConfiguration];
|
[session lockForConfiguration];
|
||||||
BOOL success = [self setConfigWithoutLock:config error:outError];
|
BOOL success = [self setConfigWithoutLock:config error:outError];
|
||||||
[session unlockForConfiguration];
|
[session unlockForConfiguration];
|
||||||
|
@ -178,7 +179,7 @@ RCT_EXPORT_METHOD(setAudioDevice:(NSString *)device
|
||||||
reject:(RCTPromiseRejectBlock)reject) {
|
reject:(RCTPromiseRejectBlock)reject) {
|
||||||
DDLogInfo(@"[AudioMode] Selected device: %@", device);
|
DDLogInfo(@"[AudioMode] Selected device: %@", device);
|
||||||
|
|
||||||
RTCAudioSession *session = [RTCAudioSession sharedInstance];
|
RTCAudioSession *session = JitsiAudioSession.rtcAudioSession;
|
||||||
[session lockForConfiguration];
|
[session lockForConfiguration];
|
||||||
BOOL success;
|
BOOL success;
|
||||||
NSError *error = nil;
|
NSError *error = nil;
|
||||||
|
@ -273,7 +274,7 @@ RCT_EXPORT_METHOD(updateDeviceList) {
|
||||||
RTCAudioSessionConfiguration *config = [self configForMode:self->activeMode];
|
RTCAudioSessionConfiguration *config = [self configForMode:self->activeMode];
|
||||||
[self setConfig:config error:nil];
|
[self setConfig:config error:nil];
|
||||||
if (self->forceSpeaker && !self->isSpeakerOn) {
|
if (self->forceSpeaker && !self->isSpeakerOn) {
|
||||||
RTCAudioSession *session = [RTCAudioSession sharedInstance];
|
RTCAudioSession *session = JitsiAudioSession.rtcAudioSession;
|
||||||
[session lockForConfiguration];
|
[session lockForConfiguration];
|
||||||
[session overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:nil];
|
[session overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:nil];
|
||||||
[session unlockForConfiguration];
|
[session unlockForConfiguration];
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
* Copyright @ 2017-present 8x8, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import "JitsiAudioSession.h"
|
||||||
|
|
||||||
|
@interface JitsiAudioSession (Private)
|
||||||
|
|
||||||
|
+ (RTCAudioSession *)rtcAudioSession;
|
||||||
|
|
||||||
|
@end
|
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* Copyright @ 2017-present 8x8, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
@class AVAudioSession;
|
||||||
|
|
||||||
|
@interface JitsiAudioSession : NSObject
|
||||||
|
|
||||||
|
+ (void)activateWithAudioSession:(AVAudioSession *)session;
|
||||||
|
+ (void)deactivateWithAudioSession:(AVAudioSession *)session;
|
||||||
|
|
||||||
|
@end
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* Copyright @ 2017-present 8x8, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import "JitsiAudioSession.h"
|
||||||
|
#import "JitsiAudioSession+Private.h"
|
||||||
|
#import <WebRTC/WebRTC.h>
|
||||||
|
|
||||||
|
@implementation JitsiAudioSession
|
||||||
|
|
||||||
|
+ (RTCAudioSession *)rtcAudioSession {
|
||||||
|
return [RTCAudioSession sharedInstance];
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (void)activateWithAudioSession:(AVAudioSession *)session {
|
||||||
|
[self.rtcAudioSession audioSessionDidActivate:session];
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (void)deactivateWithAudioSession:(AVAudioSession *)session {
|
||||||
|
[self.rtcAudioSession audioSessionDidDeactivate:session];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
|
@ -20,4 +20,5 @@
|
||||||
#import <JitsiMeetSDK/JitsiMeetConferenceOptions.h>
|
#import <JitsiMeetSDK/JitsiMeetConferenceOptions.h>
|
||||||
#import <JitsiMeetSDK/JitsiMeetLogger.h>
|
#import <JitsiMeetSDK/JitsiMeetLogger.h>
|
||||||
#import <JitsiMeetSDK/JitsiMeetBaseLogHandler.h>
|
#import <JitsiMeetSDK/JitsiMeetBaseLogHandler.h>
|
||||||
|
#import <JitsiMeetSDK/JitsiAudioSession.h>
|
||||||
#import <JitsiMeetSDK/InfoPlistUtil.h>
|
#import <JitsiMeetSDK/InfoPlistUtil.h>
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#import <JitsiMeetSDK/JitsiMeetSDK-Swift.h>
|
#import <JitsiMeetSDK/JitsiMeetSDK-Swift.h>
|
||||||
|
|
||||||
#import "../LogUtils.h"
|
#import "../LogUtils.h"
|
||||||
|
#import "JitsiAudioSession.h"
|
||||||
|
|
||||||
|
|
||||||
// The events emitted/supported by RNCallKit:
|
// The events emitted/supported by RNCallKit:
|
||||||
|
@ -319,13 +320,13 @@ RCT_EXPORT_METHOD(updateCall:(NSString *)callUUID
|
||||||
- (void) providerDidActivateAudioSessionWithSession:(AVAudioSession *)session {
|
- (void) providerDidActivateAudioSessionWithSession:(AVAudioSession *)session {
|
||||||
DDLogInfo(@"[RNCallKit][CXProviderDelegate][provider:didActivateAudioSession:]");
|
DDLogInfo(@"[RNCallKit][CXProviderDelegate][provider:didActivateAudioSession:]");
|
||||||
|
|
||||||
[[RTCAudioSession sharedInstance] audioSessionDidActivate:session];
|
[JitsiAudioSession activateWithAudioSession:session];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) providerDidDeactivateAudioSessionWithSession:(AVAudioSession *)session {
|
- (void) providerDidDeactivateAudioSessionWithSession:(AVAudioSession *)session {
|
||||||
DDLogInfo(@"[RNCallKit][CXProviderDelegate][provider:didDeactivateAudioSession:]");
|
DDLogInfo(@"[RNCallKit][CXProviderDelegate][provider:didDeactivateAudioSession:]");
|
||||||
|
|
||||||
[[RTCAudioSession sharedInstance] audioSessionDidDeactivate:session];
|
[JitsiAudioSession deactivateWithAudioSession:session];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) providerTimedOutPerformingActionWithAction:(CXAction *)action {
|
- (void) providerTimedOutPerformingActionWithAction:(CXAction *)action {
|
||||||
|
|
Loading…
Reference in New Issue