Skip to content

Commit 67b6423

Browse files
committed
fixes no audio on ios
1 parent 915ee29 commit 67b6423

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

ios/RNTwilioClient/RNTwilioVoice.m

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ + (id)sharedInstance {
6969
sharedInstance = [self alloc];
7070
});
7171
[sharedInstance configureCallKit];
72+
[sharedInstance configureAudioDevice];
7273
}
7374
return sharedInstance;
7475
}
@@ -210,6 +211,10 @@ - (void)configureCallKit {
210211
[self.callKitProvider setDelegate:self queue:nil];
211212
}
212213

214+
- (void)configureAudioDevice {
215+
self.audioDevice = [TVODefaultAudioDevice audioDevice];
216+
TwilioVoiceSDK.audioDevice = self.audioDevice;
217+
}
213218

214219
- (void)initPushRegistry {
215220
self.voipRegistry = [[PKPushRegistry alloc] initWithQueue:dispatch_get_main_queue()];
@@ -584,7 +589,7 @@ - (void)toggleAudioRoute:(BOOL *)toSpeaker __attribute((deprecated("Use the RNAu
584589

585590
- (void)providerDidReset:(CXProvider *)provider {
586591
NSLog(@"[IIMobile - RNTwilioVoice] providerDidReset");
587-
//self.audioDevice.enabled = YES;
592+
self.audioDevice.enabled = YES;
588593
}
589594

590595
- (void)providerDidBegin:(CXProvider *)provider {
@@ -593,12 +598,12 @@ - (void)providerDidBegin:(CXProvider *)provider {
593598

594599
- (void)provider:(CXProvider *)provider didActivateAudioSession:(AVAudioSession *)audioSession {
595600
NSLog(@"[IIMobile - RNTwilioVoice] provider:didActivateAudioSession");
596-
//self.audioDevice.enabled = YES;
601+
self.audioDevice.enabled = YES;
597602
}
598603

599604
- (void)provider:(CXProvider *)provider didDeactivateAudioSession:(AVAudioSession *)audioSession {
600605
NSLog(@"[IIMobile - RNTwilioVoice] provider:didDeactivateAudioSession");
601-
//self.audioDevice.enabled = NO;
606+
self.audioDevice.enabled = NO;
602607
}
603608

604609
- (void)provider:(CXProvider *)provider timedOutPerformingAction:(CXAction *)action {

0 commit comments

Comments
 (0)