Cordova Media plugin not throwing success or error callback

I can't get Cordova Media to work at all on Android, I can instantiate the Media object, but neither success nor error callback is ever called.

I am using Apache Cordova 5.1.1 with Media plugin 1.0.1 on Android 5.1.1, in deviceready event handler I have the following code:

var src = 'https://ia802508.us.archive.org/5/items/testmp3testfile/mpthreetest.mp3';
console.log('Media object: ' + Media);
this.media = new Media(src, function () {
    console.log('SUCCESS');
}, function (error) {
    console.log('ERROR');
});
console.log('Media instance: ' + this.media);

      

which produces the following output:

I/chromium( 1953): [INFO:CONSOLE(6)] "Media object: function (src, successCallback, errorCallback, statusCallback) {
I/chromium( 1953):     argscheck.checkArgs('sFFF', 'Media', arguments);
I/chromium( 1953):     this.id = utils.createUUID();
I/chromium( 1953):     mediaObjects[this.id] = this;
I/chromium( 1953):     this.src = src;
I/chromium( 1953):     this.successCallback = successCallback;
I/chromium( 1953):     this.errorCallback = errorCallback;
I/chromium( 1953):     this.statusCallback = statusCallback;
I/chromium( 1953):     this._duration = -1;
I/chromium( 1953):     this._position = -1;
I/chromium( 1953):     exec(null, this.errorCallback, "Media", "create", [this.id, this.src]);
I/chromium( 1953): }", source: file:///android_asset/www/scripts/index.js (6)
I/chromium( 1953): [INFO:CONSOLE(12)] "Media instance: [object Object]", source: file:///android_asset/www/scripts/index.js (12)

      

so the Media object is explicitly there and the instance is instantiated but then nothing happens, no callback is executed. Am I doing something wrong or am I finding an error?

+3


source to share





All Articles