Ring a bell at $scope.counter === 0?


#1

Hello ionicframework forum friends,

I want to play a short soundclip, such as a bell or a chime, at the end of a function. It will literally play for 5 seconds and then not play again until the same event is fired.

$scope.on('timer-end', function () {
    // play chime
    return;
}

Will the best method be to use ngCordovas Media Plugin, or will this completely enable the Music application within the respective operating system?

Thank you!


#2

Hey @azurikai!

If you code something like this:

var media = $cordovaMedia.newMedia(src);
media.play();

The sound will be played in background (the Music app will not appear)


#3

@juliosampaio

exactly what I was wondering. I was just worried it’d open up the media player, thanks for the help man :heart: