Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ios): The getAudioRoutes changes the selected audio route #557

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a51cb74
fix(ios): The getAudioRoutes changes the selected audio route #540
rcidt Mar 31, 2022
1df080f
fix: [MOB-4845] Crashlytics: [__NSArray0 objectAtIndex:]: index 0 bey…
rcidt Aug 29, 2022
9498a35
First fore bluetooth tryout commit.
sasaobadicidt Oct 13, 2022
b49e6a7
Merge pull request #10 from coretech/force-bt
rcidt Oct 13, 2022
d6b763c
Additional flag fix if BT selected back as primary
sasaobadicidt Oct 14, 2022
b9a8c4b
Merge pull request #11 from coretech/force-bt
rcidt Oct 14, 2022
fcd5e06
Fixes audio routing issues on incoming calls when connected to BT
rcidt Oct 19, 2022
dcc5158
Adds localbroadcastmanager support
rcidt Nov 4, 2022
6965f41
Revert "Adds localbroadcastmanager support"
rcidt Nov 5, 2022
a2ca441
Sets fixed RN version
rcidt Nov 5, 2022
8caab0a
Adds group calling api
rcidt Dec 9, 2022
d837589
bug/MOB-5197: 3 way calling: Call is ended after tap merge button (A…
rcidt Jan 23, 2023
b80f36e
bug/MOB-5897: Phone sound gets activated instead of Speaker one after…
rcidt Sep 12, 2023
06dddf6
Adds missing js methods
rcidt Sep 13, 2023
8434364
bug/MOB-5329: iOS: No outbound call ringing sound when placing a call…
rcidt Jan 18, 2024
ac2e934
Merge branch 'master' into bug/MOB-5329
rcidt Jan 18, 2024
707055f
Merge branch 'callkit-fix'
rcidt Jan 18, 2024
c6beb0e
Merge branch 'master' into bug/MOB-5329
rcidt Jan 18, 2024
6228ac9
Update AndroidManifest.xml
rcidt Jul 12, 2024
48840d5
Update build.gradle
rcidt Jul 12, 2024
44378f7
Merge pull request #14 from net2phone/bug/MOB-5329
rcidt Jul 12, 2024
3d1bccf
Update build.gradle
rcidt Jul 12, 2024
df3c620
Fix no audio if app killed before call
janusz-kol Oct 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions ios/RNCallKeep/RNCallKeep.m
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,21 @@ + (void)setup:(NSDictionary *)options {
}

NSArray *ports = [RNCallKeep getAudioInputs];

BOOL isCategorySetted = [myAudioSession setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionAllowBluetooth error:&err];
if (!isCategorySetted)
{
NSLog(@"[RNCallKeep][setAudioRoute] setCategory failed");
[NSException raise:@"setCategory failed" format:@"error: %@", err];
}

BOOL isCategoryActivated = [myAudioSession setActive:YES error:&err];
if (!isCategoryActivated)
{
NSLog(@"[RNCallKeep][setAudioRoute] setActive failed");
[NSException raise:@"setActive failed" format:@"error: %@", err];
}

for (AVAudioSessionPortDescription *port in ports) {
if ([port.portName isEqualToString:inputName]) {
BOOL isSetted = [myAudioSession setPreferredInput:(AVAudioSessionPortDescription *)port error:&err];
Expand Down Expand Up @@ -570,20 +585,6 @@ + (NSArray *) getAudioInputs

AVAudioSession* myAudioSession = [AVAudioSession sharedInstance];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and I noticed if we remove the setCategory from the getAudioInputs, the availableInputs are not up-to-date, I mean if in the meantime you remove a connected bluetooth device, the availableInputs are not updated

Copy link
Author

@rcidt rcidt Apr 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nagyszili I am not seeing that issue. Are you relying on the RNCallKeepDidChangeAudioRoute event or are you using the getAudioRoutes method?

Copy link

@nagyszili nagyszili Apr 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using the getAudioRoutes , please try it when a call is connected, my suggestion is to set the category in the getAudioInputs when there is no call connected

BOOL isCategorySetted = [myAudioSession setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionAllowBluetooth error:&err];
if (!isCategorySetted)
{
NSLog(@"[RNCallKeep][getAudioInputs] setCategory failed");
[NSException raise:@"setCategory failed" format:@"error: %@", err];
}

BOOL isCategoryActivated = [myAudioSession setActive:YES error:&err];
if (!isCategoryActivated)
{
NSLog(@"[RNCallKeep][getAudioInputs] setActive failed");
[NSException raise:@"setActive failed" format:@"error: %@", err];
}

NSArray *inputs = [myAudioSession availableInputs];
return inputs;
}
Expand Down