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

Bugfix/ios audio managment on app start #1120

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

PawelBijok
Copy link
Contributor

Fixes #1119

@PawelBijok PawelBijok changed the title Bugfix/i os audio managment on app start Bugfix/ios audio managment on app start Oct 12, 2022
@PawelBijok PawelBijok force-pushed the bugfix/iOS-audio-managment-on-app-start branch from 41af8b8 to 7c41d80 Compare October 12, 2022 10:26
@@ -542,6 +542,11 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult) result
}
[dataChannels removeAllObjects];
}

#if TARGET_OS_IPHONE
[[NSNotificationCenter defaultCenter] removeObserver:self];
Copy link
Member

Choose a reason for hiding this comment

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

Here is for sure some formatting issue. Please use the same formatting as in edited file.

Comment on lines 144 to 150
#if TARGET_OS_IPHONE
_preferredInput = AVAudioSessionPortHeadphones;
_speakerOn = NO;
[AudioUtils setSpeakerphoneOn:_speakerOn];
AVAudioSession *session = [AVAudioSession sharedInstance];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didSessionRouteChange:) name:AVAudioSessionRouteChangeNotification object:session];
#endif
Copy link
Member

Choose a reason for hiding this comment

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

But what if several peer connection will be created simultaneously?

_speakerOn = NO;
[AudioUtils setSpeakerphoneOn:_speakerOn];
AVAudioSession *session = [AVAudioSession sharedInstance];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didSessionRouteChange:) name:AVAudioSessionRouteChangeNotification object:session];
Copy link
Member

Choose a reason for hiding this comment

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

I think that at last this part must be left here, because technically we could want to get this notification event without active peer connection.

@cloudwebrtc
Copy link
Member

cloudwebrtc commented Oct 17, 2022

@PawelBijok hey, I added some changes to #1122, it will only operate when RTCAudioSession.isActive, so the problem you described should be fixed, I opened the flutter-webrtc/example app when the zoom meeting was open, and the test results have been Will not affect the voip/music app anymore.
https://github.com/flutter-webrtc/flutter-webrtc/blob/main/common/darwin/Classes/FlutterWebRTCPlugin.m#L130

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Audio management disturbed by plugin on iOS
4 participants