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

7.0.0-RC4 Does not restore audio device, always speaker #551

Closed
2 of 3 tasks
bkervaski opened this issue Jul 29, 2020 · 16 comments
Closed
2 of 3 tasks

7.0.0-RC4 Does not restore audio device, always speaker #551

bkervaski opened this issue Jul 29, 2020 · 16 comments
Assignees
Milestone

Comments

@bkervaski
Copy link

bkervaski commented Jul 29, 2020

Please read first!

Please use Public Google Group (mailing list) for general technical discussions and questions.

  • I have used Google with the error message or bug in association with the library and Cordova words to make sure the issue I'm reporting is only related to iOSRTC.
  • I have provided steps to reproduce (e.g. sample code or updated extra/renderer-and-libwebrtc-tests.js file).
  • I have provided third party library name and version, ios, Xcode and plugin version and adapter.js version if used.

Note: If the checkboxes above are not checked (which you do after the issue is posted), the issue will be closed, removing this checkbox will result in automatic closed issue.

Versions affected

  • Cordova version (e.g 7.1.0): 9.0.0
  • Plugin version (e.g 6.0.12): 8.0.0RC1
  • iOS version (e.g 10.2): 13.6
  • Xcode version (e.g 11.1 - 11A1027): 11.6
  • WebRTC-adapter version (e.g. 7.4.0):
  • WebRTC Framework version (e.g. JSSip 3.1.2): JSSip 3.5

Description

iOS audio device always left on speaker after session

Steps to reproduce

Expected results

Actual results

@hthetiot
Copy link
Contributor

@bkervaski Can you confirm you do not reproduce this issue with 6.0.12 and 7.0.0-RC3 ?

@hthetiot hthetiot changed the title 8.0.0RC1 Does not restore audio device, always speaker 8.0.0-RC1 Does not restore audio device, always speaker Jul 30, 2020
@hthetiot hthetiot added this to the 8.0.0 milestone Jul 30, 2020
@hthetiot hthetiot added the bug label Jul 30, 2020
@hthetiot hthetiot self-assigned this Jul 30, 2020
@bkervaski
Copy link
Author

With 6.0.12 it's working fine, but with 7.0.0 and 8.0.0 it seems the library is setting the AVAudioSession AVAudioSessionPortOverride on it's own terms, not honoring the default state or any state changes. When you terminate a session, it always leaves AVAudioSessionPortOverrideSpeaker. Hope this helps!

@hthetiot
Copy link
Contributor

hthetiot commented Jul 30, 2020

With 6.0.12 it's working fine, but with 7.0.0 and 8.0.0 it seems the library is setting the AVAudioSession AVAudioSessionPortOverride on it's own terms, not honoring the default state or any state changes. When you terminate a session, it always leaves AVAudioSessionPortOverrideSpeaker. Hope this helps!

Thank you, I think the issue is on master and incoming 6.0.13, since 7.00 and 8.00 has merged master the issue also occur, possibly due to this changes c49bdc5#diff-59c7d02174607ded42b5b45bc22f8b06

Can you test this 2 version and tell me if you have the issue, it will help to confirm what changes introduced the behavior changes.

Example with 15402b1:

cordova plugin remove cordova-plugin-iosrtc --verbose
cordova plugin add https://github.com/cordova-rtc/cordova-plugin-iosrtc#15402b1 --verbose
cordova platform remove ios --no-save
cordova platform add ios --no-save

@hthetiot
Copy link
Contributor

@bkervaski
Copy link
Author

Both 995eaaf and 15402b1 work the same as 6.0.12.

I re-tested 7.0.0 and 8.0.0, both have the issue.

One thing that is noticeably different, 7.0.0 and 8.0.0 both initialize the audio for the app in ambient mode, where all the regular audio (i.e., Audio().play() or AudioContext audio) are lower volume than should be until the first call, then the audio is at a normal level.

Hope this helps :)

@bkervaski
Copy link
Author

I also tested with 6.0.13 and this version works like 6.0.12 and does not exhibit the behavior as 7.0.0 and 8.0.0.

@hthetiot
Copy link
Contributor

