我使用以下代码嵌入视频:
$('#trailer-dialog').mediaelementplayer({
enablePluginDebug: false,
// remove or reorder to change plugin priority
plugins: ['flash','silverlight'],
// specify to force MediaElement to use a particular video or audio type
type: '',
// path to Flash and Silverlight plugins
pluginPath: '/build/',
// name of flash file
flashName: 'flashmediaelement.swf',
// name of silverlight file
silverlightName: 'silverlightmediaelement.xap',
// default if the <video width> is not specified
defaultVideoWidth: 1240,
// default if the <video height> is not specified
defaultVideoHeight: 679,
// overrides <video width>
pluginWidth: -1,
// overrides <video height>
pluginHeight: -1,
// rate in milliseconds for Flash and Silverlight to fire the timeupdate event
// larger number is less accurate, but less strain on plugin->JavaScript bridge
timerRate: 250,
success: function (mediaElement, domObject) {
// add event listener
mediaElement.addEventListener('ended', trailerEnded, false);
// call the play method
mediaElement.play();
},
// fires when a problem is detected
error: function () {
}
});
这是事件触发时要执行的函数:
function trailerEnded(e){
e.target.stop();
$.cookie('trailer_played', 'true');
$('#wrapper').css('display', 'block');
$('#trailer').css('display', 'none');
alert('test');
}
这段代码在能够显示HTML5视频的浏览器中运行。但是在使用Flash回退的IE 6-8中无法正常工作。
有没有解决方法?
谢谢。
Lukas