我无法让Android上的Cordova Media工作,我可以实例化一个Media对象,但是既没有调用成功也没有调用错误回调。
我在Android 5.1.1上使用Apache Cordova 5.1.1和Media插件1.0.1,在deviceready事件处理程序中我有以下代码:
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);
产生以下输出:
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)
所以Media对象显然在那里并且创建了一个实例,但是什么都没发生,也没有运行回调函数。我做错了什么还是我遇到了错误?