Cordova Media Plugin vs HTML5 Audio

cordova, ionic-framework

Solution

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.

Problem

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?

Original source

Related problems