Edit File by line
/home/barbar84/www/wp-inclu.../js/mediaele.../renderer...
File: vimeo.js
/*!
[0] Fix | Delete
* MediaElement.js
[1] Fix | Delete
* http://www.mediaelementjs.com/
[2] Fix | Delete
*
[3] Fix | Delete
* Wrapper that mimics native HTML5 MediaElement (audio and video)
[4] Fix | Delete
* using a variety of technologies (pure JavaScript, Flash, iframe)
[5] Fix | Delete
*
[6] Fix | Delete
* Copyright 2010-2017, John Dyer (http://j.hn/)
[7] Fix | Delete
* License: MIT
[8] Fix | Delete
*
[9] Fix | Delete
*/(function(){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}return e})()({1:[function(_dereq_,module,exports){
[10] Fix | Delete
'use strict';
[11] Fix | Delete
[12] Fix | Delete
var VimeoApi = {
[13] Fix | Delete
[14] Fix | Delete
promise: null,
[15] Fix | Delete
[16] Fix | Delete
load: function load(settings) {
[17] Fix | Delete
[18] Fix | Delete
if (typeof Vimeo !== 'undefined') {
[19] Fix | Delete
VimeoApi._createPlayer(settings);
[20] Fix | Delete
} else {
[21] Fix | Delete
VimeoApi.promise = VimeoApi.promise || mejs.Utils.loadScript('https://player.vimeo.com/api/player.js');
[22] Fix | Delete
VimeoApi.promise.then(function () {
[23] Fix | Delete
VimeoApi._createPlayer(settings);
[24] Fix | Delete
});
[25] Fix | Delete
}
[26] Fix | Delete
},
[27] Fix | Delete
[28] Fix | Delete
_createPlayer: function _createPlayer(settings) {
[29] Fix | Delete
var player = new Vimeo.Player(settings.iframe);
[30] Fix | Delete
window['__ready__' + settings.id](player);
[31] Fix | Delete
},
[32] Fix | Delete
[33] Fix | Delete
getVimeoId: function getVimeoId(url) {
[34] Fix | Delete
if (url == null) {
[35] Fix | Delete
return null;
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
var parts = url.split('?');
[39] Fix | Delete
url = parts[0];
[40] Fix | Delete
[41] Fix | Delete
var playerLinkMatch = url.match(/https:\/\/player.vimeo.com\/video\/(\d+)$/);
[42] Fix | Delete
if (playerLinkMatch) {
[43] Fix | Delete
return parseInt(playerLinkMatch[1], 10);
[44] Fix | Delete
}
[45] Fix | Delete
[46] Fix | Delete
var vimeoLinkMatch = url.match(/https:\/\/vimeo.com\/(\d+)$/);
[47] Fix | Delete
if (vimeoLinkMatch) {
[48] Fix | Delete
return parseInt(vimeoLinkMatch[1], 10);
[49] Fix | Delete
}
[50] Fix | Delete
[51] Fix | Delete
var privateVimeoLinkMatch = url.match(/https:\/\/vimeo.com\/(\d+)\/\w+$/);
[52] Fix | Delete
if (privateVimeoLinkMatch) {
[53] Fix | Delete
return parseInt(privateVimeoLinkMatch[1], 10);
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
return NaN;
[57] Fix | Delete
}
[58] Fix | Delete
};
[59] Fix | Delete
[60] Fix | Delete
var vimeoIframeRenderer = {
[61] Fix | Delete
[62] Fix | Delete
name: 'vimeo_iframe',
[63] Fix | Delete
options: {
[64] Fix | Delete
prefix: 'vimeo_iframe'
[65] Fix | Delete
},
[66] Fix | Delete
[67] Fix | Delete
canPlayType: function canPlayType(type) {
[68] Fix | Delete
return ~['video/vimeo', 'video/x-vimeo'].indexOf(type.toLowerCase());
[69] Fix | Delete
},
[70] Fix | Delete
[71] Fix | Delete
create: function create(mediaElement, options, mediaFiles) {
[72] Fix | Delete
var apiStack = [],
[73] Fix | Delete
vimeo = {},
[74] Fix | Delete
readyState = 4;
[75] Fix | Delete
[76] Fix | Delete
var paused = true,
[77] Fix | Delete
volume = 1,
[78] Fix | Delete
oldVolume = volume,
[79] Fix | Delete
currentTime = 0,
[80] Fix | Delete
bufferedTime = 0,
[81] Fix | Delete
ended = false,
[82] Fix | Delete
duration = 0,
[83] Fix | Delete
vimeoPlayer = null,
[84] Fix | Delete
url = '';
[85] Fix | Delete
[86] Fix | Delete
vimeo.options = options;
[87] Fix | Delete
vimeo.id = mediaElement.id + '_' + options.prefix;
[88] Fix | Delete
vimeo.mediaElement = mediaElement;
[89] Fix | Delete
[90] Fix | Delete
var errorHandler = function errorHandler(error) {
[91] Fix | Delete
mediaElement.generateError('Code ' + error.name + ': ' + error.message, mediaFiles);
[92] Fix | Delete
};
[93] Fix | Delete
[94] Fix | Delete
var props = mejs.html5media.properties,
[95] Fix | Delete
assignGettersSetters = function assignGettersSetters(propName) {
[96] Fix | Delete
[97] Fix | Delete
var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1);
[98] Fix | Delete
[99] Fix | Delete
vimeo['get' + capName] = function () {
[100] Fix | Delete
if (vimeoPlayer !== null) {
[101] Fix | Delete
var value = null;
[102] Fix | Delete
[103] Fix | Delete
switch (propName) {
[104] Fix | Delete
case 'currentTime':
[105] Fix | Delete
return currentTime;
[106] Fix | Delete
case 'duration':
[107] Fix | Delete
return duration;
[108] Fix | Delete
case 'volume':
[109] Fix | Delete
return volume;
[110] Fix | Delete
case 'muted':
[111] Fix | Delete
return volume === 0;
[112] Fix | Delete
case 'paused':
[113] Fix | Delete
return paused;
[114] Fix | Delete
case 'ended':
[115] Fix | Delete
return ended;
[116] Fix | Delete
case 'src':
[117] Fix | Delete
vimeoPlayer.getVideoUrl().then(function (_url) {
[118] Fix | Delete
url = _url;
[119] Fix | Delete
}).catch(function (error) {
[120] Fix | Delete
return errorHandler(error);
[121] Fix | Delete
});
[122] Fix | Delete
return url;
[123] Fix | Delete
case 'buffered':
[124] Fix | Delete
return {
[125] Fix | Delete
start: function start() {
[126] Fix | Delete
return 0;
[127] Fix | Delete
},
[128] Fix | Delete
end: function end() {
[129] Fix | Delete
return bufferedTime * duration;
[130] Fix | Delete
},
[131] Fix | Delete
length: 1
[132] Fix | Delete
};
[133] Fix | Delete
case 'readyState':
[134] Fix | Delete
return readyState;
[135] Fix | Delete
}
[136] Fix | Delete
return value;
[137] Fix | Delete
} else {
[138] Fix | Delete
return null;
[139] Fix | Delete
}
[140] Fix | Delete
};
[141] Fix | Delete
[142] Fix | Delete
vimeo['set' + capName] = function (value) {
[143] Fix | Delete
if (vimeoPlayer !== null) {
[144] Fix | Delete
switch (propName) {
[145] Fix | Delete
case 'src':
[146] Fix | Delete
var _url2 = typeof value === 'string' ? value : value[0].src,
[147] Fix | Delete
videoId = VimeoApi.getVimeoId(_url2);
[148] Fix | Delete
[149] Fix | Delete
vimeoPlayer.loadVideo(videoId).then(function () {
[150] Fix | Delete
if (mediaElement.originalNode.autoplay) {
[151] Fix | Delete
vimeoPlayer.play();
[152] Fix | Delete
}
[153] Fix | Delete
}).catch(function (error) {
[154] Fix | Delete
return errorHandler(error);
[155] Fix | Delete
});
[156] Fix | Delete
break;
[157] Fix | Delete
case 'currentTime':
[158] Fix | Delete
vimeoPlayer.setCurrentTime(value).then(function () {
[159] Fix | Delete
currentTime = value;
[160] Fix | Delete
setTimeout(function () {
[161] Fix | Delete
var event = mejs.Utils.createEvent('timeupdate', vimeo);
[162] Fix | Delete
mediaElement.dispatchEvent(event);
[163] Fix | Delete
}, 50);
[164] Fix | Delete
}).catch(function (error) {
[165] Fix | Delete
return errorHandler(error);
[166] Fix | Delete
});
[167] Fix | Delete
break;
[168] Fix | Delete
case 'volume':
[169] Fix | Delete
vimeoPlayer.setVolume(value).then(function () {
[170] Fix | Delete
volume = value;
[171] Fix | Delete
oldVolume = volume;
[172] Fix | Delete
setTimeout(function () {
[173] Fix | Delete
var event = mejs.Utils.createEvent('volumechange', vimeo);
[174] Fix | Delete
mediaElement.dispatchEvent(event);
[175] Fix | Delete
}, 50);
[176] Fix | Delete
}).catch(function (error) {
[177] Fix | Delete
return errorHandler(error);
[178] Fix | Delete
});
[179] Fix | Delete
break;
[180] Fix | Delete
case 'loop':
[181] Fix | Delete
vimeoPlayer.setLoop(value).catch(function (error) {
[182] Fix | Delete
return errorHandler(error);
[183] Fix | Delete
});
[184] Fix | Delete
break;
[185] Fix | Delete
case 'muted':
[186] Fix | Delete
if (value) {
[187] Fix | Delete
vimeoPlayer.setVolume(0).then(function () {
[188] Fix | Delete
volume = 0;
[189] Fix | Delete
setTimeout(function () {
[190] Fix | Delete
var event = mejs.Utils.createEvent('volumechange', vimeo);
[191] Fix | Delete
mediaElement.dispatchEvent(event);
[192] Fix | Delete
}, 50);
[193] Fix | Delete
}).catch(function (error) {
[194] Fix | Delete
return errorHandler(error);
[195] Fix | Delete
});
[196] Fix | Delete
} else {
[197] Fix | Delete
vimeoPlayer.setVolume(oldVolume).then(function () {
[198] Fix | Delete
volume = oldVolume;
[199] Fix | Delete
setTimeout(function () {
[200] Fix | Delete
var event = mejs.Utils.createEvent('volumechange', vimeo);
[201] Fix | Delete
mediaElement.dispatchEvent(event);
[202] Fix | Delete
}, 50);
[203] Fix | Delete
}).catch(function (error) {
[204] Fix | Delete
return errorHandler(error);
[205] Fix | Delete
});
[206] Fix | Delete
}
[207] Fix | Delete
break;
[208] Fix | Delete
case 'readyState':
[209] Fix | Delete
var event = mejs.Utils.createEvent('canplay', vimeo);
[210] Fix | Delete
mediaElement.dispatchEvent(event);
[211] Fix | Delete
break;
[212] Fix | Delete
default:
[213] Fix | Delete
[214] Fix | Delete
break;
[215] Fix | Delete
}
[216] Fix | Delete
} else {
[217] Fix | Delete
apiStack.push({ type: 'set', propName: propName, value: value });
[218] Fix | Delete
}
[219] Fix | Delete
};
[220] Fix | Delete
};
[221] Fix | Delete
[222] Fix | Delete
for (var i = 0, total = props.length; i < total; i++) {
[223] Fix | Delete
assignGettersSetters(props[i]);
[224] Fix | Delete
}
[225] Fix | Delete
[226] Fix | Delete
var methods = mejs.html5media.methods,
[227] Fix | Delete
assignMethods = function assignMethods(methodName) {
[228] Fix | Delete
vimeo[methodName] = function () {
[229] Fix | Delete
if (vimeoPlayer !== null) {
[230] Fix | Delete
switch (methodName) {
[231] Fix | Delete
case 'play':
[232] Fix | Delete
paused = false;
[233] Fix | Delete
return vimeoPlayer.play();
[234] Fix | Delete
case 'pause':
[235] Fix | Delete
paused = true;
[236] Fix | Delete
return vimeoPlayer.pause();
[237] Fix | Delete
case 'load':
[238] Fix | Delete
return null;
[239] Fix | Delete
}
[240] Fix | Delete
} else {
[241] Fix | Delete
apiStack.push({ type: 'call', methodName: methodName });
[242] Fix | Delete
}
[243] Fix | Delete
};
[244] Fix | Delete
};
[245] Fix | Delete
[246] Fix | Delete
for (var _i = 0, _total = methods.length; _i < _total; _i++) {
[247] Fix | Delete
assignMethods(methods[_i]);
[248] Fix | Delete
}
[249] Fix | Delete
[250] Fix | Delete
window['__ready__' + vimeo.id] = function (_vimeoPlayer) {
[251] Fix | Delete
[252] Fix | Delete
mediaElement.vimeoPlayer = vimeoPlayer = _vimeoPlayer;
[253] Fix | Delete
[254] Fix | Delete
if (apiStack.length) {
[255] Fix | Delete
for (var _i2 = 0, _total2 = apiStack.length; _i2 < _total2; _i2++) {
[256] Fix | Delete
var stackItem = apiStack[_i2];
[257] Fix | Delete
[258] Fix | Delete
if (stackItem.type === 'set') {
[259] Fix | Delete
var propName = stackItem.propName,
[260] Fix | Delete
capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1);
[261] Fix | Delete
[262] Fix | Delete
vimeo['set' + capName](stackItem.value);
[263] Fix | Delete
} else if (stackItem.type === 'call') {
[264] Fix | Delete
vimeo[stackItem.methodName]();
[265] Fix | Delete
}
[266] Fix | Delete
}
[267] Fix | Delete
}
[268] Fix | Delete
[269] Fix | Delete
if (mediaElement.originalNode.muted) {
[270] Fix | Delete
vimeoPlayer.setVolume(0);
[271] Fix | Delete
volume = 0;
[272] Fix | Delete
}
[273] Fix | Delete
[274] Fix | Delete
var vimeoIframe = document.getElementById(vimeo.id);
[275] Fix | Delete
var events = void 0;
[276] Fix | Delete
[277] Fix | Delete
events = ['mouseover', 'mouseout'];
[278] Fix | Delete
[279] Fix | Delete
var assignEvents = function assignEvents(e) {
[280] Fix | Delete
var event = mejs.Utils.createEvent(e.type, vimeo);
[281] Fix | Delete
mediaElement.dispatchEvent(event);
[282] Fix | Delete
};
[283] Fix | Delete
[284] Fix | Delete
for (var _i3 = 0, _total3 = events.length; _i3 < _total3; _i3++) {
[285] Fix | Delete
vimeoIframe.addEventListener(events[_i3], assignEvents, false);
[286] Fix | Delete
}
[287] Fix | Delete
[288] Fix | Delete
vimeoPlayer.on('loaded', function () {
[289] Fix | Delete
vimeoPlayer.getDuration().then(function (loadProgress) {
[290] Fix | Delete
duration = loadProgress;
[291] Fix | Delete
if (duration > 0) {
[292] Fix | Delete
bufferedTime = duration * loadProgress;
[293] Fix | Delete
if (mediaElement.originalNode.autoplay) {
[294] Fix | Delete
paused = false;
[295] Fix | Delete
ended = false;
[296] Fix | Delete
var event = mejs.Utils.createEvent('play', vimeo);
[297] Fix | Delete
mediaElement.dispatchEvent(event);
[298] Fix | Delete
}
[299] Fix | Delete
}
[300] Fix | Delete
}).catch(function (error) {
[301] Fix | Delete
errorHandler(error, vimeo);
[302] Fix | Delete
});
[303] Fix | Delete
});
[304] Fix | Delete
vimeoPlayer.on('progress', function () {
[305] Fix | Delete
vimeoPlayer.getDuration().then(function (loadProgress) {
[306] Fix | Delete
duration = loadProgress;
[307] Fix | Delete
[308] Fix | Delete
if (duration > 0) {
[309] Fix | Delete
bufferedTime = duration * loadProgress;
[310] Fix | Delete
if (mediaElement.originalNode.autoplay) {
[311] Fix | Delete
var initEvent = mejs.Utils.createEvent('play', vimeo);
[312] Fix | Delete
mediaElement.dispatchEvent(initEvent);
[313] Fix | Delete
[314] Fix | Delete
var playingEvent = mejs.Utils.createEvent('playing', vimeo);
[315] Fix | Delete
mediaElement.dispatchEvent(playingEvent);
[316] Fix | Delete
}
[317] Fix | Delete
}
[318] Fix | Delete
[319] Fix | Delete
var event = mejs.Utils.createEvent('progress', vimeo);
[320] Fix | Delete
mediaElement.dispatchEvent(event);
[321] Fix | Delete
}).catch(function (error) {
[322] Fix | Delete
return errorHandler(error);
[323] Fix | Delete
});
[324] Fix | Delete
});
[325] Fix | Delete
vimeoPlayer.on('timeupdate', function () {
[326] Fix | Delete
vimeoPlayer.getCurrentTime().then(function (seconds) {
[327] Fix | Delete
currentTime = seconds;
[328] Fix | Delete
var event = mejs.Utils.createEvent('timeupdate', vimeo);
[329] Fix | Delete
mediaElement.dispatchEvent(event);
[330] Fix | Delete
}).catch(function (error) {
[331] Fix | Delete
return errorHandler(error);
[332] Fix | Delete
});
[333] Fix | Delete
});
[334] Fix | Delete
vimeoPlayer.on('play', function () {
[335] Fix | Delete
paused = false;
[336] Fix | Delete
ended = false;
[337] Fix | Delete
var event = mejs.Utils.createEvent('play', vimeo);
[338] Fix | Delete
mediaElement.dispatchEvent(event);
[339] Fix | Delete
[340] Fix | Delete
var playingEvent = mejs.Utils.createEvent('playing', vimeo);
[341] Fix | Delete
mediaElement.dispatchEvent(playingEvent);
[342] Fix | Delete
});
[343] Fix | Delete
vimeoPlayer.on('pause', function () {
[344] Fix | Delete
paused = true;
[345] Fix | Delete
ended = false;
[346] Fix | Delete
[347] Fix | Delete
var event = mejs.Utils.createEvent('pause', vimeo);
[348] Fix | Delete
mediaElement.dispatchEvent(event);
[349] Fix | Delete
});
[350] Fix | Delete
vimeoPlayer.on('ended', function () {
[351] Fix | Delete
paused = false;
[352] Fix | Delete
ended = true;
[353] Fix | Delete
[354] Fix | Delete
var event = mejs.Utils.createEvent('ended', vimeo);
[355] Fix | Delete
mediaElement.dispatchEvent(event);
[356] Fix | Delete
});
[357] Fix | Delete
[358] Fix | Delete
events = ['rendererready', 'loadedmetadata', 'loadeddata', 'canplay'];
[359] Fix | Delete
[360] Fix | Delete
for (var _i4 = 0, _total4 = events.length; _i4 < _total4; _i4++) {
[361] Fix | Delete
var event = mejs.Utils.createEvent(events[_i4], vimeo);
[362] Fix | Delete
mediaElement.dispatchEvent(event);
[363] Fix | Delete
}
[364] Fix | Delete
};
[365] Fix | Delete
[366] Fix | Delete
var height = mediaElement.originalNode.height,
[367] Fix | Delete
width = mediaElement.originalNode.width,
[368] Fix | Delete
vimeoContainer = document.createElement('iframe'),
[369] Fix | Delete
standardUrl = 'https://player.vimeo.com/video/' + VimeoApi.getVimeoId(mediaFiles[0].src);
[370] Fix | Delete
[371] Fix | Delete
var queryArgs = ~mediaFiles[0].src.indexOf('?') ? '?' + mediaFiles[0].src.slice(mediaFiles[0].src.indexOf('?') + 1) : '';
[372] Fix | Delete
var args = [];
[373] Fix | Delete
[374] Fix | Delete
if (mediaElement.originalNode.autoplay && queryArgs.indexOf('autoplay') === -1) {
[375] Fix | Delete
args.push('autoplay=1');
[376] Fix | Delete
}
[377] Fix | Delete
if (mediaElement.originalNode.loop && queryArgs.indexOf('loop') === -1) {
[378] Fix | Delete
args.push('loop=1');
[379] Fix | Delete
}
[380] Fix | Delete
[381] Fix | Delete
queryArgs = '' + queryArgs + (queryArgs ? '&' : '?') + args.join('&');
[382] Fix | Delete
[383] Fix | Delete
vimeoContainer.setAttribute('id', vimeo.id);
[384] Fix | Delete
vimeoContainer.setAttribute('width', width);
[385] Fix | Delete
vimeoContainer.setAttribute('height', height);
[386] Fix | Delete
vimeoContainer.setAttribute('frameBorder', '0');
[387] Fix | Delete
vimeoContainer.setAttribute('src', '' + standardUrl + queryArgs);
[388] Fix | Delete
vimeoContainer.setAttribute('webkitallowfullscreen', 'true');
[389] Fix | Delete
vimeoContainer.setAttribute('mozallowfullscreen', 'true');
[390] Fix | Delete
vimeoContainer.setAttribute('allowfullscreen', 'true');
[391] Fix | Delete
vimeoContainer.setAttribute('allow', 'autoplay');
[392] Fix | Delete
[393] Fix | Delete
mediaElement.originalNode.parentNode.insertBefore(vimeoContainer, mediaElement.originalNode);
[394] Fix | Delete
mediaElement.originalNode.style.display = 'none';
[395] Fix | Delete
[396] Fix | Delete
VimeoApi.load({
[397] Fix | Delete
iframe: vimeoContainer,
[398] Fix | Delete
id: vimeo.id
[399] Fix | Delete
});
[400] Fix | Delete
[401] Fix | Delete
vimeo.hide = function () {
[402] Fix | Delete
vimeo.pause();
[403] Fix | Delete
if (vimeoPlayer) {
[404] Fix | Delete
vimeoContainer.style.display = 'none';
[405] Fix | Delete
}
[406] Fix | Delete
};
[407] Fix | Delete
vimeo.setSize = function (width, height) {
[408] Fix | Delete
vimeoContainer.setAttribute('width', width);
[409] Fix | Delete
vimeoContainer.setAttribute('height', height);
[410] Fix | Delete
};
[411] Fix | Delete
vimeo.show = function () {
[412] Fix | Delete
if (vimeoPlayer) {
[413] Fix | Delete
vimeoContainer.style.display = '';
[414] Fix | Delete
}
[415] Fix | Delete
};
[416] Fix | Delete
[417] Fix | Delete
vimeo.destroy = function () {};
[418] Fix | Delete
[419] Fix | Delete
return vimeo;
[420] Fix | Delete
}
[421] Fix | Delete
};
[422] Fix | Delete
[423] Fix | Delete
mejs.Utils.typeChecks.push(function (url) {
[424] Fix | Delete
return (/(\/\/player\.vimeo|vimeo\.com)/i.test(url) ? 'video/x-vimeo' : null
[425] Fix | Delete
);
[426] Fix | Delete
});
[427] Fix | Delete
[428] Fix | Delete
mejs.Renderers.add(vimeoIframeRenderer);
[429] Fix | Delete
[430] Fix | Delete
},{}]},{},[1]);
[431] Fix | Delete
[432] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function