I am working on an Ionic Application and now facing a curious issue.
On a view, i can record audio. On that same view i have many HTML5 audio tags.
The audio tag works well until i launch a record. Once startRecord is executed, i can't play the HTML5 audio no more. The play button doesn't do anything. The recorded audio is well recorded and restarting my application, i can play it, as for the other audio on the page.
I don't have that problem on Android.
I do every thing well i think (i have read that on iOS you have to create the file on the filesytem using the HTML5 APi, what i did with no success), i release the media after recording (but the issue happen even before the stopRecord).
Did someone ever had that issue ? Any clue ?
Cordova : 5.1.1 Plugin Media : 1.0.2 iOS : 8.3
Regards,
Back with a solution.
In file cordova-plugin-media/blob/master/src/ios/CDVSound.m, apply the following patch :
// get the audioSession and set the category to allow recording when device is locked or ring/silent switch engaged
if ([self hasAudioSession]) {
if (![self.avSession.category isEqualToString:AVAudioSessionCategoryPlayAndRecord]) {
- [self.avSession setCategory:AVAudioSessionCategoryRecord error:nil];
+ [self.avSession setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionMixWithOthers error:nil];
}
if (![self.avSession setActive:YES error:&error]) {
Basically while changing our AvAudioSession catagory, we have to put it in category 'Play And Record', not only 'Record' and add option 'to mix with others audio sessions'.
Hope this will help ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With