How to play audio file dyamically using ionic?


#1

Hi All,

Please help me to,how to play audio file dynamically using ionic.I tried with html5 it’s not working dynamically.If we hardcoded the source then it’s working.So please help me to play dynamically.

Thanks,


#2

Have you tried the Media class?

http://ngcordova.com/docs/plugins/media/


#3

Hi vicmota,

I tried like this and also it;s not working.

Play from file system

$scope.playFile = function() {
var src = “http://ipaddress/uploads/audiofile.mp3”;
var media = new Media(src);
$cordovaMedia.play(media);
}


#4

Have you tried media.play() instead of $cordovaMedia.play(media); ?