@vidispine/vdt-videojs 21.3.0 → 21.4.0-pre.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/lib/index.cjs.js +97 -96
- package/lib/index.esm.js +76 -75
- package/lib/index.umd.js +99 -98
- package/lib/package.json +1 -1
- package/lib/style.css +134 -49
- package/package.json +1 -1
package/lib/index.umd.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('video.js/dist/alt/video.core.min'), require('mousetrap')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', 'video.js/dist/alt/video.core.min', 'mousetrap'], factory) :
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.vdtVideojs = {}, global.videojs, global.mousetrap));
|
|
5
|
-
}(this, (function (exports, videojs, mousetrap) { 'use strict';
|
|
5
|
+
})(this, (function (exports, videojs, mousetrap) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
var mousetrap__default = /*#__PURE__*/_interopDefaultLegacy(mousetrap);
|
|
11
11
|
|
|
12
12
|
var name = "@vidispine/vdt-videojs";
|
|
13
|
-
var version = "21.
|
|
13
|
+
var version = "21.4.0-pre.1";
|
|
14
14
|
var license = "UNLICENSED";
|
|
15
15
|
var main = "lib/index.cjs.js";
|
|
16
16
|
var module = "lib/index.es.js";
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
vendor: pkgInfo.name.split('/')[0],
|
|
164
164
|
});
|
|
165
165
|
|
|
166
|
-
const constants = Object.freeze({
|
|
166
|
+
const constants$2 = Object.freeze({
|
|
167
167
|
defaults,
|
|
168
168
|
settings,
|
|
169
169
|
classNames,
|
|
@@ -249,13 +249,13 @@
|
|
|
249
249
|
let className;
|
|
250
250
|
|
|
251
251
|
switch (feedbackType) {
|
|
252
|
-
case constants.osd.pause:
|
|
252
|
+
case constants$2.osd.pause:
|
|
253
253
|
className = 'pause';
|
|
254
254
|
break;
|
|
255
|
-
case constants.osd.play:
|
|
255
|
+
case constants$2.osd.play:
|
|
256
256
|
className = 'play';
|
|
257
257
|
break;
|
|
258
|
-
case constants.osd.volchange:
|
|
258
|
+
case constants$2.osd.volchange:
|
|
259
259
|
const currentVolumeLevel = details.volume;
|
|
260
260
|
let perceivedVolumeLevel; // 'low' | 'mid' | 'high' string to utilize video js eisting icons
|
|
261
261
|
|
|
@@ -272,10 +272,10 @@
|
|
|
272
272
|
|
|
273
273
|
className = `volchange ${perceivedVolumeLevel}`;
|
|
274
274
|
break;
|
|
275
|
-
case constants.osd.jumpForward:
|
|
275
|
+
case constants$2.osd.jumpForward:
|
|
276
276
|
className = 'forward-jump';
|
|
277
277
|
break;
|
|
278
|
-
case constants.osd.jumpBackward:
|
|
278
|
+
case constants$2.osd.jumpBackward:
|
|
279
279
|
className = 'backward-jump';
|
|
280
280
|
break;
|
|
281
281
|
}
|
|
@@ -656,7 +656,7 @@
|
|
|
656
656
|
this.container.classList.add('active');
|
|
657
657
|
this.state.active = true;
|
|
658
658
|
|
|
659
|
-
mousetrap__default[
|
|
659
|
+
mousetrap__default["default"].bind('esc', () => { this.hide(); });
|
|
660
660
|
|
|
661
661
|
this.props.onToggle && this.props.onToggle(true);
|
|
662
662
|
}
|
|
@@ -667,7 +667,7 @@
|
|
|
667
667
|
this.container.classList.remove('active');
|
|
668
668
|
this.state.active = false;
|
|
669
669
|
|
|
670
|
-
mousetrap__default[
|
|
670
|
+
mousetrap__default["default"].unbind('esc');
|
|
671
671
|
|
|
672
672
|
this.props.onToggle && this.props.onToggle(false);
|
|
673
673
|
}
|
|
@@ -702,7 +702,7 @@
|
|
|
702
702
|
});
|
|
703
703
|
|
|
704
704
|
|
|
705
|
-
const CSS = () => `
|
|
705
|
+
const CSS$2 = () => `
|
|
706
706
|
.${constants$1.menuClassName}{
|
|
707
707
|
position: relative;
|
|
708
708
|
height: 100%;
|
|
@@ -905,7 +905,7 @@
|
|
|
905
905
|
// attach styles
|
|
906
906
|
this.style = document.createElement('style');
|
|
907
907
|
this.style.type = 'text/css';
|
|
908
|
-
this.style.innerHTML = CSS();
|
|
908
|
+
this.style.innerHTML = CSS$2();
|
|
909
909
|
this.shadow.appendChild(this.style);
|
|
910
910
|
}
|
|
911
911
|
}
|
|
@@ -967,7 +967,7 @@
|
|
|
967
967
|
|
|
968
968
|
this.handleClicksWhenMenuOpenedTimeout = setTimeout(() => {
|
|
969
969
|
document.addEventListener('click', this.handleClicksWhenMenuOpened);
|
|
970
|
-
mousetrap__default[
|
|
970
|
+
mousetrap__default["default"].bind('esc', this.close.bind(this)); // esc closes menu aswell
|
|
971
971
|
}, constants$1.animationLength);
|
|
972
972
|
}
|
|
973
973
|
|
|
@@ -980,7 +980,7 @@
|
|
|
980
980
|
|
|
981
981
|
this.props.onClose && this.props.onClose();
|
|
982
982
|
|
|
983
|
-
mousetrap__default[
|
|
983
|
+
mousetrap__default["default"].unbind('esc');
|
|
984
984
|
}
|
|
985
985
|
|
|
986
986
|
toggle() {
|
|
@@ -1050,7 +1050,7 @@
|
|
|
1050
1050
|
|
|
1051
1051
|
/* eslint-disable max-len */
|
|
1052
1052
|
|
|
1053
|
-
const constants
|
|
1053
|
+
const constants = Object.freeze({
|
|
1054
1054
|
className: 'vdt-seekbar',
|
|
1055
1055
|
defaults: {
|
|
1056
1056
|
bgColor: '#fafafa',
|
|
@@ -1067,7 +1067,7 @@
|
|
|
1067
1067
|
});
|
|
1068
1068
|
|
|
1069
1069
|
const CSS$1 = (bgColor, fillColor) => `
|
|
1070
|
-
.${constants
|
|
1070
|
+
.${constants.className}{
|
|
1071
1071
|
user-select: none;
|
|
1072
1072
|
background: ${colors.light};
|
|
1073
1073
|
height: 6px;
|
|
@@ -1077,7 +1077,7 @@
|
|
|
1077
1077
|
z-index: 5;
|
|
1078
1078
|
}
|
|
1079
1079
|
|
|
1080
|
-
.${classNames.onDark}.${constants
|
|
1080
|
+
.${classNames.onDark}.${constants.className}{
|
|
1081
1081
|
background: ${colors.gray};
|
|
1082
1082
|
}
|
|
1083
1083
|
|
|
@@ -1088,7 +1088,7 @@
|
|
|
1088
1088
|
left: 0px;
|
|
1089
1089
|
top: 0px;
|
|
1090
1090
|
background: ${fillColor};
|
|
1091
|
-
transition: width ${constants
|
|
1091
|
+
transition: width ${constants.defaults.transitionTime}ms linear;
|
|
1092
1092
|
z-index: 2;
|
|
1093
1093
|
}
|
|
1094
1094
|
|
|
@@ -1099,11 +1099,11 @@
|
|
|
1099
1099
|
transition: none;
|
|
1100
1100
|
}
|
|
1101
1101
|
|
|
1102
|
-
.${classNames.onDark}.${constants
|
|
1102
|
+
.${classNames.onDark}.${constants.className} .load-indicator{
|
|
1103
1103
|
background: white;
|
|
1104
1104
|
}
|
|
1105
1105
|
|
|
1106
|
-
.${constants
|
|
1106
|
+
.${constants.className}.dragging .fill{
|
|
1107
1107
|
transition: none;
|
|
1108
1108
|
}
|
|
1109
1109
|
|
|
@@ -1119,7 +1119,7 @@
|
|
|
1119
1119
|
}
|
|
1120
1120
|
|
|
1121
1121
|
.marker{
|
|
1122
|
-
transition: opacity ${constants
|
|
1122
|
+
transition: opacity ${constants.defaults.transitionTime}ms linear;
|
|
1123
1123
|
}
|
|
1124
1124
|
|
|
1125
1125
|
.marker{ display: none; }
|
|
@@ -1128,7 +1128,7 @@
|
|
|
1128
1128
|
.marker .handle{
|
|
1129
1129
|
position: absolute;
|
|
1130
1130
|
bottom: 10px; right: 0px;
|
|
1131
|
-
width: ${constants
|
|
1131
|
+
width: ${constants.defaults.markerWidth}px;
|
|
1132
1132
|
height: 28px;
|
|
1133
1133
|
background: #999;
|
|
1134
1134
|
border-radius: 3px;
|
|
@@ -1138,7 +1138,7 @@
|
|
|
1138
1138
|
}
|
|
1139
1139
|
|
|
1140
1140
|
.marker.regional .handle{
|
|
1141
|
-
background: ${constants
|
|
1141
|
+
background: ${constants.defaults.regionAccentColor};
|
|
1142
1142
|
box-shadow: -2px 1px 1px rgba(0,0,0,.1);
|
|
1143
1143
|
}
|
|
1144
1144
|
|
|
@@ -1157,13 +1157,13 @@
|
|
|
1157
1157
|
}
|
|
1158
1158
|
|
|
1159
1159
|
.handle:active{
|
|
1160
|
-
background: ${constants
|
|
1160
|
+
background: ${constants.defaults.regionColor};
|
|
1161
1161
|
}
|
|
1162
1162
|
|
|
1163
1163
|
.region{
|
|
1164
1164
|
position: absolute;
|
|
1165
1165
|
width: auto;
|
|
1166
|
-
background: ${constants
|
|
1166
|
+
background: ${constants.defaults.regionColor};
|
|
1167
1167
|
opacity: .7;
|
|
1168
1168
|
}
|
|
1169
1169
|
|
|
@@ -1180,7 +1180,7 @@
|
|
|
1180
1180
|
bottom: 10px;
|
|
1181
1181
|
width: 16px;
|
|
1182
1182
|
border-radius: 16px;
|
|
1183
|
-
background: ${constants
|
|
1183
|
+
background: ${constants.defaults.regionAccentColor};
|
|
1184
1184
|
position: absolute;
|
|
1185
1185
|
margin-left: -8px;
|
|
1186
1186
|
transition: transform 200ms ease-out;
|
|
@@ -1256,11 +1256,11 @@
|
|
|
1256
1256
|
visibility: visible;
|
|
1257
1257
|
}
|
|
1258
1258
|
|
|
1259
|
-
.${constants
|
|
1259
|
+
.${constants.className}.dragging .bubble{
|
|
1260
1260
|
transform: scale3d(.75,.75,.75);
|
|
1261
1261
|
}
|
|
1262
1262
|
|
|
1263
|
-
.${constants
|
|
1263
|
+
.${constants.className}.hide-markers .marker{
|
|
1264
1264
|
opacity: 0;
|
|
1265
1265
|
}
|
|
1266
1266
|
|
|
@@ -1286,7 +1286,7 @@
|
|
|
1286
1286
|
reactiveSetters.apply(this); // ability to handle new props via setters
|
|
1287
1287
|
|
|
1288
1288
|
this.container = document.createElement('div');
|
|
1289
|
-
this.container.className = `${constants
|
|
1289
|
+
this.container.className = `${constants.className}-wrapper`;
|
|
1290
1290
|
|
|
1291
1291
|
this.state = {
|
|
1292
1292
|
in: null, // in seconds from 0
|
|
@@ -1306,8 +1306,8 @@
|
|
|
1306
1306
|
this.style.type = 'text/css';
|
|
1307
1307
|
|
|
1308
1308
|
// colors from props
|
|
1309
|
-
const bgColor = (this.props.bgColor) ? this.props.bgColor : constants
|
|
1310
|
-
const fillColor = (this.props.fillColor) ? this.props.fillColor : constants
|
|
1309
|
+
const bgColor = (this.props.bgColor) ? this.props.bgColor : constants.defaults.bgColor;
|
|
1310
|
+
const fillColor = (this.props.fillColor) ? this.props.fillColor : constants.defaults.fillColor;
|
|
1311
1311
|
|
|
1312
1312
|
this.style.innerHTML = CSS$1(sanitize(bgColor), sanitize(fillColor));
|
|
1313
1313
|
this.shadow.appendChild(this.style);
|
|
@@ -1386,26 +1386,26 @@
|
|
|
1386
1386
|
|
|
1387
1387
|
if (this.props.player) {
|
|
1388
1388
|
const { player } = this.props;
|
|
1389
|
-
mousetrap__default[
|
|
1389
|
+
mousetrap__default["default"].bind('i', () => {
|
|
1390
1390
|
if (this.markersEnabled) this.in = player.videojs.currentTime();
|
|
1391
1391
|
});
|
|
1392
1392
|
|
|
1393
|
-
mousetrap__default[
|
|
1393
|
+
mousetrap__default["default"].bind('o', () => {
|
|
1394
1394
|
if (this.markersEnabled) this.out = player.videojs.currentTime();
|
|
1395
1395
|
});
|
|
1396
1396
|
|
|
1397
|
-
mousetrap__default[
|
|
1397
|
+
mousetrap__default["default"].bind('shift+i', () => {
|
|
1398
1398
|
if (this.markersEnabled) this.navigateToIn();
|
|
1399
1399
|
});
|
|
1400
1400
|
|
|
1401
|
-
mousetrap__default[
|
|
1401
|
+
mousetrap__default["default"].bind('shift+o', () => {
|
|
1402
1402
|
if (this.markersEnabled) this.navigateToOut();
|
|
1403
1403
|
});
|
|
1404
1404
|
}
|
|
1405
1405
|
|
|
1406
1406
|
// bind
|
|
1407
1407
|
this.bindings.forEach((binding) => {
|
|
1408
|
-
mousetrap__default[
|
|
1408
|
+
mousetrap__default["default"].bind(binding.key, (e) => {
|
|
1409
1409
|
binding.method(e);
|
|
1410
1410
|
});
|
|
1411
1411
|
});
|
|
@@ -1413,7 +1413,7 @@
|
|
|
1413
1413
|
|
|
1414
1414
|
unbindHotKeys() {
|
|
1415
1415
|
this.bindings && this.bindings.forEach((binding) => {
|
|
1416
|
-
mousetrap__default[
|
|
1416
|
+
mousetrap__default["default"].unbind(binding.key);
|
|
1417
1417
|
});
|
|
1418
1418
|
}
|
|
1419
1419
|
|
|
@@ -1501,7 +1501,7 @@
|
|
|
1501
1501
|
|
|
1502
1502
|
draw() {
|
|
1503
1503
|
this.bar = document.createElement('div');
|
|
1504
|
-
this.bar.className = constants
|
|
1504
|
+
this.bar.className = constants.className;
|
|
1505
1505
|
this.bar.onclick = (e) => {
|
|
1506
1506
|
if (!e.target.classList.contains('marker') && !e.target.classList.contains('handle')) {
|
|
1507
1507
|
this.handleSeek(e);
|
|
@@ -1537,10 +1537,10 @@
|
|
|
1537
1537
|
|
|
1538
1538
|
drawMarkers() { // TODO - add touch events
|
|
1539
1539
|
if (this.markersEnabled) {
|
|
1540
|
-
const markerIn = this.markers[constants
|
|
1541
|
-
const markerOut = this.markers[constants
|
|
1542
|
-
markerIn.className = `marker ${constants
|
|
1543
|
-
markerOut.className = `marker ${constants
|
|
1540
|
+
const markerIn = this.markers[constants.markerTypes.in] = document.createElement('div');
|
|
1541
|
+
const markerOut = this.markers[constants.markerTypes.out] = document.createElement('div');
|
|
1542
|
+
markerIn.className = `marker ${constants.markerTypes.in}`;
|
|
1543
|
+
markerOut.className = `marker ${constants.markerTypes.out}`;
|
|
1544
1544
|
|
|
1545
1545
|
const handleIn = document.createElement('div');
|
|
1546
1546
|
const handleOut = document.createElement('div');
|
|
@@ -1550,14 +1550,14 @@
|
|
|
1550
1550
|
e.preventDefault(); // prevents selection cursor
|
|
1551
1551
|
e.stopPropagation(); // prevent triggering seek bar drag
|
|
1552
1552
|
|
|
1553
|
-
this.handleMarkerDrag(markerIn, constants
|
|
1553
|
+
this.handleMarkerDrag(markerIn, constants.markerTypes.in, e);
|
|
1554
1554
|
}, false);
|
|
1555
1555
|
|
|
1556
1556
|
handleOut.addEventListener('mousedown', (e) => {
|
|
1557
1557
|
e.preventDefault(); // prevents selection cursor
|
|
1558
1558
|
e.stopPropagation(); // prevent triggering seek bar drag
|
|
1559
1559
|
|
|
1560
|
-
this.handleMarkerDrag(markerOut, constants
|
|
1560
|
+
this.handleMarkerDrag(markerOut, constants.markerTypes.out, e);
|
|
1561
1561
|
}, false);
|
|
1562
1562
|
|
|
1563
1563
|
markerIn.appendChild(handleIn);
|
|
@@ -1589,8 +1589,8 @@
|
|
|
1589
1589
|
|
|
1590
1590
|
drawInAndOutRegion() { // triggered after drawMarkers if in + out is set
|
|
1591
1591
|
if (this.state.in !== null && this.state.out !== null) {
|
|
1592
|
-
this.region.style.left = this.markers[constants
|
|
1593
|
-
this.region.style.right = `${100 - parseFloat(this.markers[constants
|
|
1592
|
+
this.region.style.left = this.markers[constants.markerTypes.in].style.left;
|
|
1593
|
+
this.region.style.right = `${100 - parseFloat(this.markers[constants.markerTypes.out].style.left.replace('%', ''))}%`;
|
|
1594
1594
|
}
|
|
1595
1595
|
}
|
|
1596
1596
|
|
|
@@ -1607,7 +1607,7 @@
|
|
|
1607
1607
|
|
|
1608
1608
|
const drag = (e) => {
|
|
1609
1609
|
const pxDragged = Math.abs(mouseDownEvent.clientX - e.clientX);
|
|
1610
|
-
const markerOffset = (type === constants
|
|
1610
|
+
const markerOffset = (type === constants.markerTypes.in) ? (constants.defaults.markerWidth / 2) : -(constants.defaults.markerWidth / 2);
|
|
1611
1611
|
const left = e.clientX - barOffset + markerOffset;
|
|
1612
1612
|
|
|
1613
1613
|
if (left >= 0 && left < barWidth && pxDragged > 1) { // prevent out-of-bounds
|
|
@@ -1641,7 +1641,7 @@
|
|
|
1641
1641
|
jump to the time of marker in player
|
|
1642
1642
|
*/
|
|
1643
1643
|
if (!dragHappened) {
|
|
1644
|
-
if (type === constants
|
|
1644
|
+
if (type === constants.markerTypes.in) {
|
|
1645
1645
|
this.navigateToIn();
|
|
1646
1646
|
} else {
|
|
1647
1647
|
this.navigateToOut();
|
|
@@ -1664,12 +1664,12 @@
|
|
|
1664
1664
|
cleanupMarkers() {
|
|
1665
1665
|
let removedMarker = false;
|
|
1666
1666
|
if (this.state.in === null) {
|
|
1667
|
-
this.markers[constants
|
|
1667
|
+
this.markers[constants.markerTypes.in].classList.remove('active');
|
|
1668
1668
|
removedMarker = true;
|
|
1669
1669
|
}
|
|
1670
1670
|
|
|
1671
1671
|
if (this.state.out === null) {
|
|
1672
|
-
this.markers[constants
|
|
1672
|
+
this.markers[constants.markerTypes.out].classList.remove('active');
|
|
1673
1673
|
removedMarker = true;
|
|
1674
1674
|
}
|
|
1675
1675
|
|
|
@@ -1712,7 +1712,7 @@
|
|
|
1712
1712
|
if (val !== null && val !== undefined) {
|
|
1713
1713
|
const { player } = this.props;
|
|
1714
1714
|
this.updateMarkers({
|
|
1715
|
-
type: constants
|
|
1715
|
+
type: constants.markerTypes.in,
|
|
1716
1716
|
value: val / player.videojs.duration(),
|
|
1717
1717
|
});
|
|
1718
1718
|
|
|
@@ -1739,7 +1739,7 @@
|
|
|
1739
1739
|
if (val !== null && val !== undefined) {
|
|
1740
1740
|
const { player } = this.props;
|
|
1741
1741
|
this.updateMarkers({
|
|
1742
|
-
type: constants
|
|
1742
|
+
type: constants.markerTypes.out,
|
|
1743
1743
|
value: val / player.videojs.duration(),
|
|
1744
1744
|
});
|
|
1745
1745
|
|
|
@@ -1909,6 +1909,7 @@
|
|
|
1909
1909
|
class VideoTime {
|
|
1910
1910
|
constructor(props) {
|
|
1911
1911
|
if (props.frameRate === undefined) {
|
|
1912
|
+
delete this;
|
|
1912
1913
|
throw new Error('No "frameRate" option provided, refer to docs.');
|
|
1913
1914
|
} else {
|
|
1914
1915
|
this.props = props;
|
|
@@ -1983,8 +1984,8 @@
|
|
|
1983
1984
|
const classNames = [ // add conditional css classes here for the whole container
|
|
1984
1985
|
'video-js',
|
|
1985
1986
|
'vjs-big-play-centered',
|
|
1986
|
-
(this.props.posterUrl) ? constants.classNames.poster : '',
|
|
1987
|
-
(this.props.subtitles && this.props.subtitles.length > 0) ? constants.classNames.subtitles : '',
|
|
1987
|
+
(this.props.posterUrl) ? constants$2.classNames.poster : '',
|
|
1988
|
+
(this.props.subtitles && this.props.subtitles.length > 0) ? constants$2.classNames.subtitles : '',
|
|
1988
1989
|
'init', // make player height 0 while no metadata for video size available with css
|
|
1989
1990
|
];
|
|
1990
1991
|
|
|
@@ -1995,7 +1996,7 @@
|
|
|
1995
1996
|
};
|
|
1996
1997
|
|
|
1997
1998
|
this.timeConverter = new VideoTime({
|
|
1998
|
-
frameRate: this.props.frameRate || constants.defaults.frameRate,
|
|
1999
|
+
frameRate: this.props.frameRate || constants$2.defaults.frameRate,
|
|
1999
2000
|
});
|
|
2000
2001
|
|
|
2001
2002
|
/*
|
|
@@ -2067,7 +2068,7 @@
|
|
|
2067
2068
|
const controlsEnabled = (this.props.controls !== false);
|
|
2068
2069
|
const options = this.props.options || {};
|
|
2069
2070
|
|
|
2070
|
-
this.videojs = new videojs__default[
|
|
2071
|
+
this.videojs = new videojs__default["default"]('vdt-video', {
|
|
2071
2072
|
responsive: true,
|
|
2072
2073
|
fluid: true,
|
|
2073
2074
|
controls: controlsEnabled,
|
|
@@ -2078,7 +2079,7 @@
|
|
|
2078
2079
|
durationDisplay: showDefaultTimeDisplay,
|
|
2079
2080
|
currentTimeDisplay: showDefaultTimeDisplay,
|
|
2080
2081
|
},
|
|
2081
|
-
inactivityTimeout: (this.audioOnly) ? constants.defaults.audioInactivityTimeout : constants.defaults.inactivityTimeout,
|
|
2082
|
+
inactivityTimeout: (this.audioOnly) ? constants$2.defaults.audioInactivityTimeout : constants$2.defaults.inactivityTimeout,
|
|
2082
2083
|
preload: 'auto',
|
|
2083
2084
|
captionsButton: false,
|
|
2084
2085
|
subsCapsButton: false,
|
|
@@ -2167,8 +2168,8 @@
|
|
|
2167
2168
|
this.videojs.pause();
|
|
2168
2169
|
},
|
|
2169
2170
|
onInputBlur: () => {
|
|
2170
|
-
this.videojs.options().inactivityTimeout = constants.defaults.inactivityTimeout;
|
|
2171
|
-
this.videojs.cache_.inactivityTimeout = constants.defaults.inactivityTimeout;
|
|
2171
|
+
this.videojs.options().inactivityTimeout = constants$2.defaults.inactivityTimeout;
|
|
2172
|
+
this.videojs.cache_.inactivityTimeout = constants$2.defaults.inactivityTimeout;
|
|
2172
2173
|
},
|
|
2173
2174
|
};
|
|
2174
2175
|
|
|
@@ -2326,7 +2327,7 @@
|
|
|
2326
2327
|
|
|
2327
2328
|
// bind
|
|
2328
2329
|
this.bindings.forEach((binding) => {
|
|
2329
|
-
mousetrap__default[
|
|
2330
|
+
mousetrap__default["default"].bind(binding.key, (e) => {
|
|
2330
2331
|
binding.method(e);
|
|
2331
2332
|
this.onHotkeyPressed(binding.key);
|
|
2332
2333
|
});
|
|
@@ -2335,13 +2336,13 @@
|
|
|
2335
2336
|
|
|
2336
2337
|
unbindHotKeys() {
|
|
2337
2338
|
this.bindings && this.bindings.forEach((binding) => {
|
|
2338
|
-
mousetrap__default[
|
|
2339
|
+
mousetrap__default["default"].unbind(binding.key);
|
|
2339
2340
|
});
|
|
2340
2341
|
}
|
|
2341
2342
|
|
|
2342
2343
|
bindEvents() {
|
|
2343
2344
|
this.videojs.on('volumechange', () => { // persist volume changes
|
|
2344
|
-
this.persistSetting(constants.settings.volume, this.volume);
|
|
2345
|
+
this.persistSetting(constants$2.settings.volume, this.volume);
|
|
2345
2346
|
});
|
|
2346
2347
|
|
|
2347
2348
|
this.videojs.textTracks().on('change', () => { // determine subtitles state
|
|
@@ -2350,33 +2351,33 @@
|
|
|
2350
2351
|
const areAnyTxtTracksActive = selected.length > 0; // -> true if any text tracks are showing
|
|
2351
2352
|
|
|
2352
2353
|
if (areAnyTxtTracksActive) { // update container with appropriate className
|
|
2353
|
-
this.videojs.el_.classList.add(constants.classNames.subtitlesActive);
|
|
2354
|
-
this.persistSetting(constants.settings.subs, true);
|
|
2355
|
-
this.persistSetting(constants.settings.subLang, selected[0].language);
|
|
2354
|
+
this.videojs.el_.classList.add(constants$2.classNames.subtitlesActive);
|
|
2355
|
+
this.persistSetting(constants$2.settings.subs, true);
|
|
2356
|
+
this.persistSetting(constants$2.settings.subLang, selected[0].language);
|
|
2356
2357
|
} else {
|
|
2357
|
-
this.videojs.el_.classList.remove(constants.classNames.subtitlesActive);
|
|
2358
|
-
this.persistSetting(constants.settings.subs, false);
|
|
2358
|
+
this.videojs.el_.classList.remove(constants$2.classNames.subtitlesActive);
|
|
2359
|
+
this.persistSetting(constants$2.settings.subs, false);
|
|
2359
2360
|
}
|
|
2360
2361
|
});
|
|
2361
2362
|
}
|
|
2362
2363
|
|
|
2363
2364
|
volumeUp() {
|
|
2364
2365
|
this.videojs.controlBar.volumePanel.volumeControl.volumeBar.stepForward();
|
|
2365
|
-
this.osd.feedback(constants.osd.volchange, { volume: this.volume });
|
|
2366
|
+
this.osd.feedback(constants$2.osd.volchange, { volume: this.volume });
|
|
2366
2367
|
}
|
|
2367
2368
|
|
|
2368
2369
|
volumeDown() {
|
|
2369
2370
|
this.videojs.controlBar.volumePanel.volumeControl.volumeBar.stepBack();
|
|
2370
|
-
this.osd.feedback(constants.osd.volchange, { volume: this.volume });
|
|
2371
|
+
this.osd.feedback(constants$2.osd.volchange, { volume: this.volume });
|
|
2371
2372
|
}
|
|
2372
2373
|
|
|
2373
2374
|
toggleMute() {
|
|
2374
2375
|
if (!this.videojs.muted()) {
|
|
2375
2376
|
this.videojs.muted(true);
|
|
2376
|
-
this.osd.feedback(constants.osd.volchange, { volume: this.volume });
|
|
2377
|
+
this.osd.feedback(constants$2.osd.volchange, { volume: this.volume });
|
|
2377
2378
|
} else {
|
|
2378
2379
|
this.videojs.muted(false);
|
|
2379
|
-
this.osd.feedback(constants.osd.volchange, { volume: this.volume });
|
|
2380
|
+
this.osd.feedback(constants$2.osd.volchange, { volume: this.volume });
|
|
2380
2381
|
}
|
|
2381
2382
|
}
|
|
2382
2383
|
|
|
@@ -2404,13 +2405,13 @@
|
|
|
2404
2405
|
}
|
|
2405
2406
|
|
|
2406
2407
|
jumpForward() {
|
|
2407
|
-
this.seek(constants.defaults.jumpSeconds);
|
|
2408
|
-
this.osd.feedback(constants.osd.jumpForward);
|
|
2408
|
+
this.seek(constants$2.defaults.jumpSeconds);
|
|
2409
|
+
this.osd.feedback(constants$2.osd.jumpForward);
|
|
2409
2410
|
}
|
|
2410
2411
|
|
|
2411
2412
|
jumpBackward() {
|
|
2412
|
-
this.seek(-constants.defaults.jumpSeconds);
|
|
2413
|
-
this.osd.feedback(constants.osd.jumpBackward);
|
|
2413
|
+
this.seek(-constants$2.defaults.jumpSeconds);
|
|
2414
|
+
this.osd.feedback(constants$2.osd.jumpBackward);
|
|
2414
2415
|
}
|
|
2415
2416
|
|
|
2416
2417
|
frameForward() {
|
|
@@ -2428,7 +2429,7 @@
|
|
|
2428
2429
|
}
|
|
2429
2430
|
|
|
2430
2431
|
secondsToFramesFromStart(seconds) {
|
|
2431
|
-
const frameRate = this.props.frameRate || constants.defaults.frameRate;
|
|
2432
|
+
const frameRate = this.props.frameRate || constants$2.defaults.frameRate;
|
|
2432
2433
|
let frame = seconds * frameRate;
|
|
2433
2434
|
frame = Math.round(frame);
|
|
2434
2435
|
return frame; // we're on this frame, could be for example 23.45
|
|
@@ -2492,22 +2493,22 @@
|
|
|
2492
2493
|
|
|
2493
2494
|
restoreSettings() { // restore settings, like volume level or language track
|
|
2494
2495
|
// get values from storage
|
|
2495
|
-
const volume = localStorage.getItem(constants.settings.volume);
|
|
2496
|
-
const subsEnabled = localStorage.getItem(constants.settings.subs);
|
|
2497
|
-
const subLang = localStorage.getItem(constants.settings.subLang);
|
|
2496
|
+
const volume = localStorage.getItem(constants$2.settings.volume);
|
|
2497
|
+
const subsEnabled = localStorage.getItem(constants$2.settings.subs);
|
|
2498
|
+
const subLang = localStorage.getItem(constants$2.settings.subLang);
|
|
2498
2499
|
|
|
2499
2500
|
// values vs default behaviours in a neatly readable map
|
|
2500
2501
|
this.settings = {
|
|
2501
2502
|
// avoid .99999999 and other float pecularities in js
|
|
2502
|
-
[constants.settings.volume]: (volume !== null) ? Math.round(volume * 100) / 100 : 1,
|
|
2503
|
-
[constants.settings.subLang]: (subLang !== null) ? subLang : 'en',
|
|
2504
|
-
[constants.settings.subs]: (subsEnabled !== null) ? JSON.parse(subsEnabled) : false,
|
|
2503
|
+
[constants$2.settings.volume]: (volume !== null) ? Math.round(volume * 100) / 100 : 1,
|
|
2504
|
+
[constants$2.settings.subLang]: (subLang !== null) ? subLang : 'en',
|
|
2505
|
+
[constants$2.settings.subs]: (subsEnabled !== null) ? JSON.parse(subsEnabled) : false,
|
|
2505
2506
|
};
|
|
2506
2507
|
|
|
2507
2508
|
// apply values (settings)
|
|
2508
|
-
this.volume = this.settings[constants.settings.volume]; // volume
|
|
2509
|
+
this.volume = this.settings[constants$2.settings.volume]; // volume
|
|
2509
2510
|
|
|
2510
|
-
if (this.settings[constants.settings.subs]) { // subtitles
|
|
2511
|
+
if (this.settings[constants$2.settings.subs]) { // subtitles
|
|
2511
2512
|
this.enableSubs();
|
|
2512
2513
|
}
|
|
2513
2514
|
}
|
|
@@ -2522,7 +2523,7 @@
|
|
|
2522
2523
|
|
|
2523
2524
|
for (let i = 0; i < subs.length; i++) {
|
|
2524
2525
|
const sub = subs[i];
|
|
2525
|
-
if (sub.language === this.settings[constants.settings.subLang]) {
|
|
2526
|
+
if (sub.language === this.settings[constants$2.settings.subLang]) {
|
|
2526
2527
|
sub.mode = 'showing';
|
|
2527
2528
|
} else {
|
|
2528
2529
|
sub.mode = 'hidden';
|
|
@@ -2558,8 +2559,8 @@
|
|
|
2558
2559
|
}
|
|
2559
2560
|
*/
|
|
2560
2561
|
addButtonToControlBar(options) {
|
|
2561
|
-
const Button = videojs__default[
|
|
2562
|
-
const CustomButton = videojs__default[
|
|
2562
|
+
const Button = videojs__default["default"].getComponent('Button');
|
|
2563
|
+
const CustomButton = videojs__default["default"].extend(Button, {
|
|
2563
2564
|
/* eslint-disable func-names, object-shorthand */
|
|
2564
2565
|
constructor: function () {
|
|
2565
2566
|
Button.apply(this, arguments);
|
|
@@ -2571,7 +2572,7 @@
|
|
|
2571
2572
|
},
|
|
2572
2573
|
});
|
|
2573
2574
|
|
|
2574
|
-
videojs__default[
|
|
2575
|
+
videojs__default["default"].registerComponent(options.componentName, CustomButton);
|
|
2575
2576
|
this.videojs.getChild('controlBar').addChild(options.componentName, {}, 7);
|
|
2576
2577
|
}
|
|
2577
2578
|
|
|
@@ -2729,7 +2730,7 @@
|
|
|
2729
2730
|
|
|
2730
2731
|
// eslint-disable-next-line class-methods-use-this
|
|
2731
2732
|
triggerHotkey(key) {
|
|
2732
|
-
mousetrap__default[
|
|
2733
|
+
mousetrap__default["default"].trigger(key);
|
|
2733
2734
|
}
|
|
2734
2735
|
|
|
2735
2736
|
toStart() {
|
|
@@ -2756,10 +2757,10 @@
|
|
|
2756
2757
|
togglePlayback() {
|
|
2757
2758
|
if (this.videojs.paused()) {
|
|
2758
2759
|
this.play();
|
|
2759
|
-
this.videojs.hasStarted_ && this.osd.feedback(constants.osd.play);
|
|
2760
|
+
this.videojs.hasStarted_ && this.osd.feedback(constants$2.osd.play);
|
|
2760
2761
|
} else {
|
|
2761
2762
|
this.pause();
|
|
2762
|
-
this.osd.feedback(constants.osd.pause);
|
|
2763
|
+
this.osd.feedback(constants$2.osd.pause);
|
|
2763
2764
|
}
|
|
2764
2765
|
}
|
|
2765
2766
|
|
|
@@ -2896,17 +2897,17 @@
|
|
|
2896
2897
|
*/
|
|
2897
2898
|
|
|
2898
2899
|
// take over space button, prevent video.js default behaviour
|
|
2899
|
-
const button = videojs__default[
|
|
2900
|
+
const button = videojs__default["default"].prototype.constructor.getComponent('Button');
|
|
2900
2901
|
// eslint-disable-next-line func-names
|
|
2901
2902
|
button.prototype.handleKeyDown = function (e) {
|
|
2902
2903
|
if (e.keyCode === 32) {
|
|
2903
2904
|
e.preventDefault();
|
|
2904
2905
|
}
|
|
2905
2906
|
};
|
|
2906
|
-
videojs__default[
|
|
2907
|
+
videojs__default["default"].prototype.constructor.registerComponent('Button', button);
|
|
2907
2908
|
|
|
2908
2909
|
// video.js opens menu on hover by default, this prevents that
|
|
2909
|
-
const subsButton = videojs__default[
|
|
2910
|
+
const subsButton = videojs__default["default"].prototype.constructor.getComponent('SubsCapsButton');
|
|
2910
2911
|
class CustomSubsCapsButton extends subsButton {
|
|
2911
2912
|
constructor(player, options = {}) {
|
|
2912
2913
|
super(player, options);
|
|
@@ -2919,7 +2920,7 @@
|
|
|
2919
2920
|
TODO - see what can be done about strange behaviour
|
|
2920
2921
|
when cc button is clicked with the menu showing
|
|
2921
2922
|
*/
|
|
2922
|
-
videojs__default[
|
|
2923
|
+
videojs__default["default"].prototype.constructor.registerComponent('SubsCapsButton', CustomSubsCapsButton);
|
|
2923
2924
|
|
|
2924
2925
|
/* eslint-disable no-plusplus */
|
|
2925
2926
|
|
|
@@ -2949,7 +2950,7 @@
|
|
|
2949
2950
|
BEWARE - IE < Edge is unsupported
|
|
2950
2951
|
*/
|
|
2951
2952
|
|
|
2952
|
-
const CSS
|
|
2953
|
+
const CSS = `
|
|
2953
2954
|
.vdt-external-controls{
|
|
2954
2955
|
display: flex;
|
|
2955
2956
|
justify-content: center;
|
|
@@ -3082,7 +3083,7 @@
|
|
|
3082
3083
|
// attach styles
|
|
3083
3084
|
this.style = document.createElement('style');
|
|
3084
3085
|
this.style.type = 'text/css';
|
|
3085
|
-
this.style.appendChild(document.createTextNode(CSS
|
|
3086
|
+
this.style.appendChild(document.createTextNode(CSS));
|
|
3086
3087
|
this.shadow.appendChild(this.style);
|
|
3087
3088
|
|
|
3088
3089
|
// attach container to shadow root
|
|
@@ -3240,4 +3241,4 @@
|
|
|
3240
3241
|
|
|
3241
3242
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3242
3243
|
|
|
3243
|
-
}))
|
|
3244
|
+
}));
|