Quantcast
Viewing all articles
Browse latest Browse all 229906

How to play only one audio at a time

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 229906

Trending Articles