videojs-mobile-ui 0.7.0 → 0.8.0
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/CHANGELOG.md +31 -0
- package/README.md +10 -2
- package/dist/videojs-mobile-ui.cjs.js +19 -10
- package/dist/videojs-mobile-ui.css +1 -1
- package/dist/videojs-mobile-ui.es.js +19 -10
- package/dist/videojs-mobile-ui.js +19 -10
- 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/touchOverlay.js.html +211 -0
- package/index.html +181 -102
- package/package.json +9 -6
- package/src/plugin.js +18 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
<a name="0.8.0"></a>
|
|
2
|
+
# [0.8.0](https://github.com/mister-ben/videojs-mobile-ui/compare/v0.5.3...v0.8.0) (2022-04-13)
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* Add disable options (#33) ([59e5f89](https://github.com/mister-ben/videojs-mobile-ui/commit/59e5f89)), closes [#33](https://github.com/mister-ben/videojs-mobile-ui/issues/33)
|
|
7
|
+
* Add option to lock to landscape when entering fullscreen (#49) ([26c58d4](https://github.com/mister-ben/videojs-mobile-ui/commit/26c58d4)), closes [#49](https://github.com/mister-ben/videojs-mobile-ui/issues/49)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Detect angle correctly where no window.orientation (#17) ([c85ac35](https://github.com/mister-ben/videojs-mobile-ui/commit/c85ac35)), closes [#17](https://github.com/mister-ben/videojs-mobile-ui/issues/17)
|
|
12
|
+
* Fix typo in iOS orientation (#27) ([7e05afb](https://github.com/mister-ben/videojs-mobile-ui/commit/7e05afb)), closes [#27](https://github.com/mister-ben/videojs-mobile-ui/issues/27)
|
|
13
|
+
* orientation string (#37) ([177f326](https://github.com/mister-ben/videojs-mobile-ui/commit/177f326)), closes [#37](https://github.com/mister-ben/videojs-mobile-ui/issues/37)
|
|
14
|
+
* Remove event listeners on player dispose (#21) ([25c8fb1](https://github.com/mister-ben/videojs-mobile-ui/commit/25c8fb1)), closes [#21](https://github.com/mister-ben/videojs-mobile-ui/issues/21)
|
|
15
|
+
* Split orientation string ([0eebd64](https://github.com/mister-ben/videojs-mobile-ui/commit/0eebd64))
|
|
16
|
+
|
|
17
|
+
### Chores
|
|
18
|
+
|
|
19
|
+
* **deps-dev:** bump karma from 6.3.14 to 6.3.16 (#46) ([7bd42f1](https://github.com/mister-ben/videojs-mobile-ui/commit/7bd42f1)), closes [#46](https://github.com/mister-ben/videojs-mobile-ui/issues/46)
|
|
20
|
+
* **deps-dev:** bump karma from 6.3.2 to 6.3.14 (#44) ([ddff196](https://github.com/mister-ben/videojs-mobile-ui/commit/ddff196)), closes [#44](https://github.com/mister-ben/videojs-mobile-ui/issues/44)
|
|
21
|
+
* **deps:** bump engine.io from 4.1.1 to 4.1.2 (#39) ([5031c93](https://github.com/mister-ben/videojs-mobile-ui/commit/5031c93)), closes [#39](https://github.com/mister-ben/videojs-mobile-ui/issues/39)
|
|
22
|
+
* **deps:** bump follow-redirects from 1.14.0 to 1.14.7 (#41) ([6fcbb49](https://github.com/mister-ben/videojs-mobile-ui/commit/6fcbb49)), closes [#41](https://github.com/mister-ben/videojs-mobile-ui/issues/41)
|
|
23
|
+
* **deps:** bump follow-redirects from 1.14.7 to 1.14.8 (#45) ([cf20418](https://github.com/mister-ben/videojs-mobile-ui/commit/cf20418)), closes [#45](https://github.com/mister-ben/videojs-mobile-ui/issues/45)
|
|
24
|
+
* **deps:** bump log4js from 6.3.0 to 6.4.0 (#42) ([f9c69ff](https://github.com/mister-ben/videojs-mobile-ui/commit/f9c69ff)), closes [#42](https://github.com/mister-ben/videojs-mobile-ui/issues/42)
|
|
25
|
+
* **deps:** bump minimist from 1.2.5 to 1.2.6 (#50) ([6faea79](https://github.com/mister-ben/videojs-mobile-ui/commit/6faea79)), closes [#50](https://github.com/mister-ben/videojs-mobile-ui/issues/50)
|
|
26
|
+
* **deps:** bump nanoid from 3.1.22 to 3.2.0 (#43) ([70e3440](https://github.com/mister-ben/videojs-mobile-ui/commit/70e3440)), closes [#43](https://github.com/mister-ben/videojs-mobile-ui/issues/43)
|
|
27
|
+
* **deps:** bump shelljs from 0.8.4 to 0.8.5 (#40) ([bf57915](https://github.com/mister-ben/videojs-mobile-ui/commit/bf57915)), closes [#40](https://github.com/mister-ben/videojs-mobile-ui/issues/40)
|
|
28
|
+
* make video.js a peer dependency (#51) ([1e1ae5d](https://github.com/mister-ben/videojs-mobile-ui/commit/1e1ae5d)), closes [#51](https://github.com/mister-ben/videojs-mobile-ui/issues/51)
|
|
29
|
+
* update dependencies ([6fb5a7b](https://github.com/mister-ben/videojs-mobile-ui/commit/6fb5a7b))
|
|
30
|
+
* Update to Node 14 / Generator 8 (#16) ([660dc86](https://github.com/mister-ben/videojs-mobile-ui/commit/660dc86)), closes [#16](https://github.com/mister-ben/videojs-mobile-ui/issues/16)
|
|
31
|
+
|
|
1
32
|
<a name="0.7.0"></a>
|
|
2
33
|
# [0.7.0](https://github.com/mister-ben/videojs-mobile-ui/compare/v0.6.1...v0.7.0) (2021-11-09)
|
|
3
34
|
|
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@ Fullscreen control:
|
|
|
12
12
|
|
|
13
13
|
- Rotate to landscape to enter Fullscreen
|
|
14
14
|
- Lock to fullscreen on rotate
|
|
15
|
+
- Always lock to landscape when entering fullscreen (works even when device rotation is disabled/non-functional)
|
|
15
16
|
|
|
16
17
|
## Table of Contents
|
|
17
18
|
|
|
@@ -45,12 +46,16 @@ npm install --save videojs-mobile-ui
|
|
|
45
46
|
fullscreen: {
|
|
46
47
|
enterOnRotate: true,
|
|
47
48
|
exitOnRotate: true,
|
|
48
|
-
lockOnRotate: true
|
|
49
|
+
lockOnRotate: true,
|
|
50
|
+
lockToLandscapeOnEnter: false,
|
|
51
|
+
iOS: false,
|
|
52
|
+
disabled: false
|
|
49
53
|
},
|
|
50
54
|
touchControls: {
|
|
51
55
|
seekSeconds: 10,
|
|
52
56
|
tapTimeout: 300,
|
|
53
|
-
disableOnEnd: false
|
|
57
|
+
disableOnEnd: false,
|
|
58
|
+
disabled: false,
|
|
54
59
|
}
|
|
55
60
|
};
|
|
56
61
|
```
|
|
@@ -60,10 +65,13 @@ npm install --save videojs-mobile-ui
|
|
|
60
65
|
- *fullscreen.enterOnRotate* `boolean` Whether to go fullscreen when rotating to landscape
|
|
61
66
|
- *fullscreen.exitOnRotate* `boolean` Whether to leave fullscreen when rotating to portrait (if not locked)
|
|
62
67
|
- *fullscreen.lockOnRotate* `boolean` Whether to lock to fullscreen when rotating to landscape
|
|
68
|
+
- *fullscreen.lockToLandscapeOnEnter* `boolean` Whether to lock to landscape when entering fullscreen (works even when device rotation is disabled/non-functional)
|
|
63
69
|
- *fullscreen.iOS* `boolean` Whether to use fake fullscreen on iOS (needed for controls to work)
|
|
70
|
+
- *fullscreen.disabled* `boolean` If true no fullscreen handling except the *deprecated* iOS fullwindow hack
|
|
64
71
|
- *touchControls.seekSeconds* `int` Seconds to seek when double-tapping
|
|
65
72
|
- *touchControls.tapTimeout* `int` Milliseconds to consider a double-tap
|
|
66
73
|
- *touchControls.disableOnEnd* `boolean` Whether to disable touch controls when the video has ended, e.g. if an endscreen is used. Automatically disables if the endscreen plugin is present when this plugin initialises
|
|
74
|
+
- *touchControls.disableOnEnd* `boolean` If true no touch controls are added.
|
|
67
75
|
|
|
68
76
|
## Usage
|
|
69
77
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @name videojs-mobile-ui @version 0.
|
|
1
|
+
/*! @name videojs-mobile-ui @version 0.8.0 @license MIT */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var videojs = require('video.js');
|
|
@@ -11,7 +11,7 @@ var videojs__default = /*#__PURE__*/_interopDefaultLegacy(videojs);
|
|
|
11
11
|
var _inheritsLoose__default = /*#__PURE__*/_interopDefaultLegacy(_inheritsLoose);
|
|
12
12
|
var window__default = /*#__PURE__*/_interopDefaultLegacy(window);
|
|
13
13
|
|
|
14
|
-
var version = "0.
|
|
14
|
+
var version = "0.8.0";
|
|
15
15
|
|
|
16
16
|
var Component = videojs__default['default'].getComponent('Component');
|
|
17
17
|
var dom = videojs__default['default'].dom || videojs__default['default'];
|
|
@@ -183,6 +183,7 @@ var defaults = {
|
|
|
183
183
|
enterOnRotate: true,
|
|
184
184
|
exitOnRotate: true,
|
|
185
185
|
lockOnRotate: true,
|
|
186
|
+
lockToLandscapeOnEnter: false,
|
|
186
187
|
iOS: false,
|
|
187
188
|
disabled: false
|
|
188
189
|
},
|
|
@@ -283,7 +284,7 @@ var onPlayerReady = function onPlayerReady(player, options) {
|
|
|
283
284
|
if (player.paused() === false) {
|
|
284
285
|
player.requestFullscreen();
|
|
285
286
|
|
|
286
|
-
if (options.fullscreen.lockOnRotate && screen.orientation && screen.orientation.lock) {
|
|
287
|
+
if ((options.fullscreen.lockOnRotate || options.fullscreen.lockToLandscapeOnEnter) && screen.orientation && screen.orientation.lock) {
|
|
287
288
|
screen.orientation.lock('landscape').then(function () {
|
|
288
289
|
locked = true;
|
|
289
290
|
}).catch(function (e) {
|
|
@@ -311,15 +312,20 @@ var onPlayerReady = function onPlayerReady(player, options) {
|
|
|
311
312
|
screen.orientation.onchange = null;
|
|
312
313
|
});
|
|
313
314
|
}
|
|
314
|
-
|
|
315
|
-
player.on('fullscreenchange', function (_) {
|
|
316
|
-
if (!player.isFullscreen() && locked) {
|
|
317
|
-
screen.orientation.unlock();
|
|
318
|
-
locked = false;
|
|
319
|
-
}
|
|
320
|
-
});
|
|
321
315
|
}
|
|
322
316
|
|
|
317
|
+
player.on('fullscreenchange', function (_) {
|
|
318
|
+
if (player.isFullscreen() && options.fullscreen.lockToLandscapeOnEnter && getOrientation() === 'portrait') {
|
|
319
|
+
screen.orientation.lock('landscape').then(function () {
|
|
320
|
+
locked = true;
|
|
321
|
+
}).catch(function (e) {
|
|
322
|
+
videojs__default['default'].log('Browser refused orientation lock:', e);
|
|
323
|
+
});
|
|
324
|
+
} else if (!player.isFullscreen() && locked) {
|
|
325
|
+
screen.orientation.unlock();
|
|
326
|
+
locked = false;
|
|
327
|
+
}
|
|
328
|
+
});
|
|
323
329
|
player.on('ended', function (_) {
|
|
324
330
|
if (locked === true) {
|
|
325
331
|
screen.orientation.unlock();
|
|
@@ -347,6 +353,9 @@ var onPlayerReady = function onPlayerReady(player, options) {
|
|
|
347
353
|
* Whether to leave fullscreen when rotating to portrait (if not locked)
|
|
348
354
|
* @param {boolean} [options.fullscreen.lockOnRotate=true]
|
|
349
355
|
* Whether to lock orientation when rotating to landscape
|
|
356
|
+
* Unlocked when exiting fullscreen or on 'ended
|
|
357
|
+
* @param {boolean} [options.fullscreen.lockToLandscapeOnEnter=false]
|
|
358
|
+
* Whether to always lock orientation to landscape on fullscreen mode
|
|
350
359
|
* Unlocked when exiting fullscreen or on 'ended'
|
|
351
360
|
* @param {boolean} [options.fullscreen.iOS=false]
|
|
352
361
|
* Deprecated: Whether to disable iOS's native fullscreen so controls can work
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @name videojs-mobile-ui @version 0.
|
|
1
|
+
/*! @name videojs-mobile-ui @version 0.8.0 @license MIT */
|
|
2
2
|
@-webkit-keyframes fadeAndScale{0%,to{opacity:0}25%{opacity:1}}@keyframes fadeAndScale{0%,to{opacity:0}25%{opacity:1}}.video-js.vjs-has-started .vjs-touch-overlay{position:absolute;pointer-events:auto;top:0}.video-js .vjs-touch-overlay{display:block;width:100%;height:100%;pointer-events:none}.video-js .vjs-touch-overlay.skip{opacity:0;-webkit-animation:fadeAndScale .6s linear;animation:fadeAndScale .6s linear;background-repeat:no-repeat;background-position:80% center;background-size:10%;background-image:url('data:image/svg+xml;utf8,<svg fill="%23FFFFFF" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M4 18l8.5-6L4 6v12zm9-12v12l8.5-6L13 6z"/><path d="M0 0h24v24H0z" fill="none"/></svg>')}.video-js .vjs-touch-overlay.skip.reverse{background-position:20% center;background-image:url('data:image/svg+xml;utf8,<svg fill="%23FFFFFF" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M11 18V6l-8.5 6 8.5 6zm.5-6l8.5 6V6l-8.5 6z"/><path d="M0 0h24v24H0z" fill="none"/></svg>')}.video-js .vjs-touch-overlay .vjs-play-control{top:50%;left:50%;transform:translate(-50%,-50%);position:absolute;width:30%;height:80%;pointer-events:none;opacity:0;transition:opacity .3s ease}.video-js .vjs-touch-overlay .vjs-play-control .vjs-icon-placeholder::before{content:'';background-size:60%;background-position:center center;background-repeat:no-repeat;background-image:url('data:image/svg+xml;utf8,<svg fill="%23FFFFFF" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/><path d="M0 0h24v24H0z" fill="none"/></svg>')}.video-js .vjs-touch-overlay .vjs-play-control.vjs-paused .vjs-icon-placeholder::before{content:'';background-image:url('data:image/svg+xml;utf8,<svg fill="%23FFFFFF" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M8 5v14l11-7z"/><path d="M0 0h24v24H0z" fill="none"/></svg>')}.video-js .vjs-touch-overlay .vjs-play-control.vjs-ended .vjs-icon-placeholder::before{content:'';background-image:url('data:image/svg+xml;utf8,<svg fill="%23FFFFFF" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z"/></svg>')}.video-js .vjs-touch-overlay.show-play-toggle .vjs-play-control{opacity:1;pointer-events:auto}.video-js.vjs-mobile-ui-disable-end.vjs-ended .vjs-touch-overlay{display:none}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/*! @name videojs-mobile-ui @version 0.
|
|
1
|
+
/*! @name videojs-mobile-ui @version 0.8.0 @license MIT */
|
|
2
2
|
import videojs from 'video.js';
|
|
3
3
|
import _inheritsLoose from '@babel/runtime/helpers/inheritsLoose';
|
|
4
4
|
import window from 'global/window';
|
|
5
5
|
|
|
6
|
-
var version = "0.
|
|
6
|
+
var version = "0.8.0";
|
|
7
7
|
|
|
8
8
|
var Component = videojs.getComponent('Component');
|
|
9
9
|
var dom = videojs.dom || videojs;
|
|
@@ -175,6 +175,7 @@ var defaults = {
|
|
|
175
175
|
enterOnRotate: true,
|
|
176
176
|
exitOnRotate: true,
|
|
177
177
|
lockOnRotate: true,
|
|
178
|
+
lockToLandscapeOnEnter: false,
|
|
178
179
|
iOS: false,
|
|
179
180
|
disabled: false
|
|
180
181
|
},
|
|
@@ -275,7 +276,7 @@ var onPlayerReady = function onPlayerReady(player, options) {
|
|
|
275
276
|
if (player.paused() === false) {
|
|
276
277
|
player.requestFullscreen();
|
|
277
278
|
|
|
278
|
-
if (options.fullscreen.lockOnRotate && screen.orientation && screen.orientation.lock) {
|
|
279
|
+
if ((options.fullscreen.lockOnRotate || options.fullscreen.lockToLandscapeOnEnter) && screen.orientation && screen.orientation.lock) {
|
|
279
280
|
screen.orientation.lock('landscape').then(function () {
|
|
280
281
|
locked = true;
|
|
281
282
|
}).catch(function (e) {
|
|
@@ -303,15 +304,20 @@ var onPlayerReady = function onPlayerReady(player, options) {
|
|
|
303
304
|
screen.orientation.onchange = null;
|
|
304
305
|
});
|
|
305
306
|
}
|
|
306
|
-
|
|
307
|
-
player.on('fullscreenchange', function (_) {
|
|
308
|
-
if (!player.isFullscreen() && locked) {
|
|
309
|
-
screen.orientation.unlock();
|
|
310
|
-
locked = false;
|
|
311
|
-
}
|
|
312
|
-
});
|
|
313
307
|
}
|
|
314
308
|
|
|
309
|
+
player.on('fullscreenchange', function (_) {
|
|
310
|
+
if (player.isFullscreen() && options.fullscreen.lockToLandscapeOnEnter && getOrientation() === 'portrait') {
|
|
311
|
+
screen.orientation.lock('landscape').then(function () {
|
|
312
|
+
locked = true;
|
|
313
|
+
}).catch(function (e) {
|
|
314
|
+
videojs.log('Browser refused orientation lock:', e);
|
|
315
|
+
});
|
|
316
|
+
} else if (!player.isFullscreen() && locked) {
|
|
317
|
+
screen.orientation.unlock();
|
|
318
|
+
locked = false;
|
|
319
|
+
}
|
|
320
|
+
});
|
|
315
321
|
player.on('ended', function (_) {
|
|
316
322
|
if (locked === true) {
|
|
317
323
|
screen.orientation.unlock();
|
|
@@ -339,6 +345,9 @@ var onPlayerReady = function onPlayerReady(player, options) {
|
|
|
339
345
|
* Whether to leave fullscreen when rotating to portrait (if not locked)
|
|
340
346
|
* @param {boolean} [options.fullscreen.lockOnRotate=true]
|
|
341
347
|
* Whether to lock orientation when rotating to landscape
|
|
348
|
+
* Unlocked when exiting fullscreen or on 'ended
|
|
349
|
+
* @param {boolean} [options.fullscreen.lockToLandscapeOnEnter=false]
|
|
350
|
+
* Whether to always lock orientation to landscape on fullscreen mode
|
|
342
351
|
* Unlocked when exiting fullscreen or on 'ended'
|
|
343
352
|
* @param {boolean} [options.fullscreen.iOS=false]
|
|
344
353
|
* Deprecated: Whether to disable iOS's native fullscreen so controls can work
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @name videojs-mobile-ui @version 0.
|
|
1
|
+
/*! @name videojs-mobile-ui @version 0.8.0 @license MIT */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('video.js'), require('global/window')) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['video.js', 'global/window'], factory) :
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
var videojs__default = /*#__PURE__*/_interopDefaultLegacy(videojs);
|
|
11
11
|
var window__default = /*#__PURE__*/_interopDefaultLegacy(window);
|
|
12
12
|
|
|
13
|
-
var version = "0.
|
|
13
|
+
var version = "0.8.0";
|
|
14
14
|
|
|
15
15
|
function createCommonjsModule(fn, basedir, module) {
|
|
16
16
|
return module = {
|
|
@@ -222,6 +222,7 @@
|
|
|
222
222
|
enterOnRotate: true,
|
|
223
223
|
exitOnRotate: true,
|
|
224
224
|
lockOnRotate: true,
|
|
225
|
+
lockToLandscapeOnEnter: false,
|
|
225
226
|
iOS: false,
|
|
226
227
|
disabled: false
|
|
227
228
|
},
|
|
@@ -322,7 +323,7 @@
|
|
|
322
323
|
if (player.paused() === false) {
|
|
323
324
|
player.requestFullscreen();
|
|
324
325
|
|
|
325
|
-
if (options.fullscreen.lockOnRotate && screen.orientation && screen.orientation.lock) {
|
|
326
|
+
if ((options.fullscreen.lockOnRotate || options.fullscreen.lockToLandscapeOnEnter) && screen.orientation && screen.orientation.lock) {
|
|
326
327
|
screen.orientation.lock('landscape').then(function () {
|
|
327
328
|
locked = true;
|
|
328
329
|
}).catch(function (e) {
|
|
@@ -350,15 +351,20 @@
|
|
|
350
351
|
screen.orientation.onchange = null;
|
|
351
352
|
});
|
|
352
353
|
}
|
|
353
|
-
|
|
354
|
-
player.on('fullscreenchange', function (_) {
|
|
355
|
-
if (!player.isFullscreen() && locked) {
|
|
356
|
-
screen.orientation.unlock();
|
|
357
|
-
locked = false;
|
|
358
|
-
}
|
|
359
|
-
});
|
|
360
354
|
}
|
|
361
355
|
|
|
356
|
+
player.on('fullscreenchange', function (_) {
|
|
357
|
+
if (player.isFullscreen() && options.fullscreen.lockToLandscapeOnEnter && getOrientation() === 'portrait') {
|
|
358
|
+
screen.orientation.lock('landscape').then(function () {
|
|
359
|
+
locked = true;
|
|
360
|
+
}).catch(function (e) {
|
|
361
|
+
videojs__default['default'].log('Browser refused orientation lock:', e);
|
|
362
|
+
});
|
|
363
|
+
} else if (!player.isFullscreen() && locked) {
|
|
364
|
+
screen.orientation.unlock();
|
|
365
|
+
locked = false;
|
|
366
|
+
}
|
|
367
|
+
});
|
|
362
368
|
player.on('ended', function (_) {
|
|
363
369
|
if (locked === true) {
|
|
364
370
|
screen.orientation.unlock();
|
|
@@ -386,6 +392,9 @@
|
|
|
386
392
|
* Whether to leave fullscreen when rotating to portrait (if not locked)
|
|
387
393
|
* @param {boolean} [options.fullscreen.lockOnRotate=true]
|
|
388
394
|
* Whether to lock orientation when rotating to landscape
|
|
395
|
+
* Unlocked when exiting fullscreen or on 'ended
|
|
396
|
+
* @param {boolean} [options.fullscreen.lockToLandscapeOnEnter=false]
|
|
397
|
+
* Whether to always lock orientation to landscape on fullscreen mode
|
|
389
398
|
* Unlocked when exiting fullscreen or on 'ended'
|
|
390
399
|
* @param {boolean} [options.fullscreen.iOS=false]
|
|
391
400
|
* Deprecated: Whether to disable iOS's native fullscreen so controls can work
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @name videojs-mobile-ui @version 0.
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("video.js"),require("global/window")):"function"==typeof define&&define.amd?define(["video.js","global/window"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).videojsMobileUi=t(e.videojs,e.window)}(this,(function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(e),i=n(t);function r(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var a=r((function(e){function t(n,o){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.default=e.exports,e.exports.__esModule=!0,t(n,o)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0})),l=r((function(e){e.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,a(e,t)},e.exports.default=e.exports,e.exports.__esModule=!0})),s=o.default.getComponent("Component"),u=o.default.dom||o.default,
|
|
1
|
+
/*! @name videojs-mobile-ui @version 0.8.0 @license MIT */
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("video.js"),require("global/window")):"function"==typeof define&&define.amd?define(["video.js","global/window"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).videojsMobileUi=t(e.videojs,e.window)}(this,(function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(e),i=n(t);function r(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var a=r((function(e){function t(n,o){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.default=e.exports,e.exports.__esModule=!0,t(n,o)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0})),l=r((function(e){e.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,a(e,t)},e.exports.default=e.exports,e.exports.__esModule=!0})),s=o.default.getComponent("Component"),u=o.default.dom||o.default,c=function(e){function t(t,n){var o;return(o=e.call(this,t,n)||this).seekSeconds=n.seekSeconds,o.tapTimeout=n.tapTimeout,o.addChild("playToggle",{}),t.on(["playing","userinactive"],(function(e){o.removeClass("show-play-toggle")})),0===o.player_.options_.inactivityTimeout&&(o.player_.options_.inactivityTimeout=5e3),o.enable(),o}l(t,e);var n=t.prototype;return n.createEl=function(){return u.createEl("div",{className:"vjs-touch-overlay",tabIndex:-1})},n.handleTap=function(e){var t=this;e.target===this.el_&&(e.preventDefault(),this.firstTapCaptured?(this.firstTapCaptured=!1,this.timeout&&i.default.clearTimeout(this.timeout),this.handleDoubleTap(e)):(this.firstTapCaptured=!0,this.timeout=i.default.setTimeout((function(){t.firstTapCaptured=!1,t.handleSingleTap(e)}),this.tapTimeout)))},n.handleSingleTap=function(e){this.removeClass("skip"),this.toggleClass("show-play-toggle")},n.handleDoubleTap=function(e){var t=this,n=this.el_.getBoundingClientRect(),o=e.changedTouches[0].clientX-n.left;if(o<.4*n.width)this.player_.currentTime(Math.max(0,this.player_.currentTime()-this.seekSeconds)),this.addClass("reverse");else{if(!(o>n.width-.4*n.width))return;this.player_.currentTime(Math.min(this.player_.duration(),this.player_.currentTime()+this.seekSeconds)),this.removeClass("reverse")}this.removeClass("show-play-toggle"),this.removeClass("skip"),i.default.requestAnimationFrame((function(){t.addClass("skip")}))},n.enable=function(){this.firstTapCaptured=!1,this.on("touchend",this.handleTap)},n.disable=function(){this.off("touchend",this.handleTap)},t}(s);s.registerComponent("TouchOverlay",c);var d={fullscreen:{enterOnRotate:!0,exitOnRotate:!0,lockOnRotate:!0,lockToLandscapeOnEnter:!1,iOS:!1,disabled:!1},touchControls:{seekSeconds:10,tapTimeout:300,disableOnEnd:!1,disabled:!1}},f=i.default.screen,p=function(){if(f){var e=((f.orientation||{}).type||f.mozOrientation||f.msOrientation||"").split("-")[0];if("landscape"===e||"portrait"===e)return e}return"number"==typeof i.default.orientation?0===i.default.orientation||180===i.default.orientation?"portrait":"landscape":"portrait"},h=o.default.registerPlugin||o.default.plugin,m=function(e){var t=this;void 0===e&&(e={}),(e.forceForTesting||o.default.browser.IS_ANDROID||o.default.browser.IS_IOS)&&this.ready((function(){!function(e,t){if(e.addClass("vjs-mobile-ui"),t.fullscreen.iOS&&(o.default.log.warn("videojs-mobile-ui: `fullscreen.iOS` is deprecated. Use Video.js option `preferFullWindow` instead."),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})),!t.touchControls.disabled){var n;(t.touchControls.disableOnEnd||"function"==typeof e.endscreen)&&e.addClass("vjs-mobile-ui-disable-end");var r=o.default.VERSION.split("."),a=parseInt(r[0],10),l=parseInt(r[1],10);n=a<7||7===a&&l<7?Array.prototype.indexOf.call(e.el_.children,e.getChild("ControlBar").el_):e.children_.indexOf(e.getChild("ControlBar")),e.touchOverlay=e.addChild("TouchOverlay",t.touchControls,n)}if(!t.fullscreen.disabled){var s=!1,u=function(){var n=p();"landscape"===n&&t.fullscreen.enterOnRotate?!1===e.paused()&&(e.requestFullscreen(),(t.fullscreen.lockOnRotate||t.fullscreen.lockToLandscapeOnEnter)&&f.orientation&&f.orientation.lock&&f.orientation.lock("landscape").then((function(){s=!0})).catch((function(e){o.default.log("Browser refused orientation lock:",e)}))):"portrait"===n&&t.fullscreen.exitOnRotate&&!s&&e.isFullscreen()&&e.exitFullscreen()};(t.fullscreen.enterOnRotate||t.fullscreen.exitOnRotate)&&(o.default.browser.IS_IOS?(i.default.addEventListener("orientationchange",u),e.on("dispose",(function(){i.default.removeEventListener("orientationchange",u)}))):f.orientation&&(f.orientation.onchange=u,e.on("dispose",(function(){f.orientation.onchange=null})))),e.on("fullscreenchange",(function(n){e.isFullscreen()&&t.fullscreen.lockToLandscapeOnEnter&&"portrait"===p()?f.orientation.lock("landscape").then((function(){s=!0})).catch((function(e){o.default.log("Browser refused orientation lock:",e)})):!e.isFullscreen()&&s&&(f.orientation.unlock(),s=!1)})),e.on("ended",(function(e){!0===s&&(f.orientation.unlock(),s=!1)}))}}(t,o.default.mergeOptions(d,e))}))};return h("mobileUi",m),m.VERSION="0.8.0",m}));
|