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.
- HTML5 for Web HTML:
<audio id="audio" src="audio.mp3"></audio>
JS:document.getElementById('audio').play();
- Cordova Plugin for Mobile JS
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?