Skip to content

Commit

Permalink
v2.12.2
Browse files Browse the repository at this point in the history
  • Loading branch information
luwes committed Jul 10, 2020
1 parent e5c434a commit 46c7b01
Show file tree
Hide file tree
Showing 6 changed files with 231 additions and 203 deletions.
212 changes: 113 additions & 99 deletions dist/player.es.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! @vimeo/player v2.12.1 | (c) 2020 Vimeo | MIT License | https://github.com/vimeo/player.js */
/*! @vimeo/player v2.12.2 | (c) 2020 Vimeo | MIT License | https://github.com/vimeo/player.js */
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
Expand Down Expand Up @@ -1017,109 +1017,113 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Terms */
var fn = function () {
var val;
var fnMap = [['requestFullscreen', 'exitFullscreen', 'fullscreenElement', 'fullscreenEnabled', 'fullscreenchange', 'fullscreenerror'], // New WebKit
['webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitFullscreenElement', 'webkitFullscreenEnabled', 'webkitfullscreenchange', 'webkitfullscreenerror'], // Old WebKit
['webkitRequestFullScreen', 'webkitCancelFullScreen', 'webkitCurrentFullScreenElement', 'webkitCancelFullScreen', 'webkitfullscreenchange', 'webkitfullscreenerror'], ['mozRequestFullScreen', 'mozCancelFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'mozfullscreenchange', 'mozfullscreenerror'], ['msRequestFullscreen', 'msExitFullscreen', 'msFullscreenElement', 'msFullscreenEnabled', 'MSFullscreenChange', 'MSFullscreenError']];
var i = 0;
var l = fnMap.length;
var ret = {};

for (; i < l; i++) {
val = fnMap[i];

if (val && val[1] in document) {
for (i = 0; i < val.length; i++) {
ret[fnMap[0][i]] = val[i];
}
function initializeScreenfull() {
var fn = function () {
var val;
var fnMap = [['requestFullscreen', 'exitFullscreen', 'fullscreenElement', 'fullscreenEnabled', 'fullscreenchange', 'fullscreenerror'], // New WebKit
['webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitFullscreenElement', 'webkitFullscreenEnabled', 'webkitfullscreenchange', 'webkitfullscreenerror'], // Old WebKit
['webkitRequestFullScreen', 'webkitCancelFullScreen', 'webkitCurrentFullScreenElement', 'webkitCancelFullScreen', 'webkitfullscreenchange', 'webkitfullscreenerror'], ['mozRequestFullScreen', 'mozCancelFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'mozfullscreenchange', 'mozfullscreenerror'], ['msRequestFullscreen', 'msExitFullscreen', 'msFullscreenElement', 'msFullscreenEnabled', 'MSFullscreenChange', 'MSFullscreenError']];
var i = 0;
var l = fnMap.length;
var ret = {};

for (; i < l; i++) {
val = fnMap[i];

if (val && val[1] in document) {
for (i = 0; i < val.length; i++) {
ret[fnMap[0][i]] = val[i];
}

return ret;
return ret;
}
}
}

return false;
}();

var eventNameMap = {
fullscreenchange: fn.fullscreenchange,
fullscreenerror: fn.fullscreenerror
};
var screenfull = {
request: function request(element) {
return new Promise(function (resolve, reject) {
var onFullScreenEntered = function onFullScreenEntered() {
screenfull.off('fullscreenchange', onFullScreenEntered);
resolve();
};
return false;
}();

screenfull.on('fullscreenchange', onFullScreenEntered);
element = element || document.documentElement;
var returnPromise = element[fn.requestFullscreen]();
var eventNameMap = {
fullscreenchange: fn.fullscreenchange,
fullscreenerror: fn.fullscreenerror
};
var screenfull = {
request: function request(element) {
return new Promise(function (resolve, reject) {
var onFullScreenEntered = function onFullScreenEntered() {
screenfull.off('fullscreenchange', onFullScreenEntered);
resolve();
};

if (returnPromise instanceof Promise) {
returnPromise.then(onFullScreenEntered).catch(reject);
}
});
},
exit: function exit() {
return new Promise(function (resolve, reject) {
if (!screenfull.isFullscreen) {
resolve();
return;
}
screenfull.on('fullscreenchange', onFullScreenEntered);
element = element || document.documentElement;
var returnPromise = element[fn.requestFullscreen]();

var onFullScreenExit = function onFullScreenExit() {
screenfull.off('fullscreenchange', onFullScreenExit);
resolve();
};
if (returnPromise instanceof Promise) {
returnPromise.then(onFullScreenEntered).catch(reject);
}
});
},
exit: function exit() {
return new Promise(function (resolve, reject) {
if (!screenfull.isFullscreen) {
resolve();
return;
}

screenfull.on('fullscreenchange', onFullScreenExit);
var returnPromise = document[fn.exitFullscreen]();
var onFullScreenExit = function onFullScreenExit() {
screenfull.off('fullscreenchange', onFullScreenExit);
resolve();
};

if (returnPromise instanceof Promise) {
returnPromise.then(onFullScreenExit).catch(reject);
}
});
},
on: function on(event, callback) {
var eventName = eventNameMap[event];
screenfull.on('fullscreenchange', onFullScreenExit);
var returnPromise = document[fn.exitFullscreen]();

if (eventName) {
document.addEventListener(eventName, callback);
}
},
off: function off(event, callback) {
var eventName = eventNameMap[event];
if (returnPromise instanceof Promise) {
returnPromise.then(onFullScreenExit).catch(reject);
}
});
},
on: function on(event, callback) {
var eventName = eventNameMap[event];

if (eventName) {
document.removeEventListener(eventName, callback);
if (eventName) {
document.addEventListener(eventName, callback);
}
},
off: function off(event, callback) {
var eventName = eventNameMap[event];

if (eventName) {
document.removeEventListener(eventName, callback);
}
}
}
};
Object.defineProperties(screenfull, {
isFullscreen: {
get: function get() {
return Boolean(document[fn.fullscreenElement]);
}
},
element: {
enumerable: true,
get: function get() {
return document[fn.fullscreenElement];
}
},
isEnabled: {
enumerable: true,
get: function get() {
// Coerce to boolean in case of old WebKit
return Boolean(document[fn.fullscreenEnabled]);
};
Object.defineProperties(screenfull, {
isFullscreen: {
get: function get() {
return Boolean(document[fn.fullscreenElement]);
}
},
element: {
enumerable: true,
get: function get() {
return document[fn.fullscreenElement];
}
},
isEnabled: {
enumerable: true,
get: function get() {
// Coerce to boolean in case of old WebKit
return Boolean(document[fn.fullscreenEnabled]);
}
}
}
});
});
return screenfull;
}

var playerMap = new WeakMap();
var readyMap = new WeakMap();
var screenfull = {};

var Player =
/*#__PURE__*/
Expand Down Expand Up @@ -1240,6 +1244,25 @@ function () {
postMessage(this, 'ping');
}

if (screenfull.isEnabled) {
var exitFullscreen = function exitFullscreen() {
return screenfull.exit();
};

screenfull.on('fullscreenchange', function () {
if (screenfull.isFullscreen) {
storeCallback(_this, 'event:exitFullscreen', exitFullscreen);
} else {
removeCallback(_this, 'event:exitFullscreen', exitFullscreen);
} // eslint-disable-next-line


_this.ready().then(function () {
postMessage(_this, 'fullscreenchange', screenfull.isFullscreen);
});
});
}

return this;
}
/**
Expand Down Expand Up @@ -1353,11 +1376,6 @@ function () {
throw new TypeError('The callback must be a function.');
}

if (screenfull.isEnabled && (eventName === 'fullscreenchange' || eventName === 'fullscreenerror')) {
screenfull.on(eventName, callback);
return;
}

var callbacks = getCallbacks(this, "event:".concat(eventName));

if (callbacks.length === 0) {
Expand Down Expand Up @@ -1389,11 +1407,6 @@ function () {
throw new TypeError('The callback must be a function.');
}

if (screenfull.isEnabled && (eventName === 'fullscreenchange' || eventName === 'fullscreenerror')) {
screenfull.off(eventName, callback);
return;
}

var lastCallback = removeCallback(this, "event:".concat(eventName), callback); // If there are no callbacks left, remove the listener

if (lastCallback) {
Expand Down Expand Up @@ -2329,6 +2342,7 @@ function () {


if (!isNode) {
screenfull = initializeScreenfull();
initializeEmbeds();
resizeEmbeds();
}
Expand Down
Loading

0 comments on commit 46c7b01

Please sign in to comment.