Media: Add MediaElement.js 2.2 back-compat for MediaElement.js 4.2
* Introduces `mediaelement-migrate.js`. * Upgrades ME.js from 4.2.5-74e01a40 to 4.2.6-78496d1. Props rafa8626, bradyvercher. See #39686. Fixes #42189. Built from https://develop.svn.wordpress.org/trunk@41877 git-svn-id: http://core.svn.wordpress.org/trunk@41711 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4085a1b266
commit
2e602a8560
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,84 @@
|
|||
/* global console, MediaElementPlayer, mejs */
|
||||
(function ( window, $ ) {
|
||||
// Reintegrate `plugins` since they don't exist in MEJS anymore; it won't affect anything in the player
|
||||
if (mejs.plugins === undefined) {
|
||||
mejs.plugins = {};
|
||||
mejs.plugins.silverlight = [];
|
||||
mejs.plugins.silverlight.push({
|
||||
types: []
|
||||
});
|
||||
}
|
||||
|
||||
// Inclusion of old `HtmlMediaElementShim` if it doesn't exist
|
||||
mejs.HtmlMediaElementShim = mejs.HtmlMediaElementShim || {
|
||||
getTypeFromFile: mejs.Utils.getTypeFromFile
|
||||
};
|
||||
|
||||
// Add missing global variables for backward compatibility
|
||||
if (mejs.MediaFeatures === undefined) {
|
||||
mejs.MediaFeatures = mejs.Features;
|
||||
}
|
||||
if (mejs.Utility === undefined) {
|
||||
mejs.Utility = mejs.Utils;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create missing variables and have default `classPrefix` overridden to avoid issues.
|
||||
*
|
||||
* `media` is now a fake wrapper needed to simplify manipulation of various media types,
|
||||
* so in order to access the `video` or `audio` tag, use `media.originalNode` or `player.node`;
|
||||
* `player.container` used to be jQuery but now is a HTML element, and many elements inside
|
||||
* the player rely on it being a HTML now, so its conversion is difficult; however, a
|
||||
* `player.$container` new variable has been added to be used as jQuery object
|
||||
*/
|
||||
var init = MediaElementPlayer.prototype.init;
|
||||
MediaElementPlayer.prototype.init = function () {
|
||||
this.options.classPrefix = 'mejs-';
|
||||
this.$media = this.$node = $( this.node );
|
||||
init.call( this );
|
||||
};
|
||||
|
||||
var ready = MediaElementPlayer.prototype._meReady;
|
||||
MediaElementPlayer.prototype._meReady = function () {
|
||||
this.container = $( this.container) ;
|
||||
this.controls = $( this.controls );
|
||||
this.layers = $( this.layers );
|
||||
ready.apply( this, arguments );
|
||||
};
|
||||
|
||||
// Override method so certain elements can be called with jQuery
|
||||
MediaElementPlayer.prototype.getElement = function ( el ) {
|
||||
return $ !== undefined && el instanceof $ ? el[0] : el;
|
||||
};
|
||||
|
||||
// Add jQuery ONLY to most of custom features' arguments for backward compatibility; default features rely 100%
|
||||
// on the arguments being HTML elements to work properly
|
||||
MediaElementPlayer.prototype.buildfeatures = function ( player, controls, layers, media ) {
|
||||
var defaultFeatures = [
|
||||
'playpause',
|
||||
'current',
|
||||
'progress',
|
||||
'duration',
|
||||
'tracks',
|
||||
'volume',
|
||||
'fullscreen'
|
||||
];
|
||||
for (var i = 0, total = this.options.features.length; i < total; i++) {
|
||||
var feature = this.options.features[i];
|
||||
if (this['build' + feature]) {
|
||||
try {
|
||||
// Use jQuery for non-default features
|
||||
if (defaultFeatures.indexOf(feature) === -1) {
|
||||
this['build' + feature]( player, $(controls), $(layers), media );
|
||||
} else {
|
||||
this['build' + feature]( player, controls, layers, media );
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.error( 'error building ' + feature, e );
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
})( window, jQuery );
|
|
@ -315,8 +315,8 @@ i18n.language = function () {
|
|||
throw new TypeError('Language code must be a string value');
|
||||
}
|
||||
|
||||
if (!/^[a-z]{2}(\-[a-z]{2})?$/i.test(args[0])) {
|
||||
throw new TypeError('Language code must have format `xx` or `xx-xx`');
|
||||
if (!/^(([a-z]{2}((\-|_)[a-z]{2})?)|([a-z]{3}))$/i.test(args[0])) {
|
||||
throw new TypeError('Language code must have format `xx`, `xxx`, `xx_XX` or `xx-xx`');
|
||||
}
|
||||
|
||||
i18n.lang = args[0];
|
||||
|
@ -864,9 +864,23 @@ var MediaElement = function MediaElement(idOrNode, options, sources) {
|
|||
triggerAction = function triggerAction(methodName, args) {
|
||||
try {
|
||||
if (methodName === 'play' && t.mediaElement.rendererName === 'native_dash') {
|
||||
setTimeout(function () {
|
||||
t.mediaElement.renderer[methodName](args);
|
||||
}, 150);
|
||||
var response = t.mediaElement.renderer[methodName](args);
|
||||
if (response && typeof response.then === 'function') {
|
||||
response.catch(function () {
|
||||
if (t.mediaElement.paused) {
|
||||
setTimeout(function () {
|
||||
var tmpResponse = t.mediaElement.renderer.play();
|
||||
if (tmpResponse !== undefined) {
|
||||
tmpResponse.catch(function () {
|
||||
if (!t.mediaElement.renderer.paused) {
|
||||
t.mediaElement.renderer.pause();
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 150);
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
t.mediaElement.renderer[methodName](args);
|
||||
}
|
||||
|
@ -994,7 +1008,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|||
|
||||
var mejs = {};
|
||||
|
||||
mejs.version = '4.2.5';
|
||||
mejs.version = '4.2.6';
|
||||
|
||||
mejs.html5media = {
|
||||
properties: ['volume', 'src', 'currentTime', 'muted', 'duration', 'paused', 'ended', 'buffered', 'error', 'networkState', 'readyState', 'seeking', 'seekable', 'currentSrc', 'preload', 'bufferedBytes', 'bufferedTime', 'initialTime', 'startOffsetTime', 'defaultPlaybackRate', 'playbackRate', 'played', 'autoplay', 'loop', 'controls'],
|
||||
|
@ -1562,6 +1576,7 @@ var FlashMediaElementRenderer = {
|
|||
create: function create(mediaElement, options, mediaFiles) {
|
||||
|
||||
var flash = {};
|
||||
var isActive = false;
|
||||
|
||||
flash.options = options;
|
||||
flash.id = mediaElement.id + '_' + flash.options.prefix;
|
||||
|
@ -1629,21 +1644,23 @@ var FlashMediaElementRenderer = {
|
|||
var methods = _mejs2.default.html5media.methods,
|
||||
assignMethods = function assignMethods(methodName) {
|
||||
flash[methodName] = function () {
|
||||
if (flash.flashApi !== null) {
|
||||
if (flash.flashApi['fire_' + methodName]) {
|
||||
try {
|
||||
flash.flashApi['fire_' + methodName]();
|
||||
} catch (e) {
|
||||
if (isActive) {
|
||||
if (flash.flashApi !== null) {
|
||||
if (flash.flashApi['fire_' + methodName]) {
|
||||
try {
|
||||
flash.flashApi['fire_' + methodName]();
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
flash.flashApiStack.push({
|
||||
type: 'call',
|
||||
methodName: methodName
|
||||
});
|
||||
}
|
||||
} else {
|
||||
flash.flashApiStack.push({
|
||||
type: 'call',
|
||||
methodName: methodName
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -1715,16 +1732,28 @@ var FlashMediaElementRenderer = {
|
|||
flashVars.push('pseudostreamtype=' + flash.options.pseudoStreamingType);
|
||||
}
|
||||
|
||||
if (flash.options.streamDelimiter) {
|
||||
flashVars.push('streamdelimiter=' + encodeURIComponent(flash.options.streamDelimiter));
|
||||
}
|
||||
|
||||
if (flash.options.proxyType) {
|
||||
flashVars.push('proxytype=' + flash.options.proxyType);
|
||||
}
|
||||
|
||||
mediaElement.appendChild(flash.flashWrapper);
|
||||
mediaElement.originalNode.style.display = 'none';
|
||||
|
||||
var settings = [];
|
||||
|
||||
if (_constants.IS_IE) {
|
||||
if (_constants.IS_IE || _constants.IS_EDGE) {
|
||||
var specialIEContainer = _document2.default.createElement('div');
|
||||
flash.flashWrapper.appendChild(specialIEContainer);
|
||||
|
||||
settings = ['classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"', 'codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"', 'id="__' + flash.id + '"', 'width="' + flashWidth + '"', 'height="' + flashHeight + '"'];
|
||||
if (_constants.IS_EDGE) {
|
||||
settings = ['type="application/x-shockwave-flash"', 'data="' + flash.options.pluginPath + flash.options.filename + '"', 'id="__' + flash.id + '"', 'width="' + flashWidth + '"', 'height="' + flashHeight + '\'"'];
|
||||
} else {
|
||||
settings = ['classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"', 'codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"', 'id="__' + flash.id + '"', 'width="' + flashWidth + '"', 'height="' + flashHeight + '"'];
|
||||
}
|
||||
|
||||
if (!isVideo) {
|
||||
settings.push('style="clip: rect(0 0 0 0); position: absolute;"');
|
||||
|
@ -1733,10 +1762,13 @@ var FlashMediaElementRenderer = {
|
|||
specialIEContainer.outerHTML = '<object ' + settings.join(' ') + '>' + ('<param name="movie" value="' + flash.options.pluginPath + flash.options.filename + '?x=' + new Date() + '" />') + ('<param name="flashvars" value="' + flashVars.join('&') + '" />') + '<param name="quality" value="high" />' + '<param name="bgcolor" value="#000000" />' + '<param name="wmode" value="transparent" />' + ('<param name="allowScriptAccess" value="' + flash.options.shimScriptAccess + '" />') + '<param name="allowFullScreen" value="true" />' + ('<div>' + _i18n2.default.t('mejs.install-flash') + '</div>') + '</object>';
|
||||
} else {
|
||||
|
||||
settings = ['id="__' + flash.id + '"', 'name="__' + flash.id + '"', 'play="true"', 'loop="false"', 'quality="high"', 'bgcolor="#000000"', 'wmode="transparent"', 'allowScriptAccess="' + flash.options.shimScriptAccess + '"', 'allowFullScreen="true"', 'type="application/x-shockwave-flash"', 'pluginspage="//www.macromedia.com/go/getflashplayer"', 'src="' + flash.options.pluginPath + flash.options.filename + '"', 'flashvars="' + flashVars.join('&') + '"', 'width="' + flashWidth + '"', 'height="' + flashHeight + '"'];
|
||||
settings = ['id="__' + flash.id + '"', 'name="__' + flash.id + '"', 'play="true"', 'loop="false"', 'quality="high"', 'bgcolor="#000000"', 'wmode="transparent"', 'allowScriptAccess="' + flash.options.shimScriptAccess + '"', 'allowFullScreen="true"', 'type="application/x-shockwave-flash"', 'pluginspage="//www.macromedia.com/go/getflashplayer"', 'src="' + flash.options.pluginPath + flash.options.filename + '"', 'flashvars="' + flashVars.join('&') + '"'];
|
||||
|
||||
if (!isVideo) {
|
||||
settings.push('style="clip: rect(0 0 0 0); position: absolute;"');
|
||||
if (isVideo) {
|
||||
settings.push('width="' + flashWidth + '"');
|
||||
settings.push('height="' + flashHeight + '"');
|
||||
} else {
|
||||
settings.push('style="position: fixed; left: -9999em; top: -9999em;"');
|
||||
}
|
||||
|
||||
flash.flashWrapper.innerHTML = '<embed ' + settings.join(' ') + '>';
|
||||
|
@ -1745,11 +1777,13 @@ var FlashMediaElementRenderer = {
|
|||
flash.flashNode = flash.flashWrapper.lastChild;
|
||||
|
||||
flash.hide = function () {
|
||||
isActive = false;
|
||||
if (isVideo) {
|
||||
flash.flashNode.style.display = 'none';
|
||||
}
|
||||
};
|
||||
flash.show = function () {
|
||||
isActive = true;
|
||||
if (isVideo) {
|
||||
flash.flashNode.style.display = '';
|
||||
}
|
||||
|
@ -1814,7 +1848,11 @@ if (hasFlash) {
|
|||
|
||||
pseudoStreamingStartQueryParam: 'start',
|
||||
|
||||
pseudoStreamingType: 'byte'
|
||||
pseudoStreamingType: 'byte',
|
||||
|
||||
proxyType: '',
|
||||
|
||||
streamDelimiter: ''
|
||||
},
|
||||
|
||||
canPlayType: function canPlayType(type) {
|
||||
|
@ -1924,7 +1962,7 @@ var NativeFlv = {
|
|||
NativeFlv._createPlayer(settings);
|
||||
});
|
||||
} else {
|
||||
settings.options.path = typeof settings.options.path === 'string' ? settings.options.path : 'https://cdnjs.cloudflare.com/ajax/libs/flv.js/1.3.2/flv.min.js';
|
||||
settings.options.path = typeof settings.options.path === 'string' ? settings.options.path : 'https://cdnjs.cloudflare.com/ajax/libs/flv.js/1.3.3/flv.min.js';
|
||||
|
||||
NativeFlv.promise = NativeFlv.promise || (0, _dom.loadScript)(settings.options.path);
|
||||
NativeFlv.promise.then(function () {
|
||||
|
@ -1949,7 +1987,7 @@ var FlvNativeRenderer = {
|
|||
options: {
|
||||
prefix: 'native_flv',
|
||||
flv: {
|
||||
path: 'https://cdnjs.cloudflare.com/ajax/libs/flv.js/1.3.2/flv.min.js',
|
||||
path: 'https://cdnjs.cloudflare.com/ajax/libs/flv.js/1.3.3/flv.min.js',
|
||||
|
||||
cors: true,
|
||||
debug: false
|
||||
|
@ -2173,7 +2211,7 @@ var NativeHls = {
|
|||
NativeHls._createPlayer(settings);
|
||||
});
|
||||
} else {
|
||||
settings.options.path = typeof settings.options.path === 'string' ? settings.options.path : 'https://cdnjs.cloudflare.com/ajax/libs/hls.js/0.7.11/hls.min.js';
|
||||
settings.options.path = typeof settings.options.path === 'string' ? settings.options.path : 'https://cdnjs.cloudflare.com/ajax/libs/hls.js/0.8.4/hls.min.js';
|
||||
|
||||
NativeHls.promise = NativeHls.promise || (0, _dom.loadScript)(settings.options.path);
|
||||
NativeHls.promise.then(function () {
|
||||
|
@ -2196,7 +2234,7 @@ var HlsNativeRenderer = {
|
|||
options: {
|
||||
prefix: 'native_hls',
|
||||
hls: {
|
||||
path: 'https://cdnjs.cloudflare.com/ajax/libs/hls.js/0.7.11/hls.min.js',
|
||||
path: 'https://cdnjs.cloudflare.com/ajax/libs/hls.js/0.8.4/hls.min.js',
|
||||
|
||||
autoStartLoad: false,
|
||||
debug: false
|
||||
|
@ -2310,15 +2348,19 @@ var HlsNativeRenderer = {
|
|||
break;
|
||||
case 'networkError':
|
||||
if (data.details === 'manifestLoadError') {
|
||||
if (index < total) {
|
||||
if (index < total && mediaFiles[index + 1] !== undefined) {
|
||||
node.setSrc(mediaFiles[index++].src);
|
||||
node.load();
|
||||
node.play();
|
||||
} else {
|
||||
var _message = 'Network error';
|
||||
mediaElement.generateError(_message, mediaFiles);
|
||||
console.error(_message);
|
||||
}
|
||||
} else {
|
||||
var _message = 'Network error';
|
||||
mediaElement.generateError(_message, mediaFiles);
|
||||
console.error(_message);
|
||||
var _message2 = 'Network error';
|
||||
mediaElement.generateError(_message2, mediaFiles);
|
||||
console.error(_message2);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -2466,6 +2508,7 @@ var HtmlMediaElement = {
|
|||
create: function create(mediaElement, options, mediaFiles) {
|
||||
|
||||
var id = mediaElement.id + '_' + options.prefix;
|
||||
var isActive = false;
|
||||
|
||||
var node = null;
|
||||
|
||||
|
@ -2500,8 +2543,10 @@ var HtmlMediaElement = {
|
|||
var events = _mejs2.default.html5media.events.concat(['click', 'mouseover', 'mouseout']),
|
||||
assignEvents = function assignEvents(eventName) {
|
||||
node.addEventListener(eventName, function (e) {
|
||||
var event = (0, _general.createEvent)(e.type, e.target);
|
||||
mediaElement.dispatchEvent(event);
|
||||
if (isActive) {
|
||||
var _event = (0, _general.createEvent)(e.type, e.target);
|
||||
mediaElement.dispatchEvent(_event);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -2516,12 +2561,14 @@ var HtmlMediaElement = {
|
|||
};
|
||||
|
||||
node.hide = function () {
|
||||
isActive = false;
|
||||
node.style.display = 'none';
|
||||
|
||||
return node;
|
||||
};
|
||||
|
||||
node.show = function () {
|
||||
isActive = true;
|
||||
node.style.display = '';
|
||||
|
||||
return node;
|
||||
|
@ -2539,8 +2586,8 @@ var HtmlMediaElement = {
|
|||
}
|
||||
|
||||
node.addEventListener('error', function (e) {
|
||||
if (e.target.error.code === 4) {
|
||||
if (index < total) {
|
||||
if (e.target.error.code === 4 && isActive) {
|
||||
if (index < total && mediaFiles[index + 1] !== undefined) {
|
||||
node.src = mediaFiles[index++].src;
|
||||
node.load();
|
||||
node.play();
|
||||
|
@ -2885,9 +2932,6 @@ var YouTubeIframeRenderer = {
|
|||
showinfo: 0,
|
||||
modestbranding: 0,
|
||||
html5: 1,
|
||||
playsinline: 0,
|
||||
start: 0,
|
||||
end: 0,
|
||||
iv_load_policy: 3
|
||||
}, youtube.options.youtube),
|
||||
origin: _window2.default.location.host,
|
||||
|
@ -2917,7 +2961,7 @@ var YouTubeIframeRenderer = {
|
|||
|
||||
youTubeIframe = youTubeApi.getIframe();
|
||||
|
||||
if (mediaElement.originalNode.getAttribute('muted')) {
|
||||
if (mediaElement.originalNode.muted) {
|
||||
youTubeApi.mute();
|
||||
}
|
||||
|
||||
|
@ -2991,14 +3035,16 @@ var YouTubeIframeRenderer = {
|
|||
}
|
||||
};
|
||||
|
||||
if (isAudio) {
|
||||
if (isAudio || mediaElement.originalNode.hasAttribute('playsinline')) {
|
||||
youtubeSettings.playerVars.playsinline = 1;
|
||||
}
|
||||
|
||||
if (mediaElement.originalNode.controls) {
|
||||
youtubeSettings.playerVars.controls = 1;
|
||||
}
|
||||
if (mediaElement.originalNode.autoplay) {
|
||||
youtubeSettings.playerVars.autoplay = 1;
|
||||
}
|
||||
|
||||
if (mediaElement.originalNode.loop) {
|
||||
youtubeSettings.playerVars.loop = 1;
|
||||
}
|
||||
|
@ -3072,7 +3118,7 @@ _renderer.renderer.add(YouTubeIframeRenderer);
|
|||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.cancelFullScreen = exports.requestFullScreen = exports.isFullScreen = exports.FULLSCREEN_EVENT_NAME = exports.HAS_NATIVE_FULLSCREEN_ENABLED = exports.HAS_TRUE_NATIVE_FULLSCREEN = exports.HAS_IOS_FULLSCREEN = exports.HAS_MS_NATIVE_FULLSCREEN = exports.HAS_MOZ_NATIVE_FULLSCREEN = exports.HAS_WEBKIT_NATIVE_FULLSCREEN = exports.HAS_NATIVE_FULLSCREEN = exports.SUPPORTS_NATIVE_HLS = exports.SUPPORT_POINTER_EVENTS = exports.HAS_MSE = exports.IS_STOCK_ANDROID = exports.IS_SAFARI = exports.IS_FIREFOX = exports.IS_CHROME = exports.IS_EDGE = exports.IS_IE = exports.IS_ANDROID = exports.IS_IOS = exports.IS_IPOD = exports.IS_IPHONE = exports.IS_IPAD = exports.UA = exports.NAV = undefined;
|
||||
exports.cancelFullScreen = exports.requestFullScreen = exports.isFullScreen = exports.FULLSCREEN_EVENT_NAME = exports.HAS_NATIVE_FULLSCREEN_ENABLED = exports.HAS_TRUE_NATIVE_FULLSCREEN = exports.HAS_IOS_FULLSCREEN = exports.HAS_MS_NATIVE_FULLSCREEN = exports.HAS_MOZ_NATIVE_FULLSCREEN = exports.HAS_WEBKIT_NATIVE_FULLSCREEN = exports.HAS_NATIVE_FULLSCREEN = exports.SUPPORTS_NATIVE_HLS = exports.SUPPORT_PASSIVE_EVENT = exports.SUPPORT_POINTER_EVENTS = exports.HAS_MSE = exports.IS_STOCK_ANDROID = exports.IS_SAFARI = exports.IS_FIREFOX = exports.IS_CHROME = exports.IS_EDGE = exports.IS_IE = exports.IS_ANDROID = exports.IS_IOS = exports.IS_IPOD = exports.IS_IPHONE = exports.IS_IPAD = exports.UA = exports.NAV = undefined;
|
||||
|
||||
var _window = _dereq_(3);
|
||||
|
||||
|
@ -3119,6 +3165,20 @@ var SUPPORT_POINTER_EVENTS = exports.SUPPORT_POINTER_EVENTS = function () {
|
|||
return !!supports;
|
||||
}();
|
||||
|
||||
var SUPPORT_PASSIVE_EVENT = exports.SUPPORT_PASSIVE_EVENT = function () {
|
||||
var supportsPassive = false;
|
||||
try {
|
||||
var opts = Object.defineProperty({}, 'passive', {
|
||||
get: function get() {
|
||||
supportsPassive = true;
|
||||
}
|
||||
});
|
||||
_window2.default.addEventListener('test', null, opts);
|
||||
} catch (e) {}
|
||||
|
||||
return supportsPassive;
|
||||
}();
|
||||
|
||||
var html5Elements = ['source', 'track', 'audio', 'video'];
|
||||
var video = void 0;
|
||||
|
||||
|
@ -3225,6 +3285,7 @@ _mejs2.default.Features.isStockAndroid = IS_STOCK_ANDROID;
|
|||
_mejs2.default.Features.hasMSE = HAS_MSE;
|
||||
_mejs2.default.Features.supportsNativeHLS = SUPPORTS_NATIVE_HLS;
|
||||
_mejs2.default.Features.supportsPointerEvents = SUPPORT_POINTER_EVENTS;
|
||||
_mejs2.default.Features.supportsPassiveEvent = SUPPORT_PASSIVE_EVENT;
|
||||
_mejs2.default.Features.hasiOSFullScreen = HAS_IOS_FULLSCREEN;
|
||||
_mejs2.default.Features.hasNativeFullscreen = HAS_NATIVE_FULLSCREEN;
|
||||
_mejs2.default.Features.hasWebkitNativeFullScreen = HAS_WEBKIT_NATIVE_FULLSCREEN;
|
||||
|
@ -3387,7 +3448,10 @@ function siblings(el, filter) {
|
|||
}
|
||||
|
||||
function visible(elem) {
|
||||
return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
|
||||
if (elem.getClientRects !== undefined && elem.getClientRects === 'function') {
|
||||
return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
|
||||
}
|
||||
return !!(elem.offsetWidth || elem.offsetHeight);
|
||||
}
|
||||
|
||||
function ajax(url, dataType, success, error) {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -109,7 +109,8 @@ var DailyMotionIframeRenderer = {
|
|||
|
||||
var events = void 0,
|
||||
dmPlayer = null,
|
||||
dmIframe = null;
|
||||
dmIframe = null,
|
||||
muted = mediaElement.originalNode.muted;
|
||||
|
||||
dm.options = options;
|
||||
dm.id = mediaElement.id + '_' + options.prefix;
|
||||
|
@ -136,7 +137,8 @@ var DailyMotionIframeRenderer = {
|
|||
case 'ended':
|
||||
return dmPlayer.ended;
|
||||
case 'muted':
|
||||
return dmPlayer.muted;
|
||||
muted = dmPlayer.muted;
|
||||
return muted;
|
||||
case 'buffered':
|
||||
var percentLoaded = dmPlayer.bufferedTime,
|
||||
duration = dmPlayer.duration;
|
||||
|
@ -172,7 +174,11 @@ var DailyMotionIframeRenderer = {
|
|||
dmPlayer.seek(value);
|
||||
break;
|
||||
case 'muted':
|
||||
if (value === true) {
|
||||
dmPlayer.setVolume(0);
|
||||
}
|
||||
dmPlayer.setMuted(value);
|
||||
muted = value;
|
||||
setTimeout(function () {
|
||||
var event = mejs.Utils.createEvent('volumechange', dm);
|
||||
mediaElement.dispatchEvent(event);
|
||||
|
@ -180,6 +186,14 @@ var DailyMotionIframeRenderer = {
|
|||
break;
|
||||
case 'volume':
|
||||
dmPlayer.setVolume(value);
|
||||
if (value === 0 && !dmPlayer.muted) {
|
||||
dmPlayer.setMuted(true);
|
||||
muted = true;
|
||||
} else if (value > 0 && dmPlayer.muted) {
|
||||
dmPlayer.setMuted(false);
|
||||
muted = false;
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
var event = mejs.Utils.createEvent('volumechange', dm);
|
||||
mediaElement.dispatchEvent(event);
|
||||
|
@ -258,8 +272,11 @@ var DailyMotionIframeRenderer = {
|
|||
}
|
||||
|
||||
if (mediaElement.originalNode.muted) {
|
||||
dmPlayer.setMuted(true);
|
||||
dmPlayer.setVolume(0);
|
||||
dmPlayer.setMuted(true);
|
||||
} else {
|
||||
dmPlayer.setVolume(dmPlayer.volume);
|
||||
dmPlayer.setMuted(false);
|
||||
}
|
||||
|
||||
events = mejs.html5media.events;
|
||||
|
@ -267,7 +284,7 @@ var DailyMotionIframeRenderer = {
|
|||
var assignNativeEvents = function assignNativeEvents(eventName) {
|
||||
if (eventName !== 'ended') {
|
||||
dmPlayer.addEventListener(eventName, function (e) {
|
||||
var event = mejs.Utils.createEvent(e.type, dmPlayer);
|
||||
var event = mejs.Utils.createEvent(e.type, dm);
|
||||
mediaElement.dispatchEvent(event);
|
||||
});
|
||||
}
|
||||
|
@ -278,42 +295,42 @@ var DailyMotionIframeRenderer = {
|
|||
}
|
||||
|
||||
dmPlayer.addEventListener('ad_start', function () {
|
||||
var event = mejs.Utils.createEvent('play', dmPlayer);
|
||||
var event = mejs.Utils.createEvent('play', dm);
|
||||
mediaElement.dispatchEvent(event);
|
||||
|
||||
event = mejs.Utils.createEvent('progress', dmPlayer);
|
||||
event = mejs.Utils.createEvent('progress', dm);
|
||||
mediaElement.dispatchEvent(event);
|
||||
|
||||
event = mejs.Utils.createEvent('timeupdate', dmPlayer);
|
||||
event = mejs.Utils.createEvent('timeupdate', dm);
|
||||
mediaElement.dispatchEvent(event);
|
||||
});
|
||||
dmPlayer.addEventListener('ad_timeupdate', function () {
|
||||
var event = mejs.Utils.createEvent('timeupdate', dmPlayer);
|
||||
var event = mejs.Utils.createEvent('timeupdate', dm);
|
||||
mediaElement.dispatchEvent(event);
|
||||
});
|
||||
dmPlayer.addEventListener('ad_pause', function () {
|
||||
var event = mejs.Utils.createEvent('pause', dmPlayer);
|
||||
mediaElement.dispatchEvent(event);
|
||||
});
|
||||
dmPlayer.addEventListener('ad_end', function () {
|
||||
var event = mejs.Utils.createEvent('ended', dmPlayer);
|
||||
var event = mejs.Utils.createEvent('pause', dm);
|
||||
mediaElement.dispatchEvent(event);
|
||||
});
|
||||
dmPlayer.addEventListener('start', function () {
|
||||
if (mediaElement.originalNode.muted) {
|
||||
dmPlayer.setMuted(true);
|
||||
if (dmPlayer.muted) {
|
||||
var event = mejs.Utils.createEvent('volumechange', dm);
|
||||
mediaElement.dispatchEvent(event);
|
||||
}
|
||||
});
|
||||
dmPlayer.addEventListener('video_start', function () {
|
||||
var event = mejs.Utils.createEvent('play', dmPlayer);
|
||||
var event = mejs.Utils.createEvent('play', dm);
|
||||
mediaElement.dispatchEvent(event);
|
||||
|
||||
var playingEvent = mejs.Utils.createEvent('playing', dm);
|
||||
mediaElement.dispatchEvent(playingEvent);
|
||||
});
|
||||
dmPlayer.addEventListener('ad_timeupdate', function () {
|
||||
var event = mejs.Utils.createEvent('timeupdate', dmPlayer);
|
||||
var event = mejs.Utils.createEvent('timeupdate', dm);
|
||||
mediaElement.dispatchEvent(event);
|
||||
});
|
||||
dmPlayer.addEventListener('video_end', function () {
|
||||
var event = mejs.Utils.createEvent('ended', dmPlayer);
|
||||
var event = mejs.Utils.createEvent('ended', dm);
|
||||
mediaElement.dispatchEvent(event);
|
||||
|
||||
if (mediaElement.originalNode.getAttribute('loop')) {
|
||||
|
@ -339,11 +356,15 @@ var DailyMotionIframeRenderer = {
|
|||
mediaElement.originalNode.style.display = 'none';
|
||||
|
||||
var videoId = DailyMotionApi.getDailyMotionId(mediaFiles[0].src),
|
||||
dmSettings = Object.assign({
|
||||
dmSettings = {
|
||||
id: dm.id,
|
||||
container: dmContainer,
|
||||
videoId: videoId
|
||||
}, dm.options.dailymotion);
|
||||
};
|
||||
|
||||
dmSettings.params = Object.assign({}, dm.options.dailymotion);
|
||||
|
||||
dmSettings.params.controls = !!mediaElement.originalNode.controls;
|
||||
|
||||
if (mediaElement.originalNode.autoplay) {
|
||||
dmSettings.params.autoplay = true;
|
||||
|
@ -351,6 +372,7 @@ var DailyMotionIframeRenderer = {
|
|||
if (mediaElement.originalNode.muted) {
|
||||
dmSettings.params.mute = true;
|
||||
}
|
||||
dmSettings.params.api = '1';
|
||||
|
||||
DailyMotionApi.enqueueIframe(dmSettings);
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -11,6 +11,30 @@
|
|||
*/(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
|
||||
'use strict';
|
||||
|
||||
var FacebookApi = {
|
||||
|
||||
promise: null,
|
||||
|
||||
load: function load(settings) {
|
||||
|
||||
if (typeof FB !== 'undefined') {
|
||||
FacebookApi._createPlayer(settings);
|
||||
} else {
|
||||
FacebookApi.promise = FacebookApi.promise || mejs.Utils.loadScript('https://connect.facebook.net/' + settings.options.lang + '/sdk.js');
|
||||
FacebookApi.promise.then(function () {
|
||||
FB.init(settings.options);
|
||||
|
||||
setTimeout(function () {
|
||||
FacebookApi._createPlayer(settings);
|
||||
}, 50);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_createPlayer: function _createPlayer(settings) {
|
||||
window['__ready__' + settings.id]();
|
||||
}
|
||||
};
|
||||
var FacebookRenderer = {
|
||||
name: 'facebook',
|
||||
options: {
|
||||
|
@ -18,7 +42,8 @@ var FacebookRenderer = {
|
|||
facebook: {
|
||||
appId: '',
|
||||
xfbml: true,
|
||||
version: 'v2.10'
|
||||
version: 'v2.10',
|
||||
lang: 'en_US'
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -27,54 +52,50 @@ var FacebookRenderer = {
|
|||
},
|
||||
|
||||
create: function create(mediaElement, options, mediaFiles) {
|
||||
var apiStack = [],
|
||||
fb = {},
|
||||
readyState = 4;
|
||||
|
||||
var fbWrapper = {},
|
||||
apiStack = [],
|
||||
eventHandler = {},
|
||||
readyState = 4,
|
||||
autoplay = mediaElement.originalNode.autoplay;
|
||||
|
||||
var poster = '',
|
||||
src = '',
|
||||
var hasStartedPlaying = false,
|
||||
paused = true,
|
||||
ended = false,
|
||||
hasStartedPlaying = false,
|
||||
fbApi = null,
|
||||
fbDiv = null;
|
||||
fbPlayer = null,
|
||||
src = '',
|
||||
poster = '',
|
||||
autoplay = mediaElement.originalNode.autoplay;
|
||||
|
||||
fb.options = options;
|
||||
fb.id = mediaElement.id + '_' + options.prefix;
|
||||
fb.mediaElement = mediaElement;
|
||||
|
||||
if (mejs.Features.isiPhone && mediaElement.originalNode.getAttribute('poster')) {
|
||||
poster = mediaElement.originalNode.getAttribute('poster');
|
||||
mediaElement.originalNode.removeAttribute('poster');
|
||||
}
|
||||
|
||||
options = Object.assign(options, mediaElement.options);
|
||||
fbWrapper.options = options;
|
||||
fbWrapper.id = mediaElement.id + '_' + options.prefix;
|
||||
fbWrapper.mediaElement = mediaElement;
|
||||
|
||||
var props = mejs.html5media.properties,
|
||||
assignGettersSetters = function assignGettersSetters(propName) {
|
||||
|
||||
var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1);
|
||||
|
||||
fbWrapper['get' + capName] = function () {
|
||||
fb['get' + capName] = function () {
|
||||
|
||||
if (fbApi !== null) {
|
||||
if (fbPlayer !== null) {
|
||||
var value = null;
|
||||
|
||||
switch (propName) {
|
||||
case 'currentTime':
|
||||
return fbApi.getCurrentPosition();
|
||||
return fbPlayer.getCurrentPosition();
|
||||
case 'duration':
|
||||
return fbApi.getDuration();
|
||||
return fbPlayer.getDuration();
|
||||
case 'volume':
|
||||
return fbApi.getVolume();
|
||||
return fbPlayer.getVolume();
|
||||
case 'paused':
|
||||
return paused;
|
||||
case 'ended':
|
||||
return ended;
|
||||
case 'muted':
|
||||
return fbApi.isMuted();
|
||||
return fbPlayer.isMuted();
|
||||
case 'buffered':
|
||||
return {
|
||||
start: function start() {
|
||||
|
@ -97,47 +118,60 @@ var FacebookRenderer = {
|
|||
}
|
||||
};
|
||||
|
||||
fbWrapper['set' + capName] = function (value) {
|
||||
fb['set' + capName] = function (value) {
|
||||
|
||||
if (fbApi !== null) {
|
||||
if (fbPlayer !== null) {
|
||||
|
||||
switch (propName) {
|
||||
case 'src':
|
||||
var url = typeof value === 'string' ? value : value[0].src;
|
||||
src = url;
|
||||
|
||||
fbDiv.remove();
|
||||
createFacebookEmbed(url, options.facebook);
|
||||
fbContainer.remove();
|
||||
fbContainer = document.createElement('div');
|
||||
fbContainer.id = fb.id;
|
||||
fbContainer.className = 'fb-video';
|
||||
fbContainer.setAttribute('data-href', url);
|
||||
fbContainer.setAttribute('data-allowfullscreen', 'true');
|
||||
fbContainer.setAttribute('data-controls', 'false');
|
||||
|
||||
mediaElement.originalNode.parentNode.insertBefore(fbContainer, mediaElement.originalNode);
|
||||
mediaElement.originalNode.style.display = 'none';
|
||||
|
||||
FacebookApi.load({
|
||||
lang: fb.options.lang,
|
||||
id: fb.id
|
||||
});
|
||||
|
||||
FB.XFBML.parse();
|
||||
|
||||
if (autoplay) {
|
||||
fbApi.play();
|
||||
fbPlayer.play();
|
||||
}
|
||||
|
||||
break;
|
||||
case 'currentTime':
|
||||
fbApi.seek(value);
|
||||
fbPlayer.seek(value);
|
||||
break;
|
||||
case 'muted':
|
||||
if (value) {
|
||||
fbApi.mute();
|
||||
fbPlayer.mute();
|
||||
} else {
|
||||
fbApi.unmute();
|
||||
fbPlayer.unmute();
|
||||
}
|
||||
setTimeout(function () {
|
||||
var event = mejs.Utils.createEvent('volumechange', fbWrapper);
|
||||
var event = mejs.Utils.createEvent('volumechange', fb);
|
||||
mediaElement.dispatchEvent(event);
|
||||
}, 50);
|
||||
break;
|
||||
case 'volume':
|
||||
fbApi.setVolume(value);
|
||||
fbPlayer.setVolume(value);
|
||||
setTimeout(function () {
|
||||
var event = mejs.Utils.createEvent('volumechange', fbWrapper);
|
||||
var event = mejs.Utils.createEvent('volumechange', fb);
|
||||
mediaElement.dispatchEvent(event);
|
||||
}, 50);
|
||||
break;
|
||||
case 'readyState':
|
||||
var event = mejs.Utils.createEvent('canplay', fbWrapper);
|
||||
var event = mejs.Utils.createEvent('canplay', fb);
|
||||
mediaElement.dispatchEvent(event);
|
||||
break;
|
||||
default:
|
||||
|
@ -156,13 +190,13 @@ var FacebookRenderer = {
|
|||
|
||||
var methods = mejs.html5media.methods,
|
||||
assignMethods = function assignMethods(methodName) {
|
||||
fbWrapper[methodName] = function () {
|
||||
if (fbApi !== null) {
|
||||
fb[methodName] = function () {
|
||||
if (fbPlayer !== null) {
|
||||
switch (methodName) {
|
||||
case 'play':
|
||||
return fbApi.play();
|
||||
return fbPlayer.play();
|
||||
case 'pause':
|
||||
return fbApi.pause();
|
||||
return fbPlayer.pause();
|
||||
case 'load':
|
||||
return null;
|
||||
}
|
||||
|
@ -176,165 +210,145 @@ var FacebookRenderer = {
|
|||
assignMethods(methods[_i]);
|
||||
}
|
||||
|
||||
function sendEvents(events) {
|
||||
function assignEvents(events) {
|
||||
for (var _i2 = 0, _total2 = events.length; _i2 < _total2; _i2++) {
|
||||
var event = mejs.Utils.createEvent(events[_i2], fbWrapper);
|
||||
var event = mejs.Utils.createEvent(events[_i2], fb);
|
||||
mediaElement.dispatchEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
function createFacebookEmbed(url, config) {
|
||||
src = url;
|
||||
window['__ready__' + fb.id] = function () {
|
||||
FB.Event.subscribe('xfbml.ready', function (msg) {
|
||||
if (msg.type === 'video' && fb.id === msg.id) {
|
||||
mediaElement.fbPlayer = fbPlayer = msg.instance;
|
||||
|
||||
fbDiv = document.createElement('div');
|
||||
fbDiv.id = fbWrapper.id;
|
||||
fbDiv.className = "fb-video";
|
||||
fbDiv.setAttribute("data-href", url);
|
||||
fbDiv.setAttribute("data-allowfullscreen", "true");
|
||||
fbDiv.setAttribute("data-controls", "false");
|
||||
var fbIframe = document.getElementById(fb.id),
|
||||
width = fbIframe.offsetWidth,
|
||||
height = fbIframe.offsetHeight,
|
||||
events = ['mouseover', 'mouseout'],
|
||||
assignIframeEvents = function assignIframeEvents(e) {
|
||||
var event = mejs.Utils.createEvent(e.type, fb);
|
||||
mediaElement.dispatchEvent(event);
|
||||
};
|
||||
|
||||
mediaElement.originalNode.parentNode.insertBefore(fbDiv, mediaElement.originalNode);
|
||||
mediaElement.originalNode.style.display = 'none';
|
||||
|
||||
window.fbAsyncInit = function () {
|
||||
|
||||
FB.init(config);
|
||||
|
||||
FB.Event.subscribe('xfbml.ready', function (msg) {
|
||||
|
||||
if (msg.type === 'video') {
|
||||
|
||||
fbApi = msg.instance;
|
||||
|
||||
var fbIframe = fbDiv.getElementsByTagName('iframe')[0],
|
||||
width = fbIframe.offsetWidth,
|
||||
height = fbIframe.offsetHeight,
|
||||
events = ['mouseover', 'mouseout'],
|
||||
assignEvents = function assignEvents(e) {
|
||||
var event = mejs.Utils.createEvent(e.type, fbWrapper);
|
||||
mediaElement.dispatchEvent(event);
|
||||
};
|
||||
|
||||
fbWrapper.setSize(width, height);
|
||||
|
||||
if (autoplay) {
|
||||
fbApi.play();
|
||||
}
|
||||
|
||||
for (var _i3 = 0, _total3 = events.length; _i3 < _total3; _i3++) {
|
||||
fbIframe.addEventListener(events[_i3], assignEvents, false);
|
||||
}
|
||||
|
||||
var fbEvents = ['startedPlaying', 'paused', 'finishedPlaying', 'startedBuffering', 'finishedBuffering'];
|
||||
for (var _i4 = 0, _total4 = fbEvents.length; _i4 < _total4; _i4++) {
|
||||
var event = fbEvents[_i4],
|
||||
handler = eventHandler[event];
|
||||
if (handler !== undefined && handler !== null && !mejs.Utils.isObjectEmpty(handler) && typeof handler.removeListener === 'function') {
|
||||
handler.removeListener(event);
|
||||
}
|
||||
}
|
||||
|
||||
if (apiStack.length) {
|
||||
for (var _i5 = 0, _total5 = apiStack.length; _i5 < _total5; _i5++) {
|
||||
|
||||
var stackItem = apiStack[_i5];
|
||||
|
||||
if (stackItem.type === 'set') {
|
||||
var propName = stackItem.propName,
|
||||
capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1);
|
||||
|
||||
fbWrapper['set' + capName](stackItem.value);
|
||||
} else if (stackItem.type === 'call') {
|
||||
fbWrapper[stackItem.methodName]();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sendEvents(['rendererready', 'loadeddata', 'canplay', 'progress', 'loadedmetadata', 'timeupdate']);
|
||||
|
||||
var timer = void 0;
|
||||
|
||||
eventHandler.startedPlaying = fbApi.subscribe('startedPlaying', function () {
|
||||
if (!hasStartedPlaying) {
|
||||
hasStartedPlaying = true;
|
||||
}
|
||||
paused = false;
|
||||
ended = false;
|
||||
sendEvents(['play', 'playing', 'timeupdate']);
|
||||
|
||||
timer = setInterval(function () {
|
||||
fbApi.getCurrentPosition();
|
||||
sendEvents(['timeupdate']);
|
||||
}, 250);
|
||||
});
|
||||
eventHandler.paused = fbApi.subscribe('paused', function () {
|
||||
paused = true;
|
||||
ended = false;
|
||||
sendEvents(['pause']);
|
||||
});
|
||||
eventHandler.finishedPlaying = fbApi.subscribe('finishedPlaying', function () {
|
||||
paused = true;
|
||||
ended = true;
|
||||
|
||||
sendEvents(['ended']);
|
||||
clearInterval(timer);
|
||||
timer = null;
|
||||
});
|
||||
eventHandler.startedBuffering = fbApi.subscribe('startedBuffering', function () {
|
||||
sendEvents(['progress', 'timeupdate']);
|
||||
});
|
||||
eventHandler.finishedBuffering = fbApi.subscribe('finishedBuffering', function () {
|
||||
sendEvents(['progress', 'timeupdate']);
|
||||
});
|
||||
fb.setSize(width, height);
|
||||
if (!mediaElement.originalNode.muted) {
|
||||
fbPlayer.unmute();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
mejs.Utils.loadScript('https://connect.facebook.net/en_US/sdk.js');
|
||||
}
|
||||
if (autoplay) {
|
||||
fbPlayer.play();
|
||||
}
|
||||
|
||||
if (mediaFiles.length > 0) {
|
||||
createFacebookEmbed(mediaFiles[0].src, fbWrapper.options.facebook);
|
||||
}
|
||||
for (var _i3 = 0, _total3 = events.length; _i3 < _total3; _i3++) {
|
||||
fbIframe.addEventListener(events[_i3], assignIframeEvents);
|
||||
}
|
||||
|
||||
fbWrapper.hide = function () {
|
||||
fbWrapper.stopInterval();
|
||||
fbWrapper.pause();
|
||||
if (fbDiv) {
|
||||
fbDiv.style.display = 'none';
|
||||
fb.eventHandler = {};
|
||||
|
||||
var fbEvents = ['startedPlaying', 'paused', 'finishedPlaying', 'startedBuffering', 'finishedBuffering'];
|
||||
for (var _i4 = 0, _total4 = fbEvents.length; _i4 < _total4; _i4++) {
|
||||
var event = fbEvents[_i4],
|
||||
handler = fb.eventHandler[event];
|
||||
if (handler !== undefined && handler !== null && !mejs.Utils.isObjectEmpty(handler) && typeof handler.removeListener === 'function') {
|
||||
handler.removeListener(event);
|
||||
}
|
||||
}
|
||||
|
||||
if (apiStack.length) {
|
||||
for (var _i5 = 0, _total5 = apiStack.length; _i5 < _total5; _i5++) {
|
||||
var stackItem = apiStack[_i5];
|
||||
|
||||
if (stackItem.type === 'set') {
|
||||
var propName = stackItem.propName,
|
||||
capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1);
|
||||
|
||||
fb['set' + capName](stackItem.value);
|
||||
} else if (stackItem.type === 'call') {
|
||||
fb[stackItem.methodName]();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assignEvents(['rendererready', 'loadeddata', 'canplay', 'progress', 'loadedmetadata', 'timeupdate']);
|
||||
|
||||
var timer = void 0;
|
||||
|
||||
fb.eventHandler.startedPlaying = fbPlayer.subscribe('startedPlaying', function () {
|
||||
if (!hasStartedPlaying) {
|
||||
hasStartedPlaying = true;
|
||||
}
|
||||
paused = false;
|
||||
ended = false;
|
||||
assignEvents(['play', 'playing', 'timeupdate']);
|
||||
|
||||
timer = setInterval(function () {
|
||||
fbPlayer.getCurrentPosition();
|
||||
assignEvents(['timeupdate']);
|
||||
}, 250);
|
||||
});
|
||||
fb.eventHandler.paused = fbPlayer.subscribe('paused', function () {
|
||||
paused = true;
|
||||
ended = false;
|
||||
assignEvents(['pause']);
|
||||
});
|
||||
fb.eventHandler.finishedPlaying = fbPlayer.subscribe('finishedPlaying', function () {
|
||||
paused = true;
|
||||
ended = true;
|
||||
|
||||
assignEvents(['ended']);
|
||||
clearInterval(timer);
|
||||
timer = null;
|
||||
});
|
||||
fb.eventHandler.startedBuffering = fbPlayer.subscribe('startedBuffering', function () {
|
||||
assignEvents(['progress', 'timeupdate']);
|
||||
});
|
||||
fb.eventHandler.finishedBuffering = fbPlayer.subscribe('finishedBuffering', function () {
|
||||
assignEvents(['progress', 'timeupdate']);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
src = mediaFiles[0].src;
|
||||
var fbContainer = document.createElement('div');
|
||||
fbContainer.id = fb.id;
|
||||
fbContainer.className = 'fb-video';
|
||||
fbContainer.setAttribute('data-href', src);
|
||||
fbContainer.setAttribute('data-allowfullscreen', true);
|
||||
fbContainer.setAttribute('data-controls', !!mediaElement.originalNode.controls);
|
||||
mediaElement.originalNode.parentNode.insertBefore(fbContainer, mediaElement.originalNode);
|
||||
mediaElement.originalNode.style.display = 'none';
|
||||
|
||||
FacebookApi.load({
|
||||
options: fb.options.facebook,
|
||||
id: fb.id
|
||||
});
|
||||
|
||||
fb.hide = function () {
|
||||
fb.pause();
|
||||
if (fbPlayer) {
|
||||
fbContainer.style.display = 'none';
|
||||
}
|
||||
};
|
||||
fbWrapper.show = function () {
|
||||
if (fbDiv) {
|
||||
fbDiv.style.display = '';
|
||||
fb.setSize = function (width) {
|
||||
if (fbPlayer !== null && !isNaN(width)) {
|
||||
fbContainer.style.width = width;
|
||||
}
|
||||
};
|
||||
fbWrapper.setSize = function (width) {
|
||||
if (fbApi !== null && !isNaN(width)) {
|
||||
fbDiv.style.width = width;
|
||||
fb.show = function () {
|
||||
if (fbPlayer) {
|
||||
fbContainer.style.display = '';
|
||||
}
|
||||
};
|
||||
fbWrapper.destroy = function () {
|
||||
|
||||
fb.destroy = function () {
|
||||
if (poster) {
|
||||
mediaElement.originalNode.setAttribute('poster', poster);
|
||||
}
|
||||
};
|
||||
|
||||
fbWrapper.interval = null;
|
||||
|
||||
fbWrapper.startInterval = function () {
|
||||
fbWrapper.interval = setInterval(function () {
|
||||
var event = mejs.Utils.createEvent('timeupdate', fbWrapper);
|
||||
mediaElement.dispatchEvent(event);
|
||||
}, 250);
|
||||
};
|
||||
fbWrapper.stopInterval = function () {
|
||||
if (fbWrapper.interval) {
|
||||
clearInterval(fbWrapper.interval);
|
||||
}
|
||||
};
|
||||
|
||||
return fbWrapper;
|
||||
return fb;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -62,10 +62,10 @@ var TwitchApi = {
|
|||
|
||||
for (var i = 0, total = parameters.length; i < total; i++) {
|
||||
var paramParts = parameters[i].split('=');
|
||||
if (~paramParts[0].indexOf('channel=')) {
|
||||
if (~paramParts[0].indexOf('channel')) {
|
||||
twitchId = paramParts[1];
|
||||
break;
|
||||
} else if (~paramParts[0].indexOf('video=')) {
|
||||
} else if (~paramParts[0].indexOf('video')) {
|
||||
twitchId = 'v' + paramParts[1];
|
||||
break;
|
||||
}
|
||||
|
@ -82,12 +82,12 @@ var TwitchApi = {
|
|||
var parts = url.split('?');
|
||||
url = parts[0];
|
||||
var id = url.substring(url.lastIndexOf('/') + 1);
|
||||
return (/^\d+$/i.test(id) !== null ? 'v' + id : id
|
||||
return (/^\d+$/i.test(id) ? 'v' + id : id
|
||||
);
|
||||
},
|
||||
|
||||
getTwitchType: function getTwitchType(id) {
|
||||
return (/^v\d+/i.test(id) !== null ? 'video' : 'channel'
|
||||
return (/^v\d+/i.test(id) ? 'video' : 'channel'
|
||||
);
|
||||
}
|
||||
};
|
||||
|
@ -276,7 +276,7 @@ var TwitchIframeRenderer = {
|
|||
|
||||
var events = ['mouseover', 'mouseout'],
|
||||
assignEvents = function assignEvents(e) {
|
||||
var event = createEvent(e.type, twitch);
|
||||
var event = mejs.Utils.createEvent(e.type, twitch);
|
||||
mediaElement.dispatchEvent(event);
|
||||
};
|
||||
|
||||
|
@ -286,12 +286,12 @@ var TwitchIframeRenderer = {
|
|||
|
||||
var timer = void 0;
|
||||
|
||||
twitchPlayer.addEventListener('ready', function () {
|
||||
twitchPlayer.addEventListener(Twitch.Player.READY, function () {
|
||||
paused = false;
|
||||
ended = false;
|
||||
sendEvents(['rendererready', 'loadedmetadata', 'loadeddata', 'canplay']);
|
||||
});
|
||||
twitchPlayer.addEventListener('play', function () {
|
||||
twitchPlayer.addEventListener(Twitch.Player.PLAY, function () {
|
||||
if (!hasStartedPlaying) {
|
||||
hasStartedPlaying = true;
|
||||
}
|
||||
|
@ -304,14 +304,14 @@ var TwitchIframeRenderer = {
|
|||
sendEvents(['timeupdate']);
|
||||
}, 250);
|
||||
});
|
||||
twitchPlayer.addEventListener('pause', function () {
|
||||
twitchPlayer.addEventListener(Twitch.Player.PAUSE, function () {
|
||||
paused = true;
|
||||
ended = false;
|
||||
if (!twitchPlayer.getEnded()) {
|
||||
sendEvents(['pause']);
|
||||
}
|
||||
});
|
||||
twitchPlayer.addEventListener('ended', function () {
|
||||
twitchPlayer.addEventListener(Twitch.Player.ENDED, function () {
|
||||
paused = true;
|
||||
ended = true;
|
||||
sendEvents(['ended']);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -39,7 +39,7 @@ var VimeoApi = {
|
|||
|
||||
var parts = url.split('?');
|
||||
url = parts[0];
|
||||
return parseInt(url.substring(url.lastIndexOf('/') + 1));
|
||||
return parseInt(url.substring(url.lastIndexOf('/') + 1), 10);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -256,6 +256,11 @@ var vimeoIframeRenderer = {
|
|||
}
|
||||
}
|
||||
|
||||
if (mediaElement.originalNode.muted) {
|
||||
vimeoPlayer.setVolume(0);
|
||||
volume = 0;
|
||||
}
|
||||
|
||||
var vimeoIframe = document.getElementById(vimeo.id);
|
||||
var events = void 0;
|
||||
|
||||
|
@ -295,6 +300,9 @@ var vimeoIframeRenderer = {
|
|||
if (mediaElement.originalNode.autoplay) {
|
||||
var initEvent = mejs.Utils.createEvent('play', vimeo);
|
||||
mediaElement.dispatchEvent(initEvent);
|
||||
|
||||
var playingEvent = mejs.Utils.createEvent('playing', vimeo);
|
||||
mediaElement.dispatchEvent(playingEvent);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -319,6 +327,9 @@ var vimeoIframeRenderer = {
|
|||
ended = false;
|
||||
var event = mejs.Utils.createEvent('play', vimeo);
|
||||
mediaElement.dispatchEvent(event);
|
||||
|
||||
var playingEvent = mejs.Utils.createEvent('playing', vimeo);
|
||||
mediaElement.dispatchEvent(playingEvent);
|
||||
});
|
||||
vimeoPlayer.on('pause', function () {
|
||||
paused = true;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -21,7 +21,7 @@
|
|||
settings = $.extend( true, {}, _wpmejsSettings );
|
||||
}
|
||||
settings.classPrefix = 'mejs-';
|
||||
settings.success = settings.success || function (mejs) {
|
||||
settings.success = settings.success || function ( mejs ) {
|
||||
var autoplay, loop;
|
||||
|
||||
if ( mejs.rendererName && -1 !== mejs.rendererName.indexOf( 'flash' ) ) {
|
||||
|
|
|
@ -352,7 +352,9 @@ function wp_default_scripts( &$scripts ) {
|
|||
|
||||
$scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array('jquery'), false, 1 );
|
||||
|
||||
$scripts->add( 'mediaelement', "/wp-includes/js/mediaelement/mediaelement-and-player.min.js", array('jquery'), '4.2.5-74e01a40', 1 );
|
||||
$scripts->add( 'mediaelement', false, array( 'jquery', 'mediaelement-core', 'mediaelement-migrate' ), '4.2.6-78496d1' );
|
||||
$scripts->add( 'mediaelement-core', "/wp-includes/js/mediaelement/mediaelement-and-player.min.js", array(), '4.2.6-78496d1', 1 );
|
||||
$scripts->add( 'mediaelement-migrate', "/wp-includes/js/mediaelement/mediaelement-migrate$suffix.js", array(), false, 1);
|
||||
did_action( 'init' ) && $scripts->localize( 'mediaelement', 'mejsL10n', array(
|
||||
'language' => get_bloginfo( 'language' ),
|
||||
'strings' => array(
|
||||
|
@ -444,7 +446,7 @@ function wp_default_scripts( &$scripts ) {
|
|||
) );
|
||||
|
||||
|
||||
$scripts->add( 'mediaelement-vimeo', "/wp-includes/js/mediaelement/renderers/vimeo.min.js", array('mediaelement'), '4.2.5-74e01a40', 1 );
|
||||
$scripts->add( 'mediaelement-vimeo', "/wp-includes/js/mediaelement/renderers/vimeo.min.js", array('mediaelement'), '4.2.6-78496d1', 1 );
|
||||
$scripts->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement$suffix.js", array('mediaelement'), false, 1 );
|
||||
$mejs_settings = array(
|
||||
'pluginPath' => includes_url( 'js/mediaelement/', 'relative' ),
|
||||
|
@ -989,7 +991,7 @@ function wp_default_styles( &$styles ) {
|
|||
// External libraries and friends
|
||||
$styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.8' );
|
||||
$styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array( 'dashicons' ) );
|
||||
$styles->add( 'mediaelement', "/wp-includes/js/mediaelement/mediaelementplayer-legacy.min.css", array(), '4.2.5-74e01a40' );
|
||||
$styles->add( 'mediaelement', "/wp-includes/js/mediaelement/mediaelementplayer-legacy.min.css", array(), '4.2.6-78496d1' );
|
||||
$styles->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement$suffix.css", array( 'mediaelement' ) );
|
||||
$styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array( 'dashicons' ) );
|
||||
$styles->add( 'wp-codemirror', '/wp-includes/js/codemirror/codemirror.min.css', array(), '5.29.1-alpha-ee20357' );
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.9-beta2-41876';
|
||||
$wp_version = '4.9-beta2-41877';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue