videojs-mobile-ui 0.8.0 → 1.0.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/README.md +4 -2
- package/dist/lang/de.js +3 -0
- package/dist/lang/en.js +1 -1
- package/dist/lang/it.js +3 -0
- package/dist/videojs-mobile-ui.cjs.js +110 -185
- package/dist/videojs-mobile-ui.css +2 -2
- package/dist/videojs-mobile-ui.es.js +110 -184
- package/dist/videojs-mobile-ui.js +117 -231
- package/dist/videojs-mobile-ui.min.js +2 -2
- package/index.html +1 -7
- package/package.json +10 -10
- package/src/plugin.css +13 -1
- package/src/plugin.js +5 -33
- package/src/touchOverlay.js +46 -56
- package/CHANGELOG.md +0 -95
- package/docs/api/TouchOverlay.html +0 -964
- package/docs/api/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/docs/api/fonts/OpenSans-Bold-webfont.svg +0 -1830
- 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 +0 -1830
- 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 +0 -1830
- 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 +0 -1831
- 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 +0 -1835
- 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 +0 -1831
- package/docs/api/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/docs/api/global.html +0 -957
- package/docs/api/index.html +0 -159
- package/docs/api/plugin.js.html +0 -221
- package/docs/api/scripts/linenumber.js +0 -25
- package/docs/api/scripts/prettify/Apache-License-2.0.txt +0 -202
- package/docs/api/scripts/prettify/lang-css.js +0 -2
- package/docs/api/scripts/prettify/prettify.js +0 -28
- package/docs/api/styles/jsdoc-default.css +0 -358
- package/docs/api/styles/prettify-jsdoc.css +0 -111
- package/docs/api/styles/prettify-tomorrow.css +0 -132
- package/docs/api/touchOverlay.js.html +0 -211
package/README.md
CHANGED
|
@@ -34,9 +34,12 @@ Fullscreen control:
|
|
|
34
34
|
## Installation
|
|
35
35
|
|
|
36
36
|
```sh
|
|
37
|
-
npm install
|
|
37
|
+
npm install video.js
|
|
38
|
+
npm install videojs-mobile-ui
|
|
38
39
|
```
|
|
39
40
|
|
|
41
|
+
Version 1.x requires video.js 8.x as a peer dependency. Lowever video.js versions are not supported. 0.7.0 supports video.js 7.x.
|
|
42
|
+
|
|
40
43
|
## Plugin Options
|
|
41
44
|
|
|
42
45
|
### Default options
|
|
@@ -66,7 +69,6 @@ npm install --save videojs-mobile-ui
|
|
|
66
69
|
- *fullscreen.exitOnRotate* `boolean` Whether to leave fullscreen when rotating to portrait (if not locked)
|
|
67
70
|
- *fullscreen.lockOnRotate* `boolean` Whether to lock to fullscreen when rotating to landscape
|
|
68
71
|
- *fullscreen.lockToLandscapeOnEnter* `boolean` Whether to lock to landscape when entering fullscreen (works even when device rotation is disabled/non-functional)
|
|
69
|
-
- *fullscreen.iOS* `boolean` Whether to use fake fullscreen on iOS (needed for controls to work)
|
|
70
72
|
- *fullscreen.disabled* `boolean` If true no fullscreen handling except the *deprecated* iOS fullwindow hack
|
|
71
73
|
- *touchControls.seekSeconds* `int` Seconds to seek when double-tapping
|
|
72
74
|
- *touchControls.tapTimeout* `int` Milliseconds to consider a double-tap
|
package/dist/lang/de.js
ADDED
package/dist/lang/en.js
CHANGED
package/dist/lang/it.js
ADDED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
/*! @name videojs-mobile-ui @version 0.
|
|
1
|
+
/*! @name videojs-mobile-ui @version 1.0.0 @license MIT */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var videojs = require('video.js');
|
|
5
|
-
var _inheritsLoose = require('@babel/runtime/helpers/inheritsLoose');
|
|
6
5
|
var window = require('global/window');
|
|
7
6
|
|
|
8
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
8
|
|
|
10
9
|
var videojs__default = /*#__PURE__*/_interopDefaultLegacy(videojs);
|
|
11
|
-
var _inheritsLoose__default = /*#__PURE__*/_interopDefaultLegacy(_inheritsLoose);
|
|
12
10
|
var window__default = /*#__PURE__*/_interopDefaultLegacy(window);
|
|
13
11
|
|
|
14
|
-
var version = "0.
|
|
12
|
+
var version = "1.0.0";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @file touchOverlay.js
|
|
16
|
+
* Touch UI component
|
|
17
|
+
*/
|
|
18
|
+
const Component = videojs__default['default'].getComponent('Component');
|
|
19
|
+
const dom = videojs__default['default'].dom || videojs__default['default'];
|
|
15
20
|
|
|
16
|
-
var Component = videojs__default['default'].getComponent('Component');
|
|
17
|
-
var dom = videojs__default['default'].dom || videojs__default['default'];
|
|
18
21
|
/**
|
|
19
22
|
* The `TouchOverlay` is an overlay to capture tap events.
|
|
20
23
|
*
|
|
21
24
|
* @extends Component
|
|
22
25
|
*/
|
|
23
|
-
|
|
24
|
-
var TouchOverlay = /*#__PURE__*/function (_Component) {
|
|
25
|
-
_inheritsLoose__default['default'](TouchOverlay, _Component);
|
|
26
|
-
|
|
26
|
+
class TouchOverlay extends Component {
|
|
27
27
|
/**
|
|
28
28
|
* Creates an instance of the this class.
|
|
29
29
|
*
|
|
@@ -33,46 +33,80 @@ var TouchOverlay = /*#__PURE__*/function (_Component) {
|
|
|
33
33
|
* @param {Object} [options]
|
|
34
34
|
* The key/value store of player options.
|
|
35
35
|
*/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
player.on(['playing', 'userinactive'],
|
|
47
|
-
|
|
48
|
-
});
|
|
36
|
+
constructor(player, options) {
|
|
37
|
+
super(player, options);
|
|
38
|
+
this.seekSeconds = options.seekSeconds;
|
|
39
|
+
this.tapTimeout = options.tapTimeout;
|
|
40
|
+
this.taps = 0;
|
|
41
|
+
|
|
42
|
+
// Add play toggle overlay
|
|
43
|
+
this.addChild('playToggle', {});
|
|
44
|
+
|
|
45
|
+
// Clear overlay when playback starts or with control fade
|
|
46
|
+
player.on(['playing', 'userinactive'], e => {
|
|
47
|
+
this.removeClass('show-play-toggle');
|
|
48
|
+
});
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
// A 0 inactivity timeout won't work here
|
|
51
|
+
if (this.player_.options_.inactivityTimeout === 0) {
|
|
52
|
+
this.player_.options_.inactivityTimeout = 5000;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Debounced tap handler.
|
|
57
|
+
* Seeks number of (taps - 1) * configured seconds to skip.
|
|
58
|
+
* One tap is a non-op
|
|
59
|
+
*
|
|
60
|
+
* @param {Event} event
|
|
61
|
+
*/
|
|
62
|
+
this.handleTaps_ = videojs__default['default'].fn.debounce(event => {
|
|
63
|
+
const increment = (this.taps - 1) * this.seekSeconds;
|
|
64
|
+
this.taps = 0;
|
|
65
|
+
if (increment < 1) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const rect = this.el_.getBoundingClientRect();
|
|
69
|
+
const x = event.changedTouches[0].clientX - rect.left;
|
|
70
|
+
|
|
71
|
+
// Check if double tap is in left or right area
|
|
72
|
+
if (x < rect.width * 0.4) {
|
|
73
|
+
this.player_.currentTime(Math.max(0, this.player_.currentTime() - increment));
|
|
74
|
+
this.addClass('reverse');
|
|
75
|
+
} else if (x > rect.width - rect.width * 0.4) {
|
|
76
|
+
this.player_.currentTime(Math.min(this.player_.duration(), this.player_.currentTime() + increment));
|
|
77
|
+
this.removeClass('reverse');
|
|
78
|
+
} else {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
55
81
|
|
|
56
|
-
|
|
82
|
+
// Remove play toggle if showing
|
|
83
|
+
this.removeClass('show-play-toggle');
|
|
84
|
+
|
|
85
|
+
// Remove and readd class to trigger animation
|
|
86
|
+
this.setAttribute('data-skip-text', `${increment} ${this.localize('seconds')}`);
|
|
87
|
+
this.removeClass('skip');
|
|
88
|
+
window__default['default'].requestAnimationFrame(() => {
|
|
89
|
+
this.addClass('skip');
|
|
90
|
+
});
|
|
91
|
+
}, this.tapTimeout);
|
|
92
|
+
this.enable();
|
|
57
93
|
}
|
|
94
|
+
|
|
58
95
|
/**
|
|
59
96
|
* Builds the DOM element.
|
|
60
97
|
*
|
|
61
98
|
* @return {Element}
|
|
62
99
|
* The DOM element.
|
|
63
100
|
*/
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
var _proto = TouchOverlay.prototype;
|
|
67
|
-
|
|
68
|
-
_proto.createEl = function createEl() {
|
|
69
|
-
var el = dom.createEl('div', {
|
|
101
|
+
createEl() {
|
|
102
|
+
const el = dom.createEl('div', {
|
|
70
103
|
className: 'vjs-touch-overlay',
|
|
71
104
|
// Touch overlay is not tabbable.
|
|
72
105
|
tabIndex: -1
|
|
73
106
|
});
|
|
74
107
|
return el;
|
|
75
108
|
}
|
|
109
|
+
|
|
76
110
|
/**
|
|
77
111
|
* Debounces to either handle a delayed single tap, or a double tap
|
|
78
112
|
*
|
|
@@ -80,111 +114,44 @@ var TouchOverlay = /*#__PURE__*/function (_Component) {
|
|
|
80
114
|
* The touch event
|
|
81
115
|
*
|
|
82
116
|
*/
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
_proto.handleTap = function handleTap(event) {
|
|
86
|
-
var _this2 = this;
|
|
87
|
-
|
|
117
|
+
handleTap(event) {
|
|
88
118
|
// Don't handle taps on the play button
|
|
89
119
|
if (event.target !== this.el_) {
|
|
90
120
|
return;
|
|
91
121
|
}
|
|
92
|
-
|
|
93
122
|
event.preventDefault();
|
|
94
|
-
|
|
95
|
-
if (this.
|
|
96
|
-
this.
|
|
97
|
-
|
|
98
|
-
if (this.timeout) {
|
|
99
|
-
window__default['default'].clearTimeout(this.timeout);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
this.handleDoubleTap(event);
|
|
103
|
-
} else {
|
|
104
|
-
this.firstTapCaptured = true;
|
|
105
|
-
this.timeout = window__default['default'].setTimeout(function () {
|
|
106
|
-
_this2.firstTapCaptured = false;
|
|
107
|
-
|
|
108
|
-
_this2.handleSingleTap(event);
|
|
109
|
-
}, this.tapTimeout);
|
|
123
|
+
this.taps += 1;
|
|
124
|
+
if (this.taps === 1) {
|
|
125
|
+
this.removeClass('skip');
|
|
126
|
+
this.toggleClass('show-play-toggle');
|
|
110
127
|
}
|
|
128
|
+
this.handleTaps_(event);
|
|
111
129
|
}
|
|
112
|
-
/**
|
|
113
|
-
* Toggles display of play toggle
|
|
114
|
-
*
|
|
115
|
-
* @param {Event} event
|
|
116
|
-
* The touch event
|
|
117
|
-
*
|
|
118
|
-
*/
|
|
119
|
-
;
|
|
120
|
-
|
|
121
|
-
_proto.handleSingleTap = function handleSingleTap(event) {
|
|
122
|
-
this.removeClass('skip');
|
|
123
|
-
this.toggleClass('show-play-toggle');
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Seeks by configured number of seconds if left or right part of video double tapped
|
|
127
|
-
*
|
|
128
|
-
* @param {Event} event
|
|
129
|
-
* The touch event
|
|
130
|
-
*
|
|
131
|
-
*/
|
|
132
|
-
;
|
|
133
|
-
|
|
134
|
-
_proto.handleDoubleTap = function handleDoubleTap(event) {
|
|
135
|
-
var _this3 = this;
|
|
136
|
-
|
|
137
|
-
var rect = this.el_.getBoundingClientRect();
|
|
138
|
-
var x = event.changedTouches[0].clientX - rect.left; // Check if double tap is in left or right area
|
|
139
|
-
|
|
140
|
-
if (x < rect.width * 0.4) {
|
|
141
|
-
this.player_.currentTime(Math.max(0, this.player_.currentTime() - this.seekSeconds));
|
|
142
|
-
this.addClass('reverse');
|
|
143
|
-
} else if (x > rect.width - rect.width * 0.4) {
|
|
144
|
-
this.player_.currentTime(Math.min(this.player_.duration(), this.player_.currentTime() + this.seekSeconds));
|
|
145
|
-
this.removeClass('reverse');
|
|
146
|
-
} else {
|
|
147
|
-
return;
|
|
148
|
-
} // Remove play toggle if showing
|
|
149
130
|
|
|
150
|
-
|
|
151
|
-
this.removeClass('show-play-toggle'); // Remove and readd class to trigger animation
|
|
152
|
-
|
|
153
|
-
this.removeClass('skip');
|
|
154
|
-
window__default['default'].requestAnimationFrame(function () {
|
|
155
|
-
_this3.addClass('skip');
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
131
|
/**
|
|
159
132
|
* Enables touch handler
|
|
160
133
|
*/
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
_proto.enable = function enable() {
|
|
134
|
+
enable() {
|
|
164
135
|
this.firstTapCaptured = false;
|
|
165
136
|
this.on('touchend', this.handleTap);
|
|
166
137
|
}
|
|
138
|
+
|
|
167
139
|
/**
|
|
168
140
|
* Disables touch handler
|
|
169
141
|
*/
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
_proto.disable = function disable() {
|
|
142
|
+
disable() {
|
|
173
143
|
this.off('touchend', this.handleTap);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
return TouchOverlay;
|
|
177
|
-
}(Component);
|
|
178
|
-
|
|
144
|
+
}
|
|
145
|
+
}
|
|
179
146
|
Component.registerComponent('TouchOverlay', TouchOverlay);
|
|
180
147
|
|
|
181
|
-
|
|
148
|
+
// Default options for the plugin.
|
|
149
|
+
const defaults = {
|
|
182
150
|
fullscreen: {
|
|
183
151
|
enterOnRotate: true,
|
|
184
152
|
exitOnRotate: true,
|
|
185
153
|
lockOnRotate: true,
|
|
186
154
|
lockToLandscapeOnEnter: false,
|
|
187
|
-
iOS: false,
|
|
188
155
|
disabled: false
|
|
189
156
|
},
|
|
190
157
|
touchControls: {
|
|
@@ -194,37 +161,32 @@ var defaults = {
|
|
|
194
161
|
disabled: false
|
|
195
162
|
}
|
|
196
163
|
};
|
|
197
|
-
|
|
164
|
+
const screen = window__default['default'].screen;
|
|
165
|
+
|
|
198
166
|
/**
|
|
199
167
|
* Gets 'portrait' or 'lanscape' from the two orientation APIs
|
|
200
168
|
*
|
|
201
169
|
* @return {string} orientation
|
|
202
170
|
*/
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
if (screen) {
|
|
171
|
+
const getOrientation = () => {
|
|
172
|
+
if (window__default['default'].screen) {
|
|
206
173
|
// Prefer the string over angle, as 0° can be landscape on some tablets
|
|
207
|
-
|
|
208
|
-
|
|
174
|
+
const orientationString = ((window__default['default'].screen.orientation || {}).type || window__default['default'].screen.mozOrientation || window__default['default'].screen.msOrientation || '').split('-')[0];
|
|
209
175
|
if (orientationString === 'landscape' || orientationString === 'portrait') {
|
|
210
176
|
return orientationString;
|
|
211
177
|
}
|
|
212
|
-
}
|
|
213
|
-
|
|
178
|
+
}
|
|
214
179
|
|
|
180
|
+
// iOS only supports window.orientation
|
|
215
181
|
if (typeof window__default['default'].orientation === 'number') {
|
|
216
182
|
if (window__default['default'].orientation === 0 || window__default['default'].orientation === 180) {
|
|
217
183
|
return 'portrait';
|
|
218
184
|
}
|
|
219
|
-
|
|
220
185
|
return 'landscape';
|
|
221
186
|
}
|
|
222
|
-
|
|
223
187
|
return 'portrait';
|
|
224
|
-
};
|
|
225
|
-
|
|
188
|
+
};
|
|
226
189
|
|
|
227
|
-
var registerPlugin = videojs__default['default'].registerPlugin || videojs__default['default'].plugin;
|
|
228
190
|
/**
|
|
229
191
|
* Add UI and event listeners
|
|
230
192
|
*
|
|
@@ -235,59 +197,30 @@ var registerPlugin = videojs__default['default'].registerPlugin || videojs__defa
|
|
|
235
197
|
* @param {Object} [options={}]
|
|
236
198
|
* A plain object containing options for the plugin.
|
|
237
199
|
*/
|
|
238
|
-
|
|
239
|
-
var onPlayerReady = function onPlayerReady(player, options) {
|
|
200
|
+
const onPlayerReady = (player, options) => {
|
|
240
201
|
player.addClass('vjs-mobile-ui');
|
|
241
|
-
|
|
242
|
-
if (options.fullscreen.iOS) {
|
|
243
|
-
videojs__default['default'].log.warn('videojs-mobile-ui: `fullscreen.iOS` is deprecated. Use Video.js option `preferFullWindow` instead.');
|
|
244
|
-
|
|
245
|
-
if (videojs__default['default'].browser.IS_IOS && videojs__default['default'].browser.IOS_VERSION > 9 && !player.el_.ownerDocument.querySelector('.bc-iframe')) {
|
|
246
|
-
player.tech_.el_.setAttribute('playsinline', 'playsinline');
|
|
247
|
-
|
|
248
|
-
player.tech_.supportsFullScreen = function () {
|
|
249
|
-
return false;
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
202
|
if (!options.touchControls.disabled) {
|
|
255
203
|
if (options.touchControls.disableOnEnd || typeof player.endscreen === 'function') {
|
|
256
204
|
player.addClass('vjs-mobile-ui-disable-end');
|
|
257
|
-
} // Insert before the control bar
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
var controlBarIdx;
|
|
261
|
-
var versionParts = videojs__default['default'].VERSION.split('.');
|
|
262
|
-
var major = parseInt(versionParts[0], 10);
|
|
263
|
-
var minor = parseInt(versionParts[1], 10); // Video.js < 7.7.0 doesn't account for precedding components that don't have elements
|
|
264
|
-
|
|
265
|
-
if (major < 7 || major === 7 && minor < 7) {
|
|
266
|
-
controlBarIdx = Array.prototype.indexOf.call(player.el_.children, player.getChild('ControlBar').el_);
|
|
267
|
-
} else {
|
|
268
|
-
controlBarIdx = player.children_.indexOf(player.getChild('ControlBar'));
|
|
269
205
|
}
|
|
270
206
|
|
|
207
|
+
// Insert before the control bar
|
|
208
|
+
const controlBarIdx = player.children_.indexOf(player.getChild('ControlBar'));
|
|
271
209
|
player.touchOverlay = player.addChild('TouchOverlay', options.touchControls, controlBarIdx);
|
|
272
210
|
}
|
|
273
|
-
|
|
274
211
|
if (options.fullscreen.disabled) {
|
|
275
212
|
return;
|
|
276
213
|
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
var rotationHandler = function rotationHandler() {
|
|
281
|
-
var currentOrientation = getOrientation();
|
|
282
|
-
|
|
214
|
+
let locked = false;
|
|
215
|
+
const rotationHandler = () => {
|
|
216
|
+
const currentOrientation = getOrientation();
|
|
283
217
|
if (currentOrientation === 'landscape' && options.fullscreen.enterOnRotate) {
|
|
284
218
|
if (player.paused() === false) {
|
|
285
219
|
player.requestFullscreen();
|
|
286
|
-
|
|
287
220
|
if ((options.fullscreen.lockOnRotate || options.fullscreen.lockToLandscapeOnEnter) && screen.orientation && screen.orientation.lock) {
|
|
288
|
-
screen.orientation.lock('landscape').then(
|
|
221
|
+
screen.orientation.lock('landscape').then(() => {
|
|
289
222
|
locked = true;
|
|
290
|
-
}).catch(
|
|
223
|
+
}).catch(e => {
|
|
291
224
|
videojs__default['default'].log('Browser refused orientation lock:', e);
|
|
292
225
|
});
|
|
293
226
|
}
|
|
@@ -298,27 +231,25 @@ var onPlayerReady = function onPlayerReady(player, options) {
|
|
|
298
231
|
}
|
|
299
232
|
}
|
|
300
233
|
};
|
|
301
|
-
|
|
302
234
|
if (options.fullscreen.enterOnRotate || options.fullscreen.exitOnRotate) {
|
|
303
235
|
if (videojs__default['default'].browser.IS_IOS) {
|
|
304
236
|
window__default['default'].addEventListener('orientationchange', rotationHandler);
|
|
305
|
-
player.on('dispose',
|
|
237
|
+
player.on('dispose', () => {
|
|
306
238
|
window__default['default'].removeEventListener('orientationchange', rotationHandler);
|
|
307
239
|
});
|
|
308
240
|
} else if (screen.orientation) {
|
|
309
241
|
// addEventListener('orientationchange') is not a user interaction on Android
|
|
310
242
|
screen.orientation.onchange = rotationHandler;
|
|
311
|
-
player.on('dispose',
|
|
243
|
+
player.on('dispose', () => {
|
|
312
244
|
screen.orientation.onchange = null;
|
|
313
245
|
});
|
|
314
246
|
}
|
|
315
247
|
}
|
|
316
|
-
|
|
317
|
-
player.on('fullscreenchange', function (_) {
|
|
248
|
+
player.on('fullscreenchange', _ => {
|
|
318
249
|
if (player.isFullscreen() && options.fullscreen.lockToLandscapeOnEnter && getOrientation() === 'portrait') {
|
|
319
|
-
screen.orientation.lock('landscape').then(
|
|
250
|
+
screen.orientation.lock('landscape').then(() => {
|
|
320
251
|
locked = true;
|
|
321
|
-
}).catch(
|
|
252
|
+
}).catch(e => {
|
|
322
253
|
videojs__default['default'].log('Browser refused orientation lock:', e);
|
|
323
254
|
});
|
|
324
255
|
} else if (!player.isFullscreen() && locked) {
|
|
@@ -326,13 +257,14 @@ var onPlayerReady = function onPlayerReady(player, options) {
|
|
|
326
257
|
locked = false;
|
|
327
258
|
}
|
|
328
259
|
});
|
|
329
|
-
player.on('ended',
|
|
260
|
+
player.on('ended', _ => {
|
|
330
261
|
if (locked === true) {
|
|
331
262
|
screen.orientation.unlock();
|
|
332
263
|
locked = false;
|
|
333
264
|
}
|
|
334
265
|
});
|
|
335
266
|
};
|
|
267
|
+
|
|
336
268
|
/**
|
|
337
269
|
* A video.js plugin.
|
|
338
270
|
*
|
|
@@ -371,25 +303,18 @@ var onPlayerReady = function onPlayerReady(player, options) {
|
|
|
371
303
|
* Whether to disable when the video ends (e.g., if there is an endscreen)
|
|
372
304
|
* Never shows if the endscreen plugin is present
|
|
373
305
|
*/
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
var mobileUi = function mobileUi(options) {
|
|
377
|
-
var _this = this;
|
|
378
|
-
|
|
379
|
-
if (options === void 0) {
|
|
380
|
-
options = {};
|
|
381
|
-
}
|
|
382
|
-
|
|
306
|
+
const mobileUi = function (options = {}) {
|
|
383
307
|
if (options.forceForTesting || videojs__default['default'].browser.IS_ANDROID || videojs__default['default'].browser.IS_IOS) {
|
|
384
|
-
this.ready(
|
|
385
|
-
onPlayerReady(
|
|
308
|
+
this.ready(() => {
|
|
309
|
+
onPlayerReady(this, videojs__default['default'].obj.merge(defaults, options));
|
|
386
310
|
});
|
|
387
311
|
}
|
|
388
|
-
};
|
|
389
|
-
|
|
312
|
+
};
|
|
390
313
|
|
|
391
|
-
|
|
314
|
+
// Register the plugin with video.js.
|
|
315
|
+
videojs__default['default'].registerPlugin('mobileUi', mobileUi);
|
|
392
316
|
|
|
317
|
+
// Include the version number.
|
|
393
318
|
mobileUi.VERSION = version;
|
|
394
319
|
|
|
395
320
|
module.exports = mobileUi;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @name videojs-mobile-ui @version 0.
|
|
2
|
-
|
|
1
|
+
/*! @name videojs-mobile-ui @version 1.0.0 @license MIT */
|
|
2
|
+
@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;animation:fadeAndScale .8s 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:after{content:attr(data-skip-text);position:absolute;top:60%;left:70%}.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.skip.reverse:after{right:70%;left:unset}.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}
|