apache / cordova-plugin-media

Apache Cordova Media Plugin
https://cordova.apache.org/
Apache License 2.0
388 stars 768 forks source link

[iOs] plugin configures AVAudioSession after AVAudioPlayer makes it active inside prepareToPlay #319

Open RSATom opened 2 years ago

RSATom commented 2 years ago

According to AVAudioPlayer docs prepareToPlay activates audio session (in plugin it happens here). But plugin calls setCategory for AVAudioSession a little bit later, i.e. at wrong time.

RSATom commented 2 years ago

I found this issue while was trying to solve https://github.com/apache/cordova-plugin-media/issues/306. I was trying to add withOptions:AVAudioSessionCategoryOptionMixWithOthers to https://github.com/apache/cordova-plugin-media/blob/master/src/ios/CDVSound.m#L374 but it was working only on second play...

johannds commented 2 years ago

It blows my mind that this isn't configurable inside this highly used plugin.