I use the following code to embed a video:
$('#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 () { } });
this is the function that should be executed when the event is triggered:
function trailerEnded(e){ e.target.stop(); $.cookie('trailer_played', 'true'); $('#wrapper').css('display', 'block'); $('#trailer').css('display', 'none'); alert('test'); }
it runs in browsers that can display htm5 video. but in IE 6-8, which use flash reserve, it does not work.
any ideas to fix this?
thanks
Lukas
luksak
source share