I am using cordova-media-plugin 1.0.1. in an Ionic mobile app. I am using the plugin to play the audio file.
I am able to get it to play using:
var media = $cordovaMedia.newMedia(fileToPlay,
// success callback
mediaSuccess,
// error callback
mediaFailure,
// status callback
mediaStatus
);
I can then call media.play() at it plays the file.
However, the callbacks never seem to execute. I have them defined as:
function mediaSuccess () {
console.log("Successfully finished task.");
}
function mediaFailure (err) {
console.log("An error occurred: " + err.code);
}
function mediaStatus (status) {
console.log("A status change occurred: " + status.code);
}
But they are never called. However, it my console, I am seeing logging from the player itself as it starts and stops playing:
Will attempt to use file resource '//var/mobile/Containers/Data/Application/931BFA01-CDA4-43CD-BC16-7FB6A64305DC/Library/NoCloud/DateTime-1446772191539audio_007.wav'
Playing audio sample '//var/mobile/Containers/Data/Application/931BFA01-CDA4-43CD-BC16-7FB6A64305DC/Library/NoCloud/DateTime-1446772191539audio_007.wav'
Stopped playing audio sample '//var/mobile/Containers/Data/Application/931BFA01-CDA4-43CD-BC16-7FB6A64305DC/Library/NoCloud/DateTime-1446772191539audio_007.wav'
These logging events are going to the console, but they are NOT in my code so they must be coming from the media object.
I need to get the status change and/or success call backs as I need to update the model to enable the play but again when the clip finishes play.
Any thoughts?