My Cordova app currently has two ways to play audio, one works on the web app and one works on the cross-platform native app.
<audio id="audio" src="audio.mp3"></audio>
JS: document.getElementById('audio').play();
new Media('audio.mp3').play();
I'm not a fan of writing things twice. Is there an audio solution that works for both web and mobile? Or an elegant way to fallback?
I have used both the media plugin, and HTML5 audio in Cordova apps.
https://github.com/devgeeks/ExampleHTML5AudioStreaming
The Audio element is fairly well supported on mobile.
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