@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.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import videojs from 'video.js/dist/alt/video.core.min';
|
|
|
2
2
|
import mousetrap from 'mousetrap';
|
|
3
3
|
|
|
4
4
|
var name = "@vidispine/vdt-videojs";
|
|
5
|
-
var version = "21.
|
|
5
|
+
var version = "21.4.0-pre.1";
|
|
6
6
|
var license = "UNLICENSED";
|
|
7
7
|
var main = "lib/index.cjs.js";
|
|
8
8
|
var module = "lib/index.es.js";
|
|
@@ -155,7 +155,7 @@ const packageInfo = Object.freeze({
|
|
|
155
155
|
vendor: pkgInfo.name.split('/')[0],
|
|
156
156
|
});
|
|
157
157
|
|
|
158
|
-
const constants = Object.freeze({
|
|
158
|
+
const constants$2 = Object.freeze({
|
|
159
159
|
defaults,
|
|
160
160
|
settings,
|
|
161
161
|
classNames,
|
|
@@ -241,13 +241,13 @@ class OSD {
|
|
|
241
241
|
let className;
|
|
242
242
|
|
|
243
243
|
switch (feedbackType) {
|
|
244
|
-
case constants.osd.pause:
|
|
244
|
+
case constants$2.osd.pause:
|
|
245
245
|
className = 'pause';
|
|
246
246
|
break;
|
|
247
|
-
case constants.osd.play:
|
|
247
|
+
case constants$2.osd.play:
|
|
248
248
|
className = 'play';
|
|
249
249
|
break;
|
|
250
|
-
case constants.osd.volchange:
|
|
250
|
+
case constants$2.osd.volchange:
|
|
251
251
|
const currentVolumeLevel = details.volume;
|
|
252
252
|
let perceivedVolumeLevel; // 'low' | 'mid' | 'high' string to utilize video js eisting icons
|
|
253
253
|
|
|
@@ -264,10 +264,10 @@ class OSD {
|
|
|
264
264
|
|
|
265
265
|
className = `volchange ${perceivedVolumeLevel}`;
|
|
266
266
|
break;
|
|
267
|
-
case constants.osd.jumpForward:
|
|
267
|
+
case constants$2.osd.jumpForward:
|
|
268
268
|
className = 'forward-jump';
|
|
269
269
|
break;
|
|
270
|
-
case constants.osd.jumpBackward:
|
|
270
|
+
case constants$2.osd.jumpBackward:
|
|
271
271
|
className = 'backward-jump';
|
|
272
272
|
break;
|
|
273
273
|
}
|
|
@@ -694,7 +694,7 @@ const constants$1 = Object.freeze({
|
|
|
694
694
|
});
|
|
695
695
|
|
|
696
696
|
|
|
697
|
-
const CSS = () => `
|
|
697
|
+
const CSS$2 = () => `
|
|
698
698
|
.${constants$1.menuClassName}{
|
|
699
699
|
position: relative;
|
|
700
700
|
height: 100%;
|
|
@@ -897,7 +897,7 @@ class Menu {
|
|
|
897
897
|
// attach styles
|
|
898
898
|
this.style = document.createElement('style');
|
|
899
899
|
this.style.type = 'text/css';
|
|
900
|
-
this.style.innerHTML = CSS();
|
|
900
|
+
this.style.innerHTML = CSS$2();
|
|
901
901
|
this.shadow.appendChild(this.style);
|
|
902
902
|
}
|
|
903
903
|
}
|
|
@@ -1042,7 +1042,7 @@ class Menu {
|
|
|
1042
1042
|
|
|
1043
1043
|
/* eslint-disable max-len */
|
|
1044
1044
|
|
|
1045
|
-
const constants
|
|
1045
|
+
const constants = Object.freeze({
|
|
1046
1046
|
className: 'vdt-seekbar',
|
|
1047
1047
|
defaults: {
|
|
1048
1048
|
bgColor: '#fafafa',
|
|
@@ -1059,7 +1059,7 @@ const constants$2 = Object.freeze({
|
|
|
1059
1059
|
});
|
|
1060
1060
|
|
|
1061
1061
|
const CSS$1 = (bgColor, fillColor) => `
|
|
1062
|
-
.${constants
|
|
1062
|
+
.${constants.className}{
|
|
1063
1063
|
user-select: none;
|
|
1064
1064
|
background: ${colors.light};
|
|
1065
1065
|
height: 6px;
|
|
@@ -1069,7 +1069,7 @@ const CSS$1 = (bgColor, fillColor) => `
|
|
|
1069
1069
|
z-index: 5;
|
|
1070
1070
|
}
|
|
1071
1071
|
|
|
1072
|
-
.${classNames.onDark}.${constants
|
|
1072
|
+
.${classNames.onDark}.${constants.className}{
|
|
1073
1073
|
background: ${colors.gray};
|
|
1074
1074
|
}
|
|
1075
1075
|
|
|
@@ -1080,7 +1080,7 @@ const CSS$1 = (bgColor, fillColor) => `
|
|
|
1080
1080
|
left: 0px;
|
|
1081
1081
|
top: 0px;
|
|
1082
1082
|
background: ${fillColor};
|
|
1083
|
-
transition: width ${constants
|
|
1083
|
+
transition: width ${constants.defaults.transitionTime}ms linear;
|
|
1084
1084
|
z-index: 2;
|
|
1085
1085
|
}
|
|
1086
1086
|
|
|
@@ -1091,11 +1091,11 @@ const CSS$1 = (bgColor, fillColor) => `
|
|
|
1091
1091
|
transition: none;
|
|
1092
1092
|
}
|
|
1093
1093
|
|
|
1094
|
-
.${classNames.onDark}.${constants
|
|
1094
|
+
.${classNames.onDark}.${constants.className} .load-indicator{
|
|
1095
1095
|
background: white;
|
|
1096
1096
|
}
|
|
1097
1097
|
|
|
1098
|
-
.${constants
|
|
1098
|
+
.${constants.className}.dragging .fill{
|
|
1099
1099
|
transition: none;
|
|
1100
1100
|
}
|
|
1101
1101
|
|
|
@@ -1111,7 +1111,7 @@ const CSS$1 = (bgColor, fillColor) => `
|
|
|
1111
1111
|
}
|
|
1112
1112
|
|
|
1113
1113
|
.marker{
|
|
1114
|
-
transition: opacity ${constants
|
|
1114
|
+
transition: opacity ${constants.defaults.transitionTime}ms linear;
|
|
1115
1115
|
}
|
|
1116
1116
|
|
|
1117
1117
|
.marker{ display: none; }
|
|
@@ -1120,7 +1120,7 @@ const CSS$1 = (bgColor, fillColor) => `
|
|
|
1120
1120
|
.marker .handle{
|
|
1121
1121
|
position: absolute;
|
|
1122
1122
|
bottom: 10px; right: 0px;
|
|
1123
|
-
width: ${constants
|
|
1123
|
+
width: ${constants.defaults.markerWidth}px;
|
|
1124
1124
|
height: 28px;
|
|
1125
1125
|
background: #999;
|
|
1126
1126
|
border-radius: 3px;
|
|
@@ -1130,7 +1130,7 @@ const CSS$1 = (bgColor, fillColor) => `
|
|
|
1130
1130
|
}
|
|
1131
1131
|
|
|
1132
1132
|
.marker.regional .handle{
|
|
1133
|
-
background: ${constants
|
|
1133
|
+
background: ${constants.defaults.regionAccentColor};
|
|
1134
1134
|
box-shadow: -2px 1px 1px rgba(0,0,0,.1);
|
|
1135
1135
|
}
|
|
1136
1136
|
|
|
@@ -1149,13 +1149,13 @@ const CSS$1 = (bgColor, fillColor) => `
|
|
|
1149
1149
|
}
|
|
1150
1150
|
|
|
1151
1151
|
.handle:active{
|
|
1152
|
-
background: ${constants
|
|
1152
|
+
background: ${constants.defaults.regionColor};
|
|
1153
1153
|
}
|
|
1154
1154
|
|
|
1155
1155
|
.region{
|
|
1156
1156
|
position: absolute;
|
|
1157
1157
|
width: auto;
|
|
1158
|
-
background: ${constants
|
|
1158
|
+
background: ${constants.defaults.regionColor};
|
|
1159
1159
|
opacity: .7;
|
|
1160
1160
|
}
|
|
1161
1161
|
|
|
@@ -1172,7 +1172,7 @@ const CSS$1 = (bgColor, fillColor) => `
|
|
|
1172
1172
|
bottom: 10px;
|
|
1173
1173
|
width: 16px;
|
|
1174
1174
|
border-radius: 16px;
|
|
1175
|
-
background: ${constants
|
|
1175
|
+
background: ${constants.defaults.regionAccentColor};
|
|
1176
1176
|
position: absolute;
|
|
1177
1177
|
margin-left: -8px;
|
|
1178
1178
|
transition: transform 200ms ease-out;
|
|
@@ -1248,11 +1248,11 @@ const CSS$1 = (bgColor, fillColor) => `
|
|
|
1248
1248
|
visibility: visible;
|
|
1249
1249
|
}
|
|
1250
1250
|
|
|
1251
|
-
.${constants
|
|
1251
|
+
.${constants.className}.dragging .bubble{
|
|
1252
1252
|
transform: scale3d(.75,.75,.75);
|
|
1253
1253
|
}
|
|
1254
1254
|
|
|
1255
|
-
.${constants
|
|
1255
|
+
.${constants.className}.hide-markers .marker{
|
|
1256
1256
|
opacity: 0;
|
|
1257
1257
|
}
|
|
1258
1258
|
|
|
@@ -1278,7 +1278,7 @@ class SeekBar {
|
|
|
1278
1278
|
reactiveSetters.apply(this); // ability to handle new props via setters
|
|
1279
1279
|
|
|
1280
1280
|
this.container = document.createElement('div');
|
|
1281
|
-
this.container.className = `${constants
|
|
1281
|
+
this.container.className = `${constants.className}-wrapper`;
|
|
1282
1282
|
|
|
1283
1283
|
this.state = {
|
|
1284
1284
|
in: null, // in seconds from 0
|
|
@@ -1298,8 +1298,8 @@ class SeekBar {
|
|
|
1298
1298
|
this.style.type = 'text/css';
|
|
1299
1299
|
|
|
1300
1300
|
// colors from props
|
|
1301
|
-
const bgColor = (this.props.bgColor) ? this.props.bgColor : constants
|
|
1302
|
-
const fillColor = (this.props.fillColor) ? this.props.fillColor : constants
|
|
1301
|
+
const bgColor = (this.props.bgColor) ? this.props.bgColor : constants.defaults.bgColor;
|
|
1302
|
+
const fillColor = (this.props.fillColor) ? this.props.fillColor : constants.defaults.fillColor;
|
|
1303
1303
|
|
|
1304
1304
|
this.style.innerHTML = CSS$1(sanitize(bgColor), sanitize(fillColor));
|
|
1305
1305
|
this.shadow.appendChild(this.style);
|
|
@@ -1493,7 +1493,7 @@ class SeekBar {
|
|
|
1493
1493
|
|
|
1494
1494
|
draw() {
|
|
1495
1495
|
this.bar = document.createElement('div');
|
|
1496
|
-
this.bar.className = constants
|
|
1496
|
+
this.bar.className = constants.className;
|
|
1497
1497
|
this.bar.onclick = (e) => {
|
|
1498
1498
|
if (!e.target.classList.contains('marker') && !e.target.classList.contains('handle')) {
|
|
1499
1499
|
this.handleSeek(e);
|
|
@@ -1529,10 +1529,10 @@ class SeekBar {
|
|
|
1529
1529
|
|
|
1530
1530
|
drawMarkers() { // TODO - add touch events
|
|
1531
1531
|
if (this.markersEnabled) {
|
|
1532
|
-
const markerIn = this.markers[constants
|
|
1533
|
-
const markerOut = this.markers[constants
|
|
1534
|
-
markerIn.className = `marker ${constants
|
|
1535
|
-
markerOut.className = `marker ${constants
|
|
1532
|
+
const markerIn = this.markers[constants.markerTypes.in] = document.createElement('div');
|
|
1533
|
+
const markerOut = this.markers[constants.markerTypes.out] = document.createElement('div');
|
|
1534
|
+
markerIn.className = `marker ${constants.markerTypes.in}`;
|
|
1535
|
+
markerOut.className = `marker ${constants.markerTypes.out}`;
|
|
1536
1536
|
|
|
1537
1537
|
const handleIn = document.createElement('div');
|
|
1538
1538
|
const handleOut = document.createElement('div');
|
|
@@ -1542,14 +1542,14 @@ class SeekBar {
|
|
|
1542
1542
|
e.preventDefault(); // prevents selection cursor
|
|
1543
1543
|
e.stopPropagation(); // prevent triggering seek bar drag
|
|
1544
1544
|
|
|
1545
|
-
this.handleMarkerDrag(markerIn, constants
|
|
1545
|
+
this.handleMarkerDrag(markerIn, constants.markerTypes.in, e);
|
|
1546
1546
|
}, false);
|
|
1547
1547
|
|
|
1548
1548
|
handleOut.addEventListener('mousedown', (e) => {
|
|
1549
1549
|
e.preventDefault(); // prevents selection cursor
|
|
1550
1550
|
e.stopPropagation(); // prevent triggering seek bar drag
|
|
1551
1551
|
|
|
1552
|
-
this.handleMarkerDrag(markerOut, constants
|
|
1552
|
+
this.handleMarkerDrag(markerOut, constants.markerTypes.out, e);
|
|
1553
1553
|
}, false);
|
|
1554
1554
|
|
|
1555
1555
|
markerIn.appendChild(handleIn);
|
|
@@ -1581,8 +1581,8 @@ class SeekBar {
|
|
|
1581
1581
|
|
|
1582
1582
|
drawInAndOutRegion() { // triggered after drawMarkers if in + out is set
|
|
1583
1583
|
if (this.state.in !== null && this.state.out !== null) {
|
|
1584
|
-
this.region.style.left = this.markers[constants
|
|
1585
|
-
this.region.style.right = `${100 - parseFloat(this.markers[constants
|
|
1584
|
+
this.region.style.left = this.markers[constants.markerTypes.in].style.left;
|
|
1585
|
+
this.region.style.right = `${100 - parseFloat(this.markers[constants.markerTypes.out].style.left.replace('%', ''))}%`;
|
|
1586
1586
|
}
|
|
1587
1587
|
}
|
|
1588
1588
|
|
|
@@ -1599,7 +1599,7 @@ class SeekBar {
|
|
|
1599
1599
|
|
|
1600
1600
|
const drag = (e) => {
|
|
1601
1601
|
const pxDragged = Math.abs(mouseDownEvent.clientX - e.clientX);
|
|
1602
|
-
const markerOffset = (type === constants
|
|
1602
|
+
const markerOffset = (type === constants.markerTypes.in) ? (constants.defaults.markerWidth / 2) : -(constants.defaults.markerWidth / 2);
|
|
1603
1603
|
const left = e.clientX - barOffset + markerOffset;
|
|
1604
1604
|
|
|
1605
1605
|
if (left >= 0 && left < barWidth && pxDragged > 1) { // prevent out-of-bounds
|
|
@@ -1633,7 +1633,7 @@ class SeekBar {
|
|
|
1633
1633
|
jump to the time of marker in player
|
|
1634
1634
|
*/
|
|
1635
1635
|
if (!dragHappened) {
|
|
1636
|
-
if (type === constants
|
|
1636
|
+
if (type === constants.markerTypes.in) {
|
|
1637
1637
|
this.navigateToIn();
|
|
1638
1638
|
} else {
|
|
1639
1639
|
this.navigateToOut();
|
|
@@ -1656,12 +1656,12 @@ class SeekBar {
|
|
|
1656
1656
|
cleanupMarkers() {
|
|
1657
1657
|
let removedMarker = false;
|
|
1658
1658
|
if (this.state.in === null) {
|
|
1659
|
-
this.markers[constants
|
|
1659
|
+
this.markers[constants.markerTypes.in].classList.remove('active');
|
|
1660
1660
|
removedMarker = true;
|
|
1661
1661
|
}
|
|
1662
1662
|
|
|
1663
1663
|
if (this.state.out === null) {
|
|
1664
|
-
this.markers[constants
|
|
1664
|
+
this.markers[constants.markerTypes.out].classList.remove('active');
|
|
1665
1665
|
removedMarker = true;
|
|
1666
1666
|
}
|
|
1667
1667
|
|
|
@@ -1704,7 +1704,7 @@ class SeekBar {
|
|
|
1704
1704
|
if (val !== null && val !== undefined) {
|
|
1705
1705
|
const { player } = this.props;
|
|
1706
1706
|
this.updateMarkers({
|
|
1707
|
-
type: constants
|
|
1707
|
+
type: constants.markerTypes.in,
|
|
1708
1708
|
value: val / player.videojs.duration(),
|
|
1709
1709
|
});
|
|
1710
1710
|
|
|
@@ -1731,7 +1731,7 @@ class SeekBar {
|
|
|
1731
1731
|
if (val !== null && val !== undefined) {
|
|
1732
1732
|
const { player } = this.props;
|
|
1733
1733
|
this.updateMarkers({
|
|
1734
|
-
type: constants
|
|
1734
|
+
type: constants.markerTypes.out,
|
|
1735
1735
|
value: val / player.videojs.duration(),
|
|
1736
1736
|
});
|
|
1737
1737
|
|
|
@@ -1901,6 +1901,7 @@ SeekBar.Region = Region;
|
|
|
1901
1901
|
class VideoTime {
|
|
1902
1902
|
constructor(props) {
|
|
1903
1903
|
if (props.frameRate === undefined) {
|
|
1904
|
+
delete this;
|
|
1904
1905
|
throw new Error('No "frameRate" option provided, refer to docs.');
|
|
1905
1906
|
} else {
|
|
1906
1907
|
this.props = props;
|
|
@@ -1975,8 +1976,8 @@ class Player {
|
|
|
1975
1976
|
const classNames = [ // add conditional css classes here for the whole container
|
|
1976
1977
|
'video-js',
|
|
1977
1978
|
'vjs-big-play-centered',
|
|
1978
|
-
(this.props.posterUrl) ? constants.classNames.poster : '',
|
|
1979
|
-
(this.props.subtitles && this.props.subtitles.length > 0) ? constants.classNames.subtitles : '',
|
|
1979
|
+
(this.props.posterUrl) ? constants$2.classNames.poster : '',
|
|
1980
|
+
(this.props.subtitles && this.props.subtitles.length > 0) ? constants$2.classNames.subtitles : '',
|
|
1980
1981
|
'init', // make player height 0 while no metadata for video size available with css
|
|
1981
1982
|
];
|
|
1982
1983
|
|
|
@@ -1987,7 +1988,7 @@ class Player {
|
|
|
1987
1988
|
};
|
|
1988
1989
|
|
|
1989
1990
|
this.timeConverter = new VideoTime({
|
|
1990
|
-
frameRate: this.props.frameRate || constants.defaults.frameRate,
|
|
1991
|
+
frameRate: this.props.frameRate || constants$2.defaults.frameRate,
|
|
1991
1992
|
});
|
|
1992
1993
|
|
|
1993
1994
|
/*
|
|
@@ -2070,7 +2071,7 @@ class Player {
|
|
|
2070
2071
|
durationDisplay: showDefaultTimeDisplay,
|
|
2071
2072
|
currentTimeDisplay: showDefaultTimeDisplay,
|
|
2072
2073
|
},
|
|
2073
|
-
inactivityTimeout: (this.audioOnly) ? constants.defaults.audioInactivityTimeout : constants.defaults.inactivityTimeout,
|
|
2074
|
+
inactivityTimeout: (this.audioOnly) ? constants$2.defaults.audioInactivityTimeout : constants$2.defaults.inactivityTimeout,
|
|
2074
2075
|
preload: 'auto',
|
|
2075
2076
|
captionsButton: false,
|
|
2076
2077
|
subsCapsButton: false,
|
|
@@ -2159,8 +2160,8 @@ class Player {
|
|
|
2159
2160
|
this.videojs.pause();
|
|
2160
2161
|
},
|
|
2161
2162
|
onInputBlur: () => {
|
|
2162
|
-
this.videojs.options().inactivityTimeout = constants.defaults.inactivityTimeout;
|
|
2163
|
-
this.videojs.cache_.inactivityTimeout = constants.defaults.inactivityTimeout;
|
|
2163
|
+
this.videojs.options().inactivityTimeout = constants$2.defaults.inactivityTimeout;
|
|
2164
|
+
this.videojs.cache_.inactivityTimeout = constants$2.defaults.inactivityTimeout;
|
|
2164
2165
|
},
|
|
2165
2166
|
};
|
|
2166
2167
|
|
|
@@ -2333,7 +2334,7 @@ class Player {
|
|
|
2333
2334
|
|
|
2334
2335
|
bindEvents() {
|
|
2335
2336
|
this.videojs.on('volumechange', () => { // persist volume changes
|
|
2336
|
-
this.persistSetting(constants.settings.volume, this.volume);
|
|
2337
|
+
this.persistSetting(constants$2.settings.volume, this.volume);
|
|
2337
2338
|
});
|
|
2338
2339
|
|
|
2339
2340
|
this.videojs.textTracks().on('change', () => { // determine subtitles state
|
|
@@ -2342,33 +2343,33 @@ class Player {
|
|
|
2342
2343
|
const areAnyTxtTracksActive = selected.length > 0; // -> true if any text tracks are showing
|
|
2343
2344
|
|
|
2344
2345
|
if (areAnyTxtTracksActive) { // update container with appropriate className
|
|
2345
|
-
this.videojs.el_.classList.add(constants.classNames.subtitlesActive);
|
|
2346
|
-
this.persistSetting(constants.settings.subs, true);
|
|
2347
|
-
this.persistSetting(constants.settings.subLang, selected[0].language);
|
|
2346
|
+
this.videojs.el_.classList.add(constants$2.classNames.subtitlesActive);
|
|
2347
|
+
this.persistSetting(constants$2.settings.subs, true);
|
|
2348
|
+
this.persistSetting(constants$2.settings.subLang, selected[0].language);
|
|
2348
2349
|
} else {
|
|
2349
|
-
this.videojs.el_.classList.remove(constants.classNames.subtitlesActive);
|
|
2350
|
-
this.persistSetting(constants.settings.subs, false);
|
|
2350
|
+
this.videojs.el_.classList.remove(constants$2.classNames.subtitlesActive);
|
|
2351
|
+
this.persistSetting(constants$2.settings.subs, false);
|
|
2351
2352
|
}
|
|
2352
2353
|
});
|
|
2353
2354
|
}
|
|
2354
2355
|
|
|
2355
2356
|
volumeUp() {
|
|
2356
2357
|
this.videojs.controlBar.volumePanel.volumeControl.volumeBar.stepForward();
|
|
2357
|
-
this.osd.feedback(constants.osd.volchange, { volume: this.volume });
|
|
2358
|
+
this.osd.feedback(constants$2.osd.volchange, { volume: this.volume });
|
|
2358
2359
|
}
|
|
2359
2360
|
|
|
2360
2361
|
volumeDown() {
|
|
2361
2362
|
this.videojs.controlBar.volumePanel.volumeControl.volumeBar.stepBack();
|
|
2362
|
-
this.osd.feedback(constants.osd.volchange, { volume: this.volume });
|
|
2363
|
+
this.osd.feedback(constants$2.osd.volchange, { volume: this.volume });
|
|
2363
2364
|
}
|
|
2364
2365
|
|
|
2365
2366
|
toggleMute() {
|
|
2366
2367
|
if (!this.videojs.muted()) {
|
|
2367
2368
|
this.videojs.muted(true);
|
|
2368
|
-
this.osd.feedback(constants.osd.volchange, { volume: this.volume });
|
|
2369
|
+
this.osd.feedback(constants$2.osd.volchange, { volume: this.volume });
|
|
2369
2370
|
} else {
|
|
2370
2371
|
this.videojs.muted(false);
|
|
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
|
|
|
@@ -2396,13 +2397,13 @@ class Player {
|
|
|
2396
2397
|
}
|
|
2397
2398
|
|
|
2398
2399
|
jumpForward() {
|
|
2399
|
-
this.seek(constants.defaults.jumpSeconds);
|
|
2400
|
-
this.osd.feedback(constants.osd.jumpForward);
|
|
2400
|
+
this.seek(constants$2.defaults.jumpSeconds);
|
|
2401
|
+
this.osd.feedback(constants$2.osd.jumpForward);
|
|
2401
2402
|
}
|
|
2402
2403
|
|
|
2403
2404
|
jumpBackward() {
|
|
2404
|
-
this.seek(-constants.defaults.jumpSeconds);
|
|
2405
|
-
this.osd.feedback(constants.osd.jumpBackward);
|
|
2405
|
+
this.seek(-constants$2.defaults.jumpSeconds);
|
|
2406
|
+
this.osd.feedback(constants$2.osd.jumpBackward);
|
|
2406
2407
|
}
|
|
2407
2408
|
|
|
2408
2409
|
frameForward() {
|
|
@@ -2420,7 +2421,7 @@ class Player {
|
|
|
2420
2421
|
}
|
|
2421
2422
|
|
|
2422
2423
|
secondsToFramesFromStart(seconds) {
|
|
2423
|
-
const frameRate = this.props.frameRate || constants.defaults.frameRate;
|
|
2424
|
+
const frameRate = this.props.frameRate || constants$2.defaults.frameRate;
|
|
2424
2425
|
let frame = seconds * frameRate;
|
|
2425
2426
|
frame = Math.round(frame);
|
|
2426
2427
|
return frame; // we're on this frame, could be for example 23.45
|
|
@@ -2484,22 +2485,22 @@ class Player {
|
|
|
2484
2485
|
|
|
2485
2486
|
restoreSettings() { // restore settings, like volume level or language track
|
|
2486
2487
|
// get values from storage
|
|
2487
|
-
const volume = localStorage.getItem(constants.settings.volume);
|
|
2488
|
-
const subsEnabled = localStorage.getItem(constants.settings.subs);
|
|
2489
|
-
const subLang = localStorage.getItem(constants.settings.subLang);
|
|
2488
|
+
const volume = localStorage.getItem(constants$2.settings.volume);
|
|
2489
|
+
const subsEnabled = localStorage.getItem(constants$2.settings.subs);
|
|
2490
|
+
const subLang = localStorage.getItem(constants$2.settings.subLang);
|
|
2490
2491
|
|
|
2491
2492
|
// values vs default behaviours in a neatly readable map
|
|
2492
2493
|
this.settings = {
|
|
2493
2494
|
// avoid .99999999 and other float pecularities in js
|
|
2494
|
-
[constants.settings.volume]: (volume !== null) ? Math.round(volume * 100) / 100 : 1,
|
|
2495
|
-
[constants.settings.subLang]: (subLang !== null) ? subLang : 'en',
|
|
2496
|
-
[constants.settings.subs]: (subsEnabled !== null) ? JSON.parse(subsEnabled) : false,
|
|
2495
|
+
[constants$2.settings.volume]: (volume !== null) ? Math.round(volume * 100) / 100 : 1,
|
|
2496
|
+
[constants$2.settings.subLang]: (subLang !== null) ? subLang : 'en',
|
|
2497
|
+
[constants$2.settings.subs]: (subsEnabled !== null) ? JSON.parse(subsEnabled) : false,
|
|
2497
2498
|
};
|
|
2498
2499
|
|
|
2499
2500
|
// apply values (settings)
|
|
2500
|
-
this.volume = this.settings[constants.settings.volume]; // volume
|
|
2501
|
+
this.volume = this.settings[constants$2.settings.volume]; // volume
|
|
2501
2502
|
|
|
2502
|
-
if (this.settings[constants.settings.subs]) { // subtitles
|
|
2503
|
+
if (this.settings[constants$2.settings.subs]) { // subtitles
|
|
2503
2504
|
this.enableSubs();
|
|
2504
2505
|
}
|
|
2505
2506
|
}
|
|
@@ -2514,7 +2515,7 @@ class Player {
|
|
|
2514
2515
|
|
|
2515
2516
|
for (let i = 0; i < subs.length; i++) {
|
|
2516
2517
|
const sub = subs[i];
|
|
2517
|
-
if (sub.language === this.settings[constants.settings.subLang]) {
|
|
2518
|
+
if (sub.language === this.settings[constants$2.settings.subLang]) {
|
|
2518
2519
|
sub.mode = 'showing';
|
|
2519
2520
|
} else {
|
|
2520
2521
|
sub.mode = 'hidden';
|
|
@@ -2748,10 +2749,10 @@ class Player {
|
|
|
2748
2749
|
togglePlayback() {
|
|
2749
2750
|
if (this.videojs.paused()) {
|
|
2750
2751
|
this.play();
|
|
2751
|
-
this.videojs.hasStarted_ && this.osd.feedback(constants.osd.play);
|
|
2752
|
+
this.videojs.hasStarted_ && this.osd.feedback(constants$2.osd.play);
|
|
2752
2753
|
} else {
|
|
2753
2754
|
this.pause();
|
|
2754
|
-
this.osd.feedback(constants.osd.pause);
|
|
2755
|
+
this.osd.feedback(constants$2.osd.pause);
|
|
2755
2756
|
}
|
|
2756
2757
|
}
|
|
2757
2758
|
|
|
@@ -2941,7 +2942,7 @@ https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM
|
|
|
2941
2942
|
BEWARE - IE < Edge is unsupported
|
|
2942
2943
|
*/
|
|
2943
2944
|
|
|
2944
|
-
const CSS
|
|
2945
|
+
const CSS = `
|
|
2945
2946
|
.vdt-external-controls{
|
|
2946
2947
|
display: flex;
|
|
2947
2948
|
justify-content: center;
|
|
@@ -3074,7 +3075,7 @@ class ExternalControls {
|
|
|
3074
3075
|
// attach styles
|
|
3075
3076
|
this.style = document.createElement('style');
|
|
3076
3077
|
this.style.type = 'text/css';
|
|
3077
|
-
this.style.appendChild(document.createTextNode(CSS
|
|
3078
|
+
this.style.appendChild(document.createTextNode(CSS));
|
|
3078
3079
|
this.shadow.appendChild(this.style);
|
|
3079
3080
|
|
|
3080
3081
|
// attach container to shadow root
|