Closed blakecrosley closed 9 years ago
That must be because the server is stopped when your app moves to the background.
If you can change the native code a bit then I can send you a code pointer to keep it running..
I can change the native code. How would you suggest we keep the server running in the background? Do we have to change WKWebView plugin?
Thanks for your help!
Here's a little more info:
We used this plugin for ducking and background audio https://github.com/maxcabral/CDVAudioSession
Here's the audio part on the cordova app:
function play_sound_mobile(src, start_pos, duration) {
my_media = new Media("http://localhost:12344/" + src, function(){console.log("success playing sound");}, function (error){console.log(error);});
my_media.setVolume('1.0');
my_media.play({playAudioWhenScreenIsLocked : true});
}
Hey @blakecrosley you can uncomment this line. Try that first and if it doesn't work we'll spit deeper.
That works! So I'll have to make that change on new builds? Glad to see it was an easy fix. Thank you.
I switched to WKWebView with a noticeable performance boost. Kudos. Only problem I'm seeing with my current build is failure to play an audio file from localhost. Let me know if I should add more info / what info to add.
Audio plays in foreground:
Audio fails in background: