I am new to apps development, so I apologize if I am asking something which may seem simple.
I am building a hybrid application using ionic. Everything was smooth until I tried to play audio. I am trying to play an HLS audio stream and some mp3 files located on a web server.
After a research on the internet and various tests using players, I used the video.js. After some tests I figured out, that the player was not responding to android versions prior to 4.4.2. ...and I haven't yet made any test on IOS.
I am realy confused on how I can play audio on a hybrid mobile application.
Any help is much appreciated!
The audio feature in Ionic Framework can be implemented by using the Apache Cordova Media plugin, and ngCordova.
Install the plugin by running the following ,
cordova plugin add org.apache.cordova.media
1.Play audio file from internet
html
<button class="button" ng-click="play('http://www.stephaniequinn.com/Music/Commercial%20DEMO%20-%2013.mp3')">Play from internet</button>
1.play a song from the file system
html
<button class="button" ng-click="play('www/mp3/song.mp3')">Play from file system</button>
controller
$scope.play = function(src) {
var media = new Media(src, null, null, mediaStatusCallback);
$cordovaMedia.play(media);
}
it will try to play song from /storage/emulated/0/www/mp3/song.mp3
Please refer this blog.You will get more idea.If you have any doubt,please let me know,thanks