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

iosrtc.enumerateDevices() call causes AVAudioSession to reset to its default settings #438

Closed
soulfly opened this issue Nov 5, 2019 · 4 comments
Assignees
Labels
Milestone

Comments

@soulfly
Copy link

soulfly commented Nov 5, 2019

Today I fought with a strange issue

By some reason, after upgraded to iOS 13 plugin version support, a switch audio output option stopped working in our app. Every time a user switches to speakerphone, it works ok, but only for some short period of time, then the audio output returns to earpiece.

After deep debugging, I noticed that every call to iosrtc.enumerateDevices() resets the audio session settings to default one.

The chain is the following:

  1. https://github.com/cordova-rtc/cordova-plugin-iosrtc/blob/master/src/iosrtcPlugin.swift#L991
  2. https://github.com/cordova-rtc/cordova-plugin-iosrtc/blob/master/src/PluginEnumerateDevices.swift#L28
  3. https://github.com/cordova-rtc/cordova-plugin-iosrtc/blob/master/src/PluginEnumerateDevices.swift#L105
  4. https://github.com/cordova-rtc/cordova-plugin-iosrtc/blob/master/src/PluginRTCAudioController.swift#L17

I think it should not be here and this one call in pluginInitialize to set default audio session settings should be enough https://github.com/cordova-rtc/cordova-plugin-iosrtc/blob/master/src/iosrtcPlugin.swift#L52

Otherwise it can produce unexpected things in users' apps

Platform information

  • Cordova version:
    8.1.2

  • Plugin version:
    latest master

  • iOS version:
    13.2

  • Xcode version:
    11.2

@hthetiot hthetiot added the bug label Nov 5, 2019
@hthetiot hthetiot added this to the 6.0.x milestone Nov 5, 2019
@hthetiot
Copy link
Contributor

hthetiot commented Nov 5, 2019

@soulfly thank you, I will look into it.

hthetiot added a commit that referenced this issue Nov 5, 2019
…tAllAudioDevices causing AVAudioSession to reset to its default settings #438
@hthetiot
Copy link
Contributor

hthetiot commented Nov 5, 2019

@soulfly Can you test this PR #439
If all good will be released in 6.0.3 tomorrow with #437

@hthetiot hthetiot modified the milestones: 6.0.x, 6.0.3 Nov 5, 2019
@hthetiot hthetiot closed this as completed Nov 5, 2019
@hthetiot hthetiot self-assigned this Nov 5, 2019
@soulfly
Copy link
Author

soulfly commented Nov 5, 2019

I can confirm it works this way
@hthetiot thank you 🥇

@hthetiot
Copy link
Contributor

hthetiot commented Nov 6, 2019

@soulfly Released on #425 (comment)

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

No branches or pull requests

2 participants