Open ashirkhanpm opened 1 year ago
Hi @ashirkhanpm , Could you provide the steps to reproduce this issue with the RN demo?
Hi @ethanjanadrake
I can able to reproduce this issue with the RN demo, but it happens sometimes only.
DeviceChangeObserver
in the bridge file by referring the link #93
DeviceChangeObserver
in RNDemo/MeetingObservers.h
and - (void)audioDeviceDidChangeWithFreshAudioDeviceList:(NSArray<MediaDevice *> * _Nonnull)freshAudioDeviceList { [_bridge configureActiveAudioDevice:freshAudioDeviceList]; }
in RNDemo/MeetingObservers.m
filethen added [meetingSession.audioVideo addDeviceChangeObserverWithObserver:observer];
in -(void)startVideo {}
inside RNDemo/NativeMobileSDKBridge.m
file
Hi @ethanjanadrake did you get this issue on the demo app, any update?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
hi, any update?
Hi @ashirkhanpm, sorry for the late reply. When bluetooth device is connected, do you hear audio from the bluetooth? You can also check it by calling getActiveAudioDevice.
If current device is not bluetooth device, disconnecting does not trigger routeChangeNotification as implemented in our DefaultDeviceController, which resulted in not calling audioDeviceDidChangeWithFreshAudioDeviceList
.
Hi @hokyungh,
Yes, I can hear audio through bluetooth, before device was disconnected,
But the audioDeviceDidChangeWithFreshAudioDeviceList
is not called,
Is there any other observer function available for detecting audio route change?
Hi @ashirkhan94 , how did you disconnect bluetooth and what bluetooth device do you use? One of our teammates wasn't able to reproduce, so just wanted to see if you have another bluetooth device you can try to test.
Hi @hokyungh , I disconnect by bluetooth device disconnect option in phone, using Wireless Earbuds (boAt Airdopes 411 ANC), I have facing same issue when tried with another device
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hi, Any update
Sorry for the late reply. I'll try on my device and get back to you.
But before I testing, are you using
-(void)configureActiveAudioDevice:(NSArray<MediaDevice *> * _Nonnull)audioDeviceList
__block BOOL isHeadsetPluggedIn = false;
// Judge useing headohone, if current routes has one or more headphones port.
[currentOutputs enumerateObjectsUsingBlock:^(AVAudioSessionPortDescription *output, NSUInteger idx, BOOL *stop) {
if([output.portType isEqual:AVAudioSessionPortHeadphones]){
isHeadsetPluggedIn = true;
}
}];
// If wiredHeadset connected, use Build-in receiver
if(isHeadsetPluggedIn)
{
// use Build-in receiver
[meetingSession.audioVideo chooseAudioDeviceWithMediaDevice:[audioDeviceList firstObject]];
} else {
// use loud speaker (or other device)
[meetingSession.audioVideo chooseAudioDeviceWithMediaDevice:[audioDeviceList lastObject]];
}
}
too?
Just wanted to see if you can add a logic to select bluetooth device.
Hi, @hokyungh I am using below logic
-(void)configureActiveAudioDevice:(NSArray<MediaDevice *> * _Nonnull)audioDeviceList
{
NSLog(@"test-ActiveAudio-list currentoutput: %ld%ld" ,[[audioDeviceList firstObject]type],[[audioDeviceList lastObject]type]);
if([[audioDeviceList firstObject]type]==0||[[audioDeviceList firstObject]type]==1)
{
NSLog(@"test-ActiveAudio-list if value2: %@" ,[audioDeviceList firstObject]);
[meetingSession.audioVideo chooseAudioDeviceWithMediaDevice:[audioDeviceList firstObject]];
[self sendEventWithName:KEventonGetActiveAudioDevice body:@([[audioDeviceList firstObject] type])];
} else {
NSLog(@"test-ActiveAudio-list else value3: %@" ,[audioDeviceList lastObject]);
[meetingSession.audioVideo chooseAudioDeviceWithMediaDevice:[audioDeviceList lastObject]];
[self sendEventWithName:KEventonGetActiveAudioDevice body:@([[audioDeviceList lastObject] type])];
}
}
but my issue is audioDeviceDidChangeWithFreshAudioDeviceList
function not triggering some times, when i disconnect bluetooth device
- (void)audioDeviceDidChangeWithFreshAudioDeviceList:(NSArray<MediaDevice *> * _Nonnull)freshAudioDeviceList
{
NSLog(@"test-ActiveAudio-list freshAudioDeviceList");
[_bridge configureActiveAudioDevice:freshAudioDeviceList];
}
Could you try with https://github.com/aws-samples/amazon-chime-react-native-demo/tree/use-device and see if it works for you?
Hi, @hokyungh
It's not working, i tried with above changes.
The audio is routing successfully when we connect or disconnect bluetooth device, but some times can't able to change the icons, means if we disconnect bluetooth device the audio is flowing through earpiece, but the icon showing is bluetooth icon, not earpiece icon, because the audioDeviceDidChangeWithFreshAudioDeviceList
is not trigger some times .
- (void)audioDeviceDidChangeWithFreshAudioDeviceList:(NSArray<MediaDevice *> * _Nonnull)freshAudioDeviceList
{
NSLog(@"test-ActiveAudio-list freshAudioDeviceList");
[_bridge configureActiveAudioDevice];
}
Hi @ashirkhan94, do you mind explaining the case where it is not working? We have a report on https://github.com/aws/amazon-chime-sdk-ios/issues/242, and there is case where if you are on different device and disconnect bluetooth, it won't get callback, which we have reported to Apple.
Hi @hokyungh, Case: Connect the bluetooth device and the audio flowing through the bluetooth device, then I disconnect the bluetooth device using 3 ways
turn off bluetooth in phone , but audioDeviceDidChangeWithFreshAudioDeviceList
was not trigger
Disconnect the Bluetooth device from phone, but audioDeviceDidChangeWithFreshAudioDeviceList
was not trigger
closed the earBud box, then device disconnected from phone, but audioDeviceDidChangeWithFreshAudioDeviceList
was not trigger
In my case the disconnected time audio is not flowing through different device, audio is on bluetooth device.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hi any update
Sorry for late reply. Could you try with our demo application to see if you are getting the log?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Sorry for late reply. Could you try with our demo application to see if you are getting the log?
Yes I already tried with the demo application https://github.com/aws-samples/amazon-chime-react-native-demo/issues/159#issuecomment-1254751846
Hi, Any update?
Hi sorry for late reply. I couldn't reproduce with our demo application, so I am getting new bluetooth earphone to test again.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hi @hokyungh any update
Hi I have tried all three test cases you posted with new bluetooth device, but only the third case I wasn't able to reproduce. We'll have to look into the third case, but for the first two cases, I hear beeping sound disconnecting and able to get audioDeviceDidChangeWithFreshAudioDeviceList
callback. Let me mark it as bug.
hello any news on this? @hokyungh
Hi @AlkanV, we filed a ticket to apple and waiting for their reply.
@hokyungh thank you for lightning fast response.
Hi @hokyungh Any update ?
Hi @hokyungh Still having this issue.Any progress on this?
Hi sorry, we haven't got reply yet. We might need to implement short-term mitigation to fix this issue.
@hokyungh Hi, Any update on this?
Some times above function does not trigger when the Bluetooth device disconnects/turns off the Bluetooth , but it triggers when the Bluetooth device connecting
Test environment Info (please complete the following information):