I am using cordova media plugin
in my Controller:
$scope.playAudio = function(src) { src = '/android_asset/www/files/' + src; var media = $cordovaMedia.newMedia(src); media.play(); }
Template HTML:
<img src="img/speaker.png" ng-click="playAudio('test.mp3')" />
The audio file is only 10 seconds long.
When I click the speaker icon, the audio plays fine.
When i click again before the audio finished, another instance starts playing without stopping the previous one.
I'd like know how to stop the current playing instance first.
Thanks.