videojs-mobile-ui 1.2.0-alpha.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +104 -53
- package/dist/lang/de.js +1 -3
- package/dist/lang/en.js +1 -3
- package/dist/lang/it.js +1 -3
- package/dist/videojs-mobile-ui.cjs.js +195 -43
- package/dist/videojs-mobile-ui.css +104 -2
- package/dist/videojs-mobile-ui.es.js +195 -43
- package/dist/videojs-mobile-ui.js +204 -53
- package/dist/videojs-mobile-ui.min.js +2 -2
- package/docs/api/TouchOverlay.html +964 -0
- package/docs/api/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/docs/api/fonts/OpenSans-Bold-webfont.svg +1830 -0
- package/docs/api/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/docs/api/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/docs/api/fonts/OpenSans-BoldItalic-webfont.svg +1830 -0
- package/docs/api/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/docs/api/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/docs/api/fonts/OpenSans-Italic-webfont.svg +1830 -0
- package/docs/api/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/docs/api/fonts/OpenSans-Light-webfont.eot +0 -0
- package/docs/api/fonts/OpenSans-Light-webfont.svg +1831 -0
- package/docs/api/fonts/OpenSans-Light-webfont.woff +0 -0
- package/docs/api/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/docs/api/fonts/OpenSans-LightItalic-webfont.svg +1835 -0
- package/docs/api/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/docs/api/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/docs/api/fonts/OpenSans-Regular-webfont.svg +1831 -0
- package/docs/api/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/docs/api/global.html +957 -0
- package/docs/api/index.html +159 -0
- package/docs/api/plugin.js.html +221 -0
- package/docs/api/scripts/linenumber.js +25 -0
- package/docs/api/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/docs/api/scripts/prettify/lang-css.js +2 -0
- package/docs/api/scripts/prettify/prettify.js +28 -0
- package/docs/api/styles/jsdoc-default.css +358 -0
- package/docs/api/styles/prettify-jsdoc.css +111 -0
- package/docs/api/styles/prettify-tomorrow.css +132 -0
- package/docs/api/swipeFullscreen.js.html +173 -0
- package/docs/api/touchOverlay.js.html +211 -0
- package/index.html +238 -170
- package/package.json +23 -13
- package/scripts/lang.js +24 -0
- package/scripts/netlify.js +16 -0
- package/scripts/postcss.config.js +29 -5
- package/scripts/readme-options.js +370 -0
- package/scripts/rollup.config.js +0 -8
- package/src/plugin.css +6 -0
- package/src/plugin.js +65 -39
- package/src/swipeFullscreen.js +122 -0
- package/src/touchOverlay.js +7 -3
- package/test/plugin.test.js +125 -18
- package/test/swipeFullscreen.test.js +365 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @name videojs-mobile-ui @version 1.2.
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("video.js")
|
|
1
|
+
/*! @name videojs-mobile-ui @version 1.2.1 @license MIT */
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("video.js")):"function"==typeof define&&define.amd?define(["video.js"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).videojsMobileUi=t(e.videojs)}(this,function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=t(e);const n=s.default.getComponent("Component"),o=s.default.dom||s.default;n.registerComponent("TouchOverlay",class extends n{constructor(e,t){super(e,t),this.seekSeconds=t.seekSeconds,this.tapTimeout=t.tapTimeout,this.taps=0,this.addChild("playToggle",{}),e.on(["playing","userinactive"],e=>{this.removeClass("show-play-toggle")}),0===this.player_.options_.inactivityTimeout&&(this.player_.options_.inactivityTimeout=5e3),this.handleTaps_=s.default.fn.debounce(e=>{const t=(this.taps-1)*this.seekSeconds;if(this.taps=0,t<1)return;const s=this.el_.getBoundingClientRect(),n=e.changedTouches[0].clientX-s.left;if(n<.4*s.width)this.player_.currentTime(Math.max(0,this.player_.currentTime()-t)),this.addClass("reverse");else{if(!(n>s.width-.4*s.width))return;this.player_.currentTime(Math.min(this.player_.duration(),this.player_.currentTime()+t)),this.removeClass("reverse")}this.removeClass("show-play-toggle"),this.setAttribute("data-skip-text",`${t} ${this.localize("seconds")}`),this.removeClass("skip"),window.requestAnimationFrame(()=>{this.addClass("skip")})},this.tapTimeout),this.enable()}createEl(){return o.createEl("div",{className:"vjs-touch-overlay",tabIndex:-1})}handleTap(e){e.target===this.el_&&(e.cancelable&&e.preventDefault(),this.taps+=1,1===this.taps&&(this.removeClass("skip"),this.toggleClass("show-play-toggle")),this.handleTaps_(e))}enable(){this.firstTapCaptured=!1,this.on("touchend",this.handleTap)}disable(){this.off("touchend",this.handleTap)}});const i={fullscreen:{enterOnRotate:!0,exitOnRotate:!0,lockOnRotate:!0,lockToLandscapeOnEnter:!1,swipeToFullscreen:!1,swipeFromFullscreen:!1,disabled:!1},touchControls:{seekSeconds:10,tapTimeout:300,disableOnEnd:!1,disabled:!1}},l=window.screen,r=()=>{if(l){const e=((l.orientation||{}).type||l.mozOrientation||l.msOrientation||"").split("-")[0];if("landscape"===e||"portrait"===e)return e}return"number"==typeof window.orientation?0===window.orientation||180===window.orientation?"portrait":"landscape":"portrait"},a=(e,t)=>{if(e.addClass("vjs-mobile-ui"),!t.touchControls.disabled){(t.touchControls.disableOnEnd||"function"==typeof e.endscreen)&&e.addClass("vjs-mobile-ui-disable-end");const s=e.children_.indexOf(e.getChild("ControlBar"));e.touchOverlay=e.addChild("TouchOverlay",t.touchControls,s)}if(t.fullscreen.disabled)return;(t.fullscreen.swipeToFullscreen||t.fullscreen.swipeFromFullscreen)&&((e,t)=>{const{swipeToFullscreen:s,swipeFromFullscreen:n}=t.fullscreen;s&&e.addClass("using-fs-swipe-up"),n&&e.addClass("using-fs-swipe-down");let o=0,i=!1;const l=t=>{const l=e.isFullscreen();!l&&!s||l&&!n?i=!1:(o=t.changedTouches[0].clientY,i=!0,e.tech_.el().style.transition="")},r=t=>{if(!i)return;const s=t.touches[0].clientY,n=o-s,l=e.isFullscreen();let r=1;!l&&n>0?(r=1+Math.min(.1,n/500),e.tech_.el().style.transform=`scale(${r})`):l&&n<0&&(r=1-Math.min(.1,Math.abs(n)/500),e.tech_.el().style.transform=`scale(${r})`)},a=t=>{if(!i)return;if(i=!1,e.tech_.el().style.transition="transform 0.3s ease-out",e.tech_.el().style.transform="scale(1)","touchcancel"===t.type)return;const s=t.changedTouches[0].clientY,n=o-s;n>30&&!e.isFullscreen()?e.requestFullscreen().catch(t=>{e.log.warn("Browser refused fullscreen",t)}):n<-30&&e.isFullscreen()&&e.exitFullscreen()};e.el().addEventListener("touchstart",l,{passive:!0}),e.el().addEventListener("touchmove",r,{passive:!0}),e.el().addEventListener("touchend",a,{passive:!0}),e.el().addEventListener("touchcancel",a,{passive:!0}),e.on("dispose",()=>{e.el().removeEventListener("touchstart",l,{passive:!0}),e.el().removeEventListener("touchmove",r,{passive:!0}),e.el().removeEventListener("touchend",a,{passive:!0}),e.el().removeEventListener("touchcancel",a,{passive:!0}),e.tech_.el().style.transform="",e.tech_.el().style.transition=""})})(e,t);let n=!1;const o=()=>{const o=r();"landscape"===o&&t.fullscreen.enterOnRotate?e.paused()||e.isFullscreen()||(e.requestFullscreen().catch(t=>{e.log.warn("Browser refused fullscreen request:",t)}),(t.fullscreen.lockOnRotate||t.fullscreen.lockToLandscapeOnEnter)&&l.orientation&&l.orientation.lock&&l.orientation.lock("landscape").then(()=>{n=!0}).catch(e=>{s.default.log.warn("Browser refused orientation lock:",e)})):"portrait"===o&&t.fullscreen.exitOnRotate&&!n&&e.isFullscreen()&&e.exitFullscreen()};(t.fullscreen.enterOnRotate||t.fullscreen.exitOnRotate)&&(s.default.browser.IS_IOS?(window.addEventListener("orientationchange",o),e.on("dispose",()=>{window.removeEventListener("orientationchange",o)})):l.orientation&&(l.orientation.onchange=o,e.on("dispose",()=>{l.orientation.onchange=null}))),e.on("fullscreenchange",o=>{e.log("fullscreenchange",e.isFullscreen(),t.fullscreen.lockToLandscapeOnEnter,r()),e.isFullscreen()&&t.fullscreen.lockToLandscapeOnEnter&&"portrait"===r()?l.orientation.lock("landscape").then(()=>{n=!0}).catch(e=>{s.default.log("Browser refused orientation lock:",e)}):!e.isFullscreen()&&n&&(l.orientation.unlock(),n=!1)}),e.on("ended",e=>{!0===n&&(l.orientation.unlock(),n=!1)})},c=function(e={}){(e.forceForTesting||s.default.browser.IS_ANDROID||s.default.browser.IS_IOS)&&this.ready(()=>{a(this,s.default.obj.merge(i,e))})};return s.default.registerPlugin("mobileUi",c),c.VERSION="1.2.1",c});
|