MediaElement.js - getting debug info
-
27-10-2019 - |
Pergunta
I'm creating an audio player with MediaElement.js, like this:
//button has been clicked, create new audio player and play
var audioElement = $('<audio>', {
id : 'audioPlayer' + index,
src : '/streamFriendFile',
loop : 'loop',
preload : 'none'
})[0];
$(row).append(audioElement);
new MediaElement(audioElement, {
plugins : ['flash', 'silverlight'],
pluginPath : 'http://localhost:3000/mediaelement/',
flashName : 'flashmediaelement.swf',
silverlightName : 'silverlightmediaelement.xap',
pluginWidth : 0,
pluginHeight : 0,
audioWidth: 0,
audioHeight : 0,
startVolume: 0.8,
//loop: true,
//enableAutosize: false,
//features : [],
//timerRate : 250,
success : function(mediaElement, domObj) {
console.log('mediaElement success!');
mediaElement.play();
},
error : function(mediaElement) {
console.log('medialement problem is detected: %o', mediaElement);
}
});
The error callback is immediately called, but it only contains the media element as an argument. This does not tell me what is wrong.
How can I get the actual error message so I can debug this issue?
Note that I'm only using the MediaElement core API, thus not the actual player (so I only include mediaelement.js).
Solução
In your MediaElement options (along with flashName, silverlightName, etc...) add enablePluginDebug:true
and it should show debug errors on the screen. From the API reference in the code example at right.
Other than that I don't believe they have any detailed error handling yet for that error object, from looking at the github repo it seems to be a "to do" feature mentioned at the bottom (most likely a 2.2 feature).
Looks like you might have to figure out your own error handling for the time being.