@desynova-digital/player 4.0.74 → 4.0.76
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/components/Video.js +48 -31
- package/package.json +1 -1
package/components/Video.js
CHANGED
|
@@ -121,9 +121,12 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
121
121
|
if (!_this.video) return;
|
|
122
122
|
var _this$props = _this.props,
|
|
123
123
|
initialTime = _this$props.initialTime,
|
|
124
|
-
frameRate = _this$props.frameRate
|
|
124
|
+
frameRate = _this$props.frameRate,
|
|
125
|
+
onAutoScroll = _this$props.onAutoScroll;
|
|
125
126
|
var currentFormattedTime = (0, _utils.secondsToTime)(_this.video.currentTime, frameRate, initialTime);
|
|
126
|
-
if (currentFormattedTime
|
|
127
|
+
if (currentFormattedTime && typeof onAutoScroll === 'function') {
|
|
128
|
+
onAutoScroll(currentFormattedTime);
|
|
129
|
+
}
|
|
127
130
|
var _this$getTimeData = _this.getTimeData(_this.video.currentTime),
|
|
128
131
|
shouldShow = _this$getTimeData.shouldShow;
|
|
129
132
|
if (_this.state.shouldShowAnnotate !== shouldShow) {
|
|
@@ -209,7 +212,8 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
209
212
|
watermarkInterval: -1,
|
|
210
213
|
isBuffering: false,
|
|
211
214
|
currentSubtitleObj: {},
|
|
212
|
-
shouldShowAnnotate: false
|
|
215
|
+
shouldShowAnnotate: false,
|
|
216
|
+
annotationsVersion: 0
|
|
213
217
|
};
|
|
214
218
|
_this.video = null; // the html5 video
|
|
215
219
|
_this.manager = new _Manager["default"](props.store);
|
|
@@ -280,9 +284,21 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
280
284
|
}, {
|
|
281
285
|
key: "componentDidUpdate",
|
|
282
286
|
value: function componentDidUpdate(prevProps) {
|
|
287
|
+
var _this2 = this;
|
|
283
288
|
var _this$props3 = this.props,
|
|
289
|
+
parentAnnotations = _this$props3.parentAnnotations,
|
|
284
290
|
inTime = _this$props3.inTime,
|
|
285
291
|
outTime = _this$props3.outTime;
|
|
292
|
+
var hasNewAnnotations = JSON.stringify(parentAnnotations) !== JSON.stringify(prevProps.parentAnnotations);
|
|
293
|
+
if (hasNewAnnotations) {
|
|
294
|
+
Promise.resolve().then(function () {
|
|
295
|
+
_this2.setState(function (prevState) {
|
|
296
|
+
return {
|
|
297
|
+
annotationsVersion: (prevState.annotationsVersion || 0) + 1
|
|
298
|
+
};
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
}
|
|
286
302
|
if (this.props.isSvgLayer && this.props.isSvgLayer !== prevProps.isSvgLayer) {
|
|
287
303
|
this.toggleViaAnnotatePlay();
|
|
288
304
|
}
|
|
@@ -348,7 +364,7 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
348
364
|
}, {
|
|
349
365
|
key: "setupHLS",
|
|
350
366
|
value: function setupHLS(src) {
|
|
351
|
-
var
|
|
367
|
+
var _this3 = this;
|
|
352
368
|
var _this$props5 = this.props,
|
|
353
369
|
actions = _this$props5.actions,
|
|
354
370
|
activeTrackIndex = _this$props5.activeTrackIndex;
|
|
@@ -372,18 +388,18 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
372
388
|
switch (data.type) {
|
|
373
389
|
case _hls["default"].ErrorTypes.NETWORK_ERROR:
|
|
374
390
|
// try to recover network error
|
|
375
|
-
|
|
391
|
+
_this3.hls.startLoad();
|
|
376
392
|
break;
|
|
377
393
|
case _hls["default"].ErrorTypes.MEDIA_ERROR:
|
|
378
|
-
|
|
394
|
+
_this3.hls.recoverMediaError();
|
|
379
395
|
break;
|
|
380
396
|
default:
|
|
381
397
|
// cannot recover
|
|
382
|
-
|
|
398
|
+
_this3.hls.destroy();
|
|
383
399
|
break;
|
|
384
400
|
}
|
|
385
401
|
} else if (data.details === 'internalException' && data.type === 'otherError' || data.details === 'bufferStalledError' && data.type === 'mediaError') {
|
|
386
|
-
|
|
402
|
+
_this3.hls.startLoad();
|
|
387
403
|
}
|
|
388
404
|
});
|
|
389
405
|
}
|
|
@@ -520,12 +536,12 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
520
536
|
}, {
|
|
521
537
|
key: "getProperties",
|
|
522
538
|
value: function getProperties() {
|
|
523
|
-
var
|
|
539
|
+
var _this4 = this;
|
|
524
540
|
if (!this.video) {
|
|
525
541
|
return null;
|
|
526
542
|
}
|
|
527
543
|
return _utils.mediaProperties.reduce(function (properties, key) {
|
|
528
|
-
properties[key] =
|
|
544
|
+
properties[key] = _this4.video[key];
|
|
529
545
|
return properties;
|
|
530
546
|
}, {});
|
|
531
547
|
}
|
|
@@ -1232,7 +1248,7 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1232
1248
|
}, {
|
|
1233
1249
|
key: "renderChildren",
|
|
1234
1250
|
value: function renderChildren() {
|
|
1235
|
-
var
|
|
1251
|
+
var _this5 = this;
|
|
1236
1252
|
var props = _objectSpread(_objectSpread({}, this.props), {}, {
|
|
1237
1253
|
video: this.video
|
|
1238
1254
|
});
|
|
@@ -1254,7 +1270,7 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1254
1270
|
if (preOnError) {
|
|
1255
1271
|
preOnError.apply(void 0, arguments);
|
|
1256
1272
|
}
|
|
1257
|
-
|
|
1273
|
+
_this5.handleError.apply(_this5, arguments);
|
|
1258
1274
|
};
|
|
1259
1275
|
}
|
|
1260
1276
|
} else {
|
|
@@ -1302,7 +1318,7 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1302
1318
|
}, {
|
|
1303
1319
|
key: "render",
|
|
1304
1320
|
value: function render() {
|
|
1305
|
-
var
|
|
1321
|
+
var _this6 = this,
|
|
1306
1322
|
_this$props$parentAnn,
|
|
1307
1323
|
_this$props$parentAnn2,
|
|
1308
1324
|
_this$props$parentAnn3,
|
|
@@ -1331,7 +1347,7 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1331
1347
|
return /*#__PURE__*/_react["default"].createElement(VideoBlock, {
|
|
1332
1348
|
className: "video-react-player-block",
|
|
1333
1349
|
ref: function ref(c) {
|
|
1334
|
-
|
|
1350
|
+
_this6.playerBlock = c;
|
|
1335
1351
|
},
|
|
1336
1352
|
style: this.getStyle(),
|
|
1337
1353
|
HDBorder: player.HDBorderActive,
|
|
@@ -1339,7 +1355,7 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1339
1355
|
}, isBuffering && /*#__PURE__*/_react["default"].createElement("div", {
|
|
1340
1356
|
className: "loader-container",
|
|
1341
1357
|
onClick: function onClick() {
|
|
1342
|
-
return
|
|
1358
|
+
return _this6.togglePlay();
|
|
1343
1359
|
}
|
|
1344
1360
|
}, /*#__PURE__*/_react["default"].createElement(_components.Loader, {
|
|
1345
1361
|
theme: theme,
|
|
@@ -1347,7 +1363,7 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1347
1363
|
})) || null, fileType === 'audio' ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("canvas", {
|
|
1348
1364
|
id: "canvas",
|
|
1349
1365
|
ref: function ref(c) {
|
|
1350
|
-
|
|
1366
|
+
_this6.canvas = c;
|
|
1351
1367
|
},
|
|
1352
1368
|
style: {
|
|
1353
1369
|
top: 0,
|
|
@@ -1358,7 +1374,7 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1358
1374
|
id: videoId,
|
|
1359
1375
|
crossOrigin: "anonymous",
|
|
1360
1376
|
ref: function ref(c) {
|
|
1361
|
-
|
|
1377
|
+
_this6.video = c;
|
|
1362
1378
|
},
|
|
1363
1379
|
muted: muted,
|
|
1364
1380
|
preload: preload,
|
|
@@ -1394,7 +1410,7 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1394
1410
|
id: videoId,
|
|
1395
1411
|
crossOrigin: crossOrigin,
|
|
1396
1412
|
ref: function ref(c) {
|
|
1397
|
-
|
|
1413
|
+
_this6.video = c;
|
|
1398
1414
|
},
|
|
1399
1415
|
muted: muted,
|
|
1400
1416
|
preload: preload,
|
|
@@ -1426,7 +1442,8 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1426
1442
|
onVolumeChange: this.handleVolumeChange
|
|
1427
1443
|
}, /*#__PURE__*/_react["default"].createElement("track", {
|
|
1428
1444
|
kind: "captions"
|
|
1429
|
-
}), this.renderChildren()), this.state.shouldShowAnnotate && (((_this$props$parentAnn = this.props.parentAnnotations) === null || _this$props$parentAnn === void 0 ? void 0 : _this$props$parentAnn.length) > 0 || this.props.isSvgLayer)
|
|
1445
|
+
}), this.renderChildren()), this.state.shouldShowAnnotate && (((_this$props$parentAnn = this.props.parentAnnotations) === null || _this$props$parentAnn === void 0 ? void 0 : _this$props$parentAnn.length) > 0 || this.props.isSvgLayer) ? /*#__PURE__*/_react["default"].createElement("svg", {
|
|
1446
|
+
key: "".concat(this.state.annotationsVersion),
|
|
1430
1447
|
ref: this.props.playerSvgRef,
|
|
1431
1448
|
onMouseDown: this.props.handleMouseDown,
|
|
1432
1449
|
onMouseMove: this.props.handleMouseMove,
|
|
@@ -1441,8 +1458,8 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1441
1458
|
zIndex: 999
|
|
1442
1459
|
}
|
|
1443
1460
|
}, ((_this$props$parentAnn2 = this.props.parentAnnotations) === null || _this$props$parentAnn2 === void 0 ? void 0 : _this$props$parentAnn2.length) && ((_this$props$parentAnn3 = this.props.parentAnnotations) === null || _this$props$parentAnn3 === void 0 ? void 0 : _this$props$parentAnn3.map(function (ann, idx) {
|
|
1444
|
-
var
|
|
1445
|
-
var svg = (
|
|
1461
|
+
var _this6$props$playerSv;
|
|
1462
|
+
var svg = (_this6$props$playerSv = _this6.props.playerSvgRef) === null || _this6$props$playerSv === void 0 ? void 0 : _this6$props$playerSv.current;
|
|
1446
1463
|
if (!svg) return null;
|
|
1447
1464
|
var svgData = svg.getBoundingClientRect();
|
|
1448
1465
|
var width = svgData.width;
|
|
@@ -1462,10 +1479,10 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1462
1479
|
strokeWidth: "4",
|
|
1463
1480
|
fill: "none",
|
|
1464
1481
|
onMouseDown: function onMouseDown(e) {
|
|
1465
|
-
return
|
|
1482
|
+
return _this6.props.onShapeMouseDown(e, idx, ann);
|
|
1466
1483
|
},
|
|
1467
1484
|
style: {
|
|
1468
|
-
cursor:
|
|
1485
|
+
cursor: _this6.props.isSvgLayer ? 'move' : 'default'
|
|
1469
1486
|
}
|
|
1470
1487
|
});
|
|
1471
1488
|
} else if (ann.type === 'line' || ann.type === 'arrow') {
|
|
@@ -1483,25 +1500,25 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1483
1500
|
strokeWidth: "4",
|
|
1484
1501
|
markerEnd: ann.type === 'arrow' ? "url(#open-arrowhead-".concat(ann.color.replace('#', ''), "-").concat(idx, ")") : undefined,
|
|
1485
1502
|
onMouseDown: function onMouseDown(e) {
|
|
1486
|
-
return
|
|
1503
|
+
return _this6.props.onShapeMouseDown(e, idx, ann);
|
|
1487
1504
|
},
|
|
1488
1505
|
style: {
|
|
1489
1506
|
color: ann.color,
|
|
1490
|
-
cursor:
|
|
1507
|
+
cursor: _this6.props.isSvgLayer ? 'move' : 'default'
|
|
1491
1508
|
}
|
|
1492
1509
|
});
|
|
1493
1510
|
} else if (ann.type === 'pencil') {
|
|
1494
1511
|
return /*#__PURE__*/_react["default"].createElement("path", {
|
|
1495
1512
|
key: idx,
|
|
1496
|
-
d:
|
|
1513
|
+
d: _this6.buildSmoothPath(ann.points, width, height),
|
|
1497
1514
|
stroke: ann.color,
|
|
1498
1515
|
strokeWidth: "4",
|
|
1499
1516
|
fill: "none",
|
|
1500
1517
|
onMouseDown: function onMouseDown(e) {
|
|
1501
|
-
return
|
|
1518
|
+
return _this6.props.onShapeMouseDown(e, idx, ann);
|
|
1502
1519
|
},
|
|
1503
1520
|
style: {
|
|
1504
|
-
cursor:
|
|
1521
|
+
cursor: _this6.props.isSvgLayer ? 'move' : 'default'
|
|
1505
1522
|
}
|
|
1506
1523
|
});
|
|
1507
1524
|
}
|
|
@@ -1525,7 +1542,7 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1525
1542
|
}));
|
|
1526
1543
|
}
|
|
1527
1544
|
return null;
|
|
1528
|
-
})))), children, /*#__PURE__*/_react["default"].createElement("p", {
|
|
1545
|
+
}))) : null), children, /*#__PURE__*/_react["default"].createElement("p", {
|
|
1529
1546
|
className: "user-name-wrapper",
|
|
1530
1547
|
id: "watermark-text",
|
|
1531
1548
|
style: _objectSpread({}, watermark)
|
|
@@ -1533,11 +1550,11 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1533
1550
|
id: "outer",
|
|
1534
1551
|
currentSubtitleObj: currentSubtitleObj,
|
|
1535
1552
|
onClick: function onClick() {
|
|
1536
|
-
return
|
|
1553
|
+
return _this6.handleSubtitleContainerClick();
|
|
1537
1554
|
}
|
|
1538
1555
|
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
1539
1556
|
onClick: function onClick(e) {
|
|
1540
|
-
return
|
|
1557
|
+
return _this6.handleSubtitleClick(e);
|
|
1541
1558
|
},
|
|
1542
1559
|
className: "subtitleContainer longSubtitleStyles",
|
|
1543
1560
|
style: _objectSpread({}, currentSubtitleObj.style)
|