Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova Media Plugin vs HTML5 Audio [closed]

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?

like image 719
benshope Avatar asked Jul 09 '14 00:07

benshope


1 Answers

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.

like image 117
Devgeeks Avatar answered Oct 23 '22 17:10

Devgeeks