MediaElement.js - 获取调试信息
我正在使用 MediaElement.js 创建一个音频播放器,如下所示:
//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);
}
});
立即调用错误回调,但它仅包含媒体元素作为参数。这并没有告诉我出了什么问题。
如何获取实际的错误消息以便调试此问题?
请注意,我仅使用 MediaElement 核心 API,因此不是实际的播放器(因此我仅包含 mediaelement.js)。
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).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 MediaElement 选项(以及 flashName、silverlightName 等)中添加
enablePluginDebug:true
,它应该在屏幕上显示调试错误。来自右侧代码示例中的 API 参考。除此之外,我认为他们还没有针对该错误对象的任何详细错误处理,通过查看 github 存储库< /a> 这似乎是底部提到的“待办事项”功能(很可能是 2.2 功能)。
看起来您可能必须暂时弄清楚自己的错误处理方式。
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.