Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

How to play only one audio at a time

$
0
0

just managed to achieve what i want.
Hopefully i m doing it in the right way.

var sound_on = false;
var media = new Media( '/android_asset/www/files/test.mp3');undefined> $scope.playAudio = function(filename, duration) {

if (sound_on == true) {

  media.stop();
  media.release();
}

sound_on = true;
media = $cordovaMedia.newMedia('/android_asset/www/files/' + filename + '.mp3');
media.play();

$timeout(function(){
     sound_on = false;
     }, duration);

}


Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>