I am using cordova-media-plugin 1.0.1. in the Ionic mobile app. I am using a plugin to play an audio file.
I can make him play using:
var media = $cordovaMedia.newMedia(fileToPlay, // success callback mediaSuccess, // error callback mediaFailure, // status callback mediaStatus );
Then I can call media.play () when playing the file.
However, callbacks are never executed. I define them 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, this is my console, I see a record from the player himself, when he 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 registration events go to the console, but they are NOT in my code, so they must come from a media object.
I need to get status changes and / or successful callbacks, since I need to update the model to enable playback, but again when the clip ends.
Any thoughts?
source share