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