I also tested with 6.0.13 and this version works like 6.0.12 and does not exhibit the behavior as 7.0.0 and 8.0.0.

Thank you this help a lot.

@hthetiot hthetiot modified the milestones: 8.0.0, 7.0.x, 7.0.0 Jul 31, 2020
@hthetiot hthetiot changed the title 8.0.0-RC1 Does not restore audio device, always speaker 7.0.0-RC3 Does not restore audio device, always speaker Jul 31, 2020
@hthetiot
Copy link
Contributor

hthetiot commented Aug 4, 2020

Please test #task/7.0.0 or 7.0.0-RC4

@hthetiot
Copy link
Contributor

hthetiot commented Aug 4, 2020

Is that related #486, I wonder.

@bkervaski
Copy link
Author

I tested 7.0.0-RC4 and the same result. I then added cordova-plugin-nativeaudio just to see if I could hack around the issue.

What happens is on initial app startup, the volume is low (ambient) and then at the end of the first ios-rtc call the volume is unpredictable based on what happened before the first ios-rtc call.

For example, if I play a nativeaudio loop, it plays at non-ambient (normal) sound levels. Then, after the first call, all audio (including the loop) are back to ambient (low volume).

If I create an AudioContext and say generate some sounds, on app launch it's ambient. After the first ios-rtc call, it's now normal.

On 6.0.13 I can overcome this by simply playing a silent mp3 file on app launch, seems to work. But 6.0.13 has the ontrack() bug, so I have to use the later versions.

Is it possible to just disable all audio control in ios-rtc, at least as an option, so we can simply set the state elsewhere and not let ios-rtc manipulate that state?

Anyway, hope this helps :)

@hthetiot
Copy link
Contributor

hthetiot commented Aug 5, 2020

Is it possible to just disable all audio control in ios-rtc, at least as an option, so we can simply set the state elsewhere and not let ios-rtc manipulate that state?

Yes via MANUAL_INIT_AUDIO_DEVICE (#503) that is part of 6.0.13, when you install the MANUAL_INIT_AUDIO_DEVICE value willl be false by default.

Is that what you looking for @bkervaski ?

I also realize that we enforce the output here but we do not restore it on Peer or Media/Track Close for example.
https://github.com/cordova-rtc/cordova-plugin-iosrtc/blob/master/src/PluginRTCPeerConnection.swift#L256

@hthetiot hthetiot modified the milestones: 7.0.0, 6.0.14 Aug 5, 2020
@hthetiot
Copy link
Contributor

hthetiot commented Aug 5, 2020

But 6.0.13 has the ontrack() bug, so I have to use the later versions.

@bkervaski ontrack() bug should be fixed on master and on 6.0.13-RC2 do you mind testing again with MANUAL_INIT_AUDIO_DEVICE and 6.0.13 (confirm if ontrack fixed).

@hthetiot hthetiot changed the title 7.0.0-RC3 Does not restore audio device, always speaker 7.0.0-RC4 Does not restore audio device, always speaker Aug 5, 2020
@hthetiot hthetiot modified the milestones: 6.0.14, 7.0.x Sep 15, 2020
@hthetiot hthetiot added this to the 7.0.0 milestone Sep 15, 2020
@hthetiot
Copy link
Contributor

@bkervaski can you test 6.0.16 and if still not fixed comment to reopen. See previous comments for fix master and releases.

@hthetiot hthetiot modified the milestones: 7.0.0, 8.0.0 Nov 27, 2020
@numerized
Copy link

Hello here,
the audio is still low volume at the end of a session and is ducking all other apps volume until we hard quit the app.
Thanks for your initial post @bkervaski
I tried to

    cordova.plugins.iosrtc.selectAudioOutput("speaker")
    cordova.plugins.iosrtc.turnOnSpeaker(true);
    cordova.plugins.iosrtc.initAudioDevices()

not helping, I remember previously in6.0.12 all was ok back then.
I even downgraded because of this precisely.

@numerized
Copy link

I'm on IOSRTC 8, I'll now try 6.0.16

@numerized
Copy link

yeah I confirm the audio is still low volume at the end of a session on 6.0.16
I'm now going to try with 6.0.12

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

3 participants