iOS audio/mic issues, requires app to go background -> foreground

Hi devs!

I have this really strange issue and I am not sure where to look for help.
I’ve just posted this as a topic on cordova-plugin-iosrtc google groups as well.
Link: https://groups.google.com/g/cordova-plugin-iosrtc/c/b_TBOfOxtFQ

I have a solution where I mimic a regular phone call behaviour so there is no video included here.

This is issue all about my iOS device not working well with audio/mic, in a followup session, after a previous session has been held, UNTIL the app goes to background and resumes in the foreground, then it all works fine again.

Here’s how it goes:

My iphone 11 (iOS 13.5.1) connects to a session along with some other participant, can be web or android. Audio is working fine. Both are publishers

My iphone disconnects from the session. The other participant does the same thing once he is notified that the iphone has left.

If I do the very same thing again it works fine. It works fine if I do it 100 times, the very same way.

My problem is when the other participant leaves first . When this happens, the iphones mic/audio isn’t working properly for the next session.

However, the audio/mic will all of a sudden start to work if I take the app to the background and then take it to the foreground again, it just starts to work. And this is a behaviour I can reproduce all the time.

I’ve been looking into the differences between the scenarios and the only difference I can see is that the iphone doesn’t receive a “streamDestroyed” in those cases it works fine.

I have “audio” and “voip” enabled as UIBackgroundModes so that the connections are maintained while the app is in the background (might need to check calendar or other apps while having the call)

Please, is anyone able to point me in the right direction?

Thank you!

Ionic:

   Ionic CLI                     : 5.4.16 (C:\Users\richa\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 5.2.1
   @angular-devkit/build-angular : 0.901.8
   @angular-devkit/schematics    : 9.1.8
   @angular/cli                  : 9.1.8
   @ionic/angular-toolkit        : 2.2.0

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.1.0, browser 6.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 19 other plugins)

Utility:

   cordova-res : 0.15.1
   native-run  : 0.3.0

System:

   NodeJS : v12.14.0 (C:\Program Files\nodejs\node.exe)
   npm    : 6.13.4
   OS     : Windows 10

I think I just found the reason to the issue. Rookie misstake, I’ll update this thread with the reason shortly.

I was playing “sound effects” when someone entered/left the session. And guess what? :slight_smile: When I ran .pause() on a HTMLAudioElement is paused all the audio :slight_smile:

1 Like

richard_appsari What is possible or can we use it inside the native
I have seen that I have not found any link, you can tell me if you can use it, how can you use it or not, then why not?

Thanks for sharing the solution