/*!
*
* MediaElementPlayer
* http://mediaelementjs.com/
*
* Creates a controller bar for HTML5
')
.appendTo($('body'))
.hide();
// create events for showing context menu
player.container.bind('contextmenu', function(e) {
if (player.isContextMenuEnabled) {
e.preventDefault();
player.renderContextMenu(e.clientX-1, e.clientY-1);
return false;
}
});
player.container.bind('click', function() {
player.contextMenu.hide();
});
player.contextMenu.bind('mouseleave', function() {
//
player.startContextMenuTimer();
});
},
cleancontextmenu: function(player) {
player.contextMenu.remove();
},
isContextMenuEnabled: true,
enableContextMenu: function() {
this.isContextMenuEnabled = true;
},
disableContextMenu: function() {
this.isContextMenuEnabled = false;
},
contextMenuTimeout: null,
startContextMenuTimer: function() {
//
var t = this;
t.killContextMenuTimer();
t.contextMenuTimer = setTimeout(function() {
t.hideContextMenu();
t.killContextMenuTimer();
}, 750);
},
killContextMenuTimer: function() {
var timer = this.contextMenuTimer;
//
if (timer != null) {
clearTimeout(timer);
delete timer;
timer = null;
}
},
hideContextMenu: function() {
this.contextMenu.hide();
},
renderContextMenu: function(x,y) {
// alway re-render the items so that things like "turn fullscreen on" and "turn fullscreen off" are always written correctly
var t = this,
html = '',
items = t.options.contextMenuItems;
for (var i=0, il=items.length; i' + rendered + '';
}
}
}
// position and show the context menu
t.contextMenu
.empty()
.append($(html))
.css({top:y, left:x})
.show();
// bind events
t.contextMenu.find('.mejs-contextmenu-item').each(function() {
// which one is this?
var $dom = $(this),
itemIndex = parseInt( $dom.data('itemindex'), 10 ),
item = t.options.contextMenuItems[itemIndex];
// bind extra functionality?
if (typeof item.show != 'undefined')
item.show( $dom , t);
// bind click action
$dom.click(function() {
// perform click action
if (typeof item.click != 'undefined')
item.click(t);
// close
t.contextMenu.hide();
});
});
// stop the controls from hiding
setTimeout(function() {
t.killControlsTimer('rev3');
}, 100);
}
});
})(mejs.$);
/**
* Postroll plugin
*/
(function($) {
$.extend(mejs.MepDefaults, {
postrollCloseText: mejs.i18n.t('Close')
});
// Postroll
$.extend(MediaElementPlayer.prototype, {
buildpostroll: function(player, controls, layers, media) {
var
t = this,
postrollLink = t.container.find('link[rel="postroll"]').attr('href');
if (typeof postrollLink !== 'undefined') {
player.postroll =
$('
').prependTo(layers).hide();
t.media.addEventListener('ended', function (e) {
$.ajax({
dataType: 'html',
url: postrollLink,
success: function (data, textStatus) {
layers.find('.mejs-postroll-layer-content').html(data);
}
});
player.postroll.show();
}, false);
}
}
});
})(mejs.$);