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

Using AVAudioSession overrideOutput to speaker causes WebRTC to malfunction #289

Closed
Jun711 opened this issue Jun 10, 2017 · 9 comments
Closed
Assignees
Milestone

Comments

@Jun711
Copy link

Jun711 commented Jun 10, 2017

I am using @saghul AudioRoute and also this plugin to set up a WebRTC p2p call. I have encountered this problem recently.

To reproduce this problem:

  1. Set up an active WebRTC call.
  2. Toggle the speaker on then off(overrideOutput to speaker).
  3. GSM call interrupts the current WebRTC call (accept / reject).
  4. WebRTC call loses audio.

It doesn't happen if I don't toggle the speaker. Fyi, I have tried to listen to AVAudioSessionInterruption event and reset the audio but to no avail. Just wonder if anyone has seen the same problem.

@saghul
Copy link
Collaborator

saghul commented Jun 10, 2017

Do you lose the override or do you lose audio completely?

@Jun711
Copy link
Author

Jun711 commented Jun 10, 2017

I lost the audio completely so I don't know if I lost the override too.

  1. make the AVAudioSession to listen for AVAudioSessionInterruption event and set the AVAudioSession to inactive when there is an incoming interruption. And, when the interruption is over, set it back to active again.
  2. make the AVAudioSession to listen for AVAudioSessionInterruption event and set the AVAudioSession override to default when there is an incoming call.

I wonder if you have the same issue too, @saghul . Thank you!

@ibc
Copy link
Collaborator

ibc commented Jul 15, 2017

I wonder if you have the same issue too, @saghul .

Others may also reply.

@saghul
Copy link
Collaborator

saghul commented Jul 17, 2017

The problem is that libwebrtc (which this plugin is based on) assumed nobody else was changing the AVAudioSession configuration other than itself, until M59.

Once we update the library, all those problems will (hopefully) go away, but it's not an easy feat.

@saghul
Copy link
Collaborator

saghul commented Jul 17, 2017

Oh, and no, we have no ETA for when the update will happen.

@hthetiot hthetiot added the bug label Aug 14, 2019
@hthetiot
Copy link
Contributor

The problem is that libwebrtc (which this plugin is based on) assumed nobody else was changing the AVAudioSession configuration other than itself, until M59.

Once we update the library, all those problems will (hopefully) go away, but it's not an easy feat.

@hthetiot
Copy link
Contributor

hthetiot commented Oct 6, 2019

I will implement AVAudioSession.interruptionNotification here

Will be fixed via #399 on 6.0.0

@hthetiot
Copy link
Contributor

@hthetiot
Copy link
Contributor

This works.

cordova plugin add cordova-plugin-background-mode

 // Enable Background audio
          if (cordova && cordova.plugins && cordova.plugins.backgroundMode) {
              cordova.plugins.backgroundMode.enable();
          }

@hthetiot hthetiot modified the milestones: 6.0.x, 5.0.4, 5.0.5 Oct 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants