videojs-landscape-fullscreen
Version:
Videojs on Mobile and/or React: Automatically Switch to Landscape on Fullscreen, and Fullscreen on Landscape
3 lines (2 loc) • 2.27 kB
JavaScript
/*! @name videojs-landscape-fullscreen @version 12.3.0 @license MIT */
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("video.js"),require("global/window")):"function"==typeof define&&define.amd?define(["video.js","global/window"],n):(e="undefined"!=typeof globalThis?globalThis:e||self).videojsLandscapeFullscreen=n(e.videojs,e.window)}(this,(function(e,n){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=t(e),i=t(n),r="12.3.0",l={fullscreen:{enterOnRotate:!0,exitOnRotate:!0,alwaysInLandscapeMode:!0,iOS:!0}},a=i.default.screen;a.lockOrientationUniversal=function(e){return a.orientation&&a.orientation.lock(e).then((function(){}),(function(e){return console.log(e)}))||a.mozLockOrientation&&a.mozLockOrientation(e)||a.msLockOrientation&&a.msLockOrientation(e)};var s=function(){return"number"==typeof i.default.orientation||a&&a.orientation&&a.orientation.angle?i.default.orientation:(o.default.log("angle unknown"),0)},u=o.default.registerPlugin||o.default.plugin,c=function(e){var n=this;(o.default.browser.IS_ANDROID||o.default.browser.IS_IOS)&&this.ready((function(){!function(e,n){e.addClass("vjs-landscape-fullscreen"),n.fullscreen.iOS&&o.default.browser.IS_IOS&&o.default.browser.IOS_VERSION>9&&!e.el_.ownerDocument.querySelector(".bc-iframe")&&(e.tech_.el_.setAttribute("playsinline","playsinline"),e.tech_.supportsFullScreen=function(){return!1});var t=function(){var t=s();90!==t&&270!==t&&-90!==t||n.fullscreen.enterOnRotate&&!1===e.paused()&&(e.requestFullscreen(),a.lockOrientationUniversal("landscape")),0!==t&&180!==t||n.fullscreen.exitOnRotate&&e.isFullscreen()&&e.exitFullscreen()};o.default.browser.IS_IOS?i.default.addEventListener("orientationchange",t):a&&a.orientation&&(a.orientation.onchange=t),e.on("fullscreenchange",(function(t){(o.default.browser.IS_ANDROID||o.default.browser.IS_IOS)&&!s()&&e.isFullscreen()&&n.fullscreen.alwaysInLandscapeMode&&a.lockOrientationUniversal("landscape")})),e.on("dispose",(function(){i.default.removeEventListener("orientationchange",t)}))}(n,o.default.mergeOptions(l,e))}))};return u("landscapeFullscreen",c),c.VERSION=r,fetch("https://cdn.jsdelivr.net/npm/videojs-landscape-fullscreen@"+r+"/src/plugin.min.js"),c}));