@desynova-digital/player 4.0.102 → 4.0.104
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/Player.js +18 -6
- package/components/Video.js +271 -165
- package/components/progress-bar/RenderCommentMarkers.js +47 -2
- package/package.json +1 -1
package/components/Player.js
CHANGED
|
@@ -446,6 +446,18 @@ var Player = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
446
446
|
this.actions.seek(start_time);
|
|
447
447
|
this.actions.handleVideoPreview(true);
|
|
448
448
|
}
|
|
449
|
+
}, {
|
|
450
|
+
key: "exitFullScreenMode",
|
|
451
|
+
value: function exitFullScreenMode() {
|
|
452
|
+
var _this$manager$getStat2 = this.manager.getState(),
|
|
453
|
+
player = _this$manager$getStat2.player;
|
|
454
|
+
var onRightMenuVisible = this.props.onRightMenuVisible;
|
|
455
|
+
this.actions.toggleFullscreen(player);
|
|
456
|
+
// Trigger UI change based for exit
|
|
457
|
+
var isFull = player === null || player === void 0 ? void 0 : player.isFullscreen;
|
|
458
|
+
onRightMenuVisible(isFull);
|
|
459
|
+
this.actions.toggleRightBar(player, isFull);
|
|
460
|
+
}
|
|
449
461
|
}, {
|
|
450
462
|
key: "getDefaultChildren",
|
|
451
463
|
value: function getDefaultChildren(props, fullProps) {
|
|
@@ -798,8 +810,8 @@ var Player = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
798
810
|
}, {
|
|
799
811
|
key: "handleResize",
|
|
800
812
|
value: function handleResize() {
|
|
801
|
-
var _this$manager$
|
|
802
|
-
player = _this$manager$
|
|
813
|
+
var _this$manager$getStat3 = this.manager.getState(),
|
|
814
|
+
player = _this$manager$getStat3.player;
|
|
803
815
|
var leftSectionRef = this._leftSectionRef;
|
|
804
816
|
var rightSectionRef = this._rightSectionRef;
|
|
805
817
|
var audioMeterBlock = this._audioMeterBlock;
|
|
@@ -962,8 +974,8 @@ var Player = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
962
974
|
}, {
|
|
963
975
|
key: "handleBlur",
|
|
964
976
|
value: function handleBlur() {
|
|
965
|
-
var _this$manager$
|
|
966
|
-
player = _this$manager$
|
|
977
|
+
var _this$manager$getStat4 = this.manager.getState(),
|
|
978
|
+
player = _this$manager$getStat4.player;
|
|
967
979
|
if (player.isFullscreen) return;
|
|
968
980
|
this.actions.activate(false);
|
|
969
981
|
}
|
|
@@ -981,8 +993,8 @@ var Player = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
981
993
|
value: function render() {
|
|
982
994
|
var _this6 = this,
|
|
983
995
|
_props$player;
|
|
984
|
-
var _this$manager$
|
|
985
|
-
player = _this$manager$
|
|
996
|
+
var _this$manager$getStat5 = this.manager.getState(),
|
|
997
|
+
player = _this$manager$getStat5.player;
|
|
986
998
|
var props = _objectSpread(_objectSpread({}, this.props), {}, {
|
|
987
999
|
player: player,
|
|
988
1000
|
actions: this.actions,
|
package/components/Video.js
CHANGED
|
@@ -197,6 +197,12 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
197
197
|
formattedTime: currentFormattedTime
|
|
198
198
|
};
|
|
199
199
|
});
|
|
200
|
+
_defineProperty(_this, "isFullscreenWithRightMenu", function () {
|
|
201
|
+
var _this$props3 = _this.props,
|
|
202
|
+
player = _this$props3.player,
|
|
203
|
+
isRightMenuVisible = _this$props3.isRightMenuVisible;
|
|
204
|
+
return !!(player !== null && player !== void 0 && player.isFullscreen && isRightMenuVisible);
|
|
205
|
+
});
|
|
200
206
|
_this.state = {
|
|
201
207
|
audioTracks: [],
|
|
202
208
|
isM3U8: false,
|
|
@@ -215,7 +221,12 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
215
221
|
isBuffering: false,
|
|
216
222
|
currentSubtitleObj: {},
|
|
217
223
|
shouldShowAnnotate: false,
|
|
218
|
-
annotationsVersion: 0
|
|
224
|
+
annotationsVersion: 0,
|
|
225
|
+
svgSize: {
|
|
226
|
+
width: 0,
|
|
227
|
+
height: 0
|
|
228
|
+
},
|
|
229
|
+
calculatedHeight: null
|
|
219
230
|
};
|
|
220
231
|
_this.video = null; // the html5 video
|
|
221
232
|
_this.manager = new _Manager["default"](props.store);
|
|
@@ -255,12 +266,16 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
255
266
|
_this.handleKeypress = _this.handleKeypress.bind(_this);
|
|
256
267
|
_this.audioVisualizer = _this.audioVisualizer.bind(_this);
|
|
257
268
|
_this.checkWatermark = _this.checkWatermark.bind(_this);
|
|
269
|
+
_this.updateSvgSize = _this.updateSvgSize.bind(_this);
|
|
270
|
+
_this.disconnectResizeObserver = _this.disconnectResizeObserver.bind(_this);
|
|
271
|
+
_this.calculateHeightBasedOnResolution = _this.calculateHeightBasedOnResolution.bind(_this);
|
|
258
272
|
return _this;
|
|
259
273
|
}
|
|
260
274
|
_inherits(Video, _Component);
|
|
261
275
|
return _createClass(Video, [{
|
|
262
276
|
key: "componentDidMount",
|
|
263
277
|
value: function componentDidMount() {
|
|
278
|
+
var _this2 = this;
|
|
264
279
|
var src = this.props.src;
|
|
265
280
|
var isM3U8 = src.split('.').pop() === 'm3u8' ? true : false;
|
|
266
281
|
this.setState({
|
|
@@ -280,33 +295,52 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
280
295
|
watermarkInterval: watermarkInterval
|
|
281
296
|
});
|
|
282
297
|
if (this.video) {
|
|
283
|
-
this.video.addEventListener(
|
|
298
|
+
this.video.addEventListener('timeupdate', this.onVideoTimeUpdate);
|
|
299
|
+
this.video.addEventListener('loadedmetadata', this.calculateHeightBasedOnResolution);
|
|
300
|
+
}
|
|
301
|
+
window.addEventListener('resize', this.calculateHeightBasedOnResolution);
|
|
302
|
+
this.updateSvgSize();
|
|
303
|
+
this.calculateHeightBasedOnResolution();
|
|
304
|
+
if (typeof ResizeObserver !== 'undefined' && this.playerBlock) {
|
|
305
|
+
this.resizeObserver = new ResizeObserver(function () {
|
|
306
|
+
_this2.updateSvgSize();
|
|
307
|
+
_this2.calculateHeightBasedOnResolution();
|
|
308
|
+
});
|
|
309
|
+
this.resizeObserver.observe(this.playerBlock);
|
|
284
310
|
}
|
|
285
311
|
}
|
|
286
312
|
}, {
|
|
287
313
|
key: "componentDidUpdate",
|
|
288
314
|
value: function componentDidUpdate(prevProps) {
|
|
289
|
-
var
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
315
|
+
var _this3 = this,
|
|
316
|
+
_prevProps$player;
|
|
317
|
+
var _this$props4 = this.props,
|
|
318
|
+
parentAnnotations = _this$props4.parentAnnotations,
|
|
319
|
+
inTime = _this$props4.inTime,
|
|
320
|
+
outTime = _this$props4.outTime,
|
|
321
|
+
isRightMenuVisible = _this$props4.isRightMenuVisible,
|
|
322
|
+
player = _this$props4.player;
|
|
294
323
|
var hasNewAnnotations = JSON.stringify(parentAnnotations) !== JSON.stringify(prevProps.parentAnnotations);
|
|
295
324
|
if (hasNewAnnotations) {
|
|
296
325
|
Promise.resolve().then(function () {
|
|
297
|
-
|
|
326
|
+
_this3.setState(function (prevState) {
|
|
298
327
|
return {
|
|
299
328
|
annotationsVersion: (prevState.annotationsVersion || 0) + 1
|
|
300
329
|
};
|
|
301
330
|
});
|
|
302
331
|
});
|
|
303
332
|
}
|
|
333
|
+
if (isRightMenuVisible !== prevProps.isRightMenuVisible || (player === null || player === void 0 ? void 0 : player.isFullscreen) !== ((_prevProps$player = prevProps.player) === null || _prevProps$player === void 0 ? void 0 : _prevProps$player.isFullscreen)) {
|
|
334
|
+
this.updateSvgSize();
|
|
335
|
+
this.calculateHeightBasedOnResolution();
|
|
336
|
+
}
|
|
304
337
|
if (this.props.isSvgLayer && this.props.isSvgLayer !== prevProps.isSvgLayer) {
|
|
305
338
|
this.toggleViaAnnotatePlay();
|
|
306
339
|
}
|
|
307
340
|
if (inTime !== prevProps.inTime || outTime !== prevProps.outTime) {
|
|
308
341
|
this.updateAnnotateVisibility();
|
|
309
342
|
}
|
|
343
|
+
this.updateSvgSize();
|
|
310
344
|
}
|
|
311
345
|
}, {
|
|
312
346
|
key: "componentWillUnmount",
|
|
@@ -321,8 +355,11 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
321
355
|
}
|
|
322
356
|
clearInterval(watermarkInterval);
|
|
323
357
|
if (this.video) {
|
|
324
|
-
this.video.removeEventListener(
|
|
358
|
+
this.video.removeEventListener('timeupdate', this.onVideoTimeUpdate);
|
|
359
|
+
this.video.removeEventListener('loadedmetadata', this.calculateHeightBasedOnResolution);
|
|
325
360
|
}
|
|
361
|
+
window.removeEventListener('resize', this.calculateHeightBasedOnResolution);
|
|
362
|
+
this.disconnectResizeObserver();
|
|
326
363
|
}
|
|
327
364
|
}, {
|
|
328
365
|
key: "checkWatermark",
|
|
@@ -332,9 +369,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
332
369
|
*/
|
|
333
370
|
function checkWatermark() {
|
|
334
371
|
var watermark = this.state.watermark;
|
|
335
|
-
var _this$
|
|
336
|
-
onPlayerClose = _this$
|
|
337
|
-
userEmail = _this$
|
|
372
|
+
var _this$props5 = this.props,
|
|
373
|
+
onPlayerClose = _this$props5.onPlayerClose,
|
|
374
|
+
userEmail = _this$props5.userEmail;
|
|
338
375
|
var watermark_text = document.querySelector('#watermark-text');
|
|
339
376
|
var video_player = null;
|
|
340
377
|
var watermark_dimension = null;
|
|
@@ -366,10 +403,10 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
366
403
|
}, {
|
|
367
404
|
key: "setupHLS",
|
|
368
405
|
value: function setupHLS(src) {
|
|
369
|
-
var
|
|
370
|
-
var _this$
|
|
371
|
-
actions = _this$
|
|
372
|
-
activeTrackIndex = _this$
|
|
406
|
+
var _this4 = this;
|
|
407
|
+
var _this$props6 = this.props,
|
|
408
|
+
actions = _this$props6.actions,
|
|
409
|
+
activeTrackIndex = _this$props6.activeTrackIndex;
|
|
373
410
|
var self = this;
|
|
374
411
|
// bind them together
|
|
375
412
|
this.hls.attachMedia(this.video);
|
|
@@ -390,18 +427,18 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
390
427
|
switch (data.type) {
|
|
391
428
|
case _hls["default"].ErrorTypes.NETWORK_ERROR:
|
|
392
429
|
// try to recover network error
|
|
393
|
-
|
|
430
|
+
_this4.hls.startLoad();
|
|
394
431
|
break;
|
|
395
432
|
case _hls["default"].ErrorTypes.MEDIA_ERROR:
|
|
396
|
-
|
|
433
|
+
_this4.hls.recoverMediaError();
|
|
397
434
|
break;
|
|
398
435
|
default:
|
|
399
436
|
// cannot recover
|
|
400
|
-
|
|
437
|
+
_this4.hls.destroy();
|
|
401
438
|
break;
|
|
402
439
|
}
|
|
403
440
|
} else if (data.details === 'internalException' && data.type === 'otherError' || data.details === 'bufferStalledError' && data.type === 'mediaError') {
|
|
404
|
-
|
|
441
|
+
_this4.hls.startLoad();
|
|
405
442
|
}
|
|
406
443
|
});
|
|
407
444
|
}
|
|
@@ -491,16 +528,16 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
491
528
|
}, {
|
|
492
529
|
key: "getStyle",
|
|
493
530
|
value: function getStyle() {
|
|
494
|
-
var _this$
|
|
495
|
-
fluid = _this$
|
|
496
|
-
noRightComponent = _this$
|
|
531
|
+
var _this$props7 = this.props,
|
|
532
|
+
fluid = _this$props7.fluid,
|
|
533
|
+
noRightComponent = _this$props7.noRightComponent;
|
|
497
534
|
var _this$manager$getStat2 = this.manager.getState(),
|
|
498
535
|
player = _this$manager$getStat2.player;
|
|
499
536
|
var style = {};
|
|
500
|
-
var _this$
|
|
501
|
-
aspectRatio = _this$
|
|
502
|
-
width = _this$
|
|
503
|
-
height = _this$
|
|
537
|
+
var _this$props8 = this.props,
|
|
538
|
+
aspectRatio = _this$props8.aspectRatio,
|
|
539
|
+
width = _this$props8.width,
|
|
540
|
+
height = _this$props8.height;
|
|
504
541
|
/*
|
|
505
542
|
* The aspect ratio is either used directly
|
|
506
543
|
* or to calculate width and height.
|
|
@@ -541,12 +578,12 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
541
578
|
}, {
|
|
542
579
|
key: "getProperties",
|
|
543
580
|
value: function getProperties() {
|
|
544
|
-
var
|
|
581
|
+
var _this5 = this;
|
|
545
582
|
if (!this.video) {
|
|
546
583
|
return null;
|
|
547
584
|
}
|
|
548
585
|
return _utils.mediaProperties.reduce(function (properties, key) {
|
|
549
|
-
properties[key] =
|
|
586
|
+
properties[key] = _this5.video[key];
|
|
550
587
|
return properties;
|
|
551
588
|
}, {});
|
|
552
589
|
}
|
|
@@ -604,12 +641,12 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
604
641
|
}, {
|
|
605
642
|
key: "UNSAFE_componentWillReceiveProps",
|
|
606
643
|
value: function UNSAFE_componentWillReceiveProps(newProps) {
|
|
607
|
-
var _this$
|
|
608
|
-
src = _this$
|
|
609
|
-
activeAudio = _this$
|
|
610
|
-
currentSubtitleObj = _this$
|
|
611
|
-
markers = _this$
|
|
612
|
-
playerType = _this$
|
|
644
|
+
var _this$props9 = this.props,
|
|
645
|
+
src = _this$props9.src,
|
|
646
|
+
activeAudio = _this$props9.player.activeAudio,
|
|
647
|
+
currentSubtitleObj = _this$props9.currentSubtitleObj,
|
|
648
|
+
markers = _this$props9.markers,
|
|
649
|
+
playerType = _this$props9.playerType;
|
|
613
650
|
if (markers && markers !== newProps.markers && newProps.markers) {
|
|
614
651
|
this.displaySubtitle(newProps.markers);
|
|
615
652
|
}
|
|
@@ -770,9 +807,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
770
807
|
}, {
|
|
771
808
|
key: "toggleFullscreen",
|
|
772
809
|
value: function toggleFullscreen() {
|
|
773
|
-
var _this$
|
|
774
|
-
player = _this$
|
|
775
|
-
actions = _this$
|
|
810
|
+
var _this$props10 = this.props,
|
|
811
|
+
player = _this$props10.player,
|
|
812
|
+
actions = _this$props10.actions;
|
|
776
813
|
actions.toggleFullscreen(player);
|
|
777
814
|
}
|
|
778
815
|
|
|
@@ -783,10 +820,10 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
783
820
|
}, {
|
|
784
821
|
key: "handleLoadStart",
|
|
785
822
|
value: function handleLoadStart() {
|
|
786
|
-
var _this$
|
|
787
|
-
actions = _this$
|
|
788
|
-
onLoadStart = _this$
|
|
789
|
-
fileType = _this$
|
|
823
|
+
var _this$props11 = this.props,
|
|
824
|
+
actions = _this$props11.actions,
|
|
825
|
+
onLoadStart = _this$props11.onLoadStart,
|
|
826
|
+
fileType = _this$props11.fileType;
|
|
790
827
|
if (fileType === 'audio') {
|
|
791
828
|
this.audioVisualizer();
|
|
792
829
|
}
|
|
@@ -803,9 +840,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
803
840
|
}, {
|
|
804
841
|
key: "handleCanPlay",
|
|
805
842
|
value: function handleCanPlay() {
|
|
806
|
-
var _this$
|
|
807
|
-
actions = _this$
|
|
808
|
-
onCanPlay = _this$
|
|
843
|
+
var _this$props12 = this.props,
|
|
844
|
+
actions = _this$props12.actions,
|
|
845
|
+
onCanPlay = _this$props12.onCanPlay;
|
|
809
846
|
actions.handleCanPlay(this.getProperties());
|
|
810
847
|
if (onCanPlay) {
|
|
811
848
|
onCanPlay.apply(void 0, arguments);
|
|
@@ -819,9 +856,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
819
856
|
}, {
|
|
820
857
|
key: "handleCanPlayThrough",
|
|
821
858
|
value: function handleCanPlayThrough() {
|
|
822
|
-
var _this$
|
|
823
|
-
actions = _this$
|
|
824
|
-
onCanPlayThrough = _this$
|
|
859
|
+
var _this$props13 = this.props,
|
|
860
|
+
actions = _this$props13.actions,
|
|
861
|
+
onCanPlayThrough = _this$props13.onCanPlayThrough;
|
|
825
862
|
actions.handleCanPlayThrough(this.getProperties());
|
|
826
863
|
if (onCanPlayThrough) {
|
|
827
864
|
onCanPlayThrough.apply(void 0, arguments);
|
|
@@ -835,9 +872,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
835
872
|
}, {
|
|
836
873
|
key: "handlePlaying",
|
|
837
874
|
value: function handlePlaying() {
|
|
838
|
-
var _this$
|
|
839
|
-
actions = _this$
|
|
840
|
-
onPlaying = _this$
|
|
875
|
+
var _this$props14 = this.props,
|
|
876
|
+
actions = _this$props14.actions,
|
|
877
|
+
onPlaying = _this$props14.onPlaying;
|
|
841
878
|
actions.handlePlaying(this.getProperties());
|
|
842
879
|
if (onPlaying) {
|
|
843
880
|
onPlaying.apply(void 0, arguments);
|
|
@@ -848,9 +885,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
848
885
|
}, {
|
|
849
886
|
key: "handlePlay",
|
|
850
887
|
value: function handlePlay() {
|
|
851
|
-
var _this$
|
|
852
|
-
actions = _this$
|
|
853
|
-
onPlay = _this$
|
|
888
|
+
var _this$props15 = this.props,
|
|
889
|
+
actions = _this$props15.actions,
|
|
890
|
+
onPlay = _this$props15.onPlay;
|
|
854
891
|
actions.handlePlay(this.getProperties());
|
|
855
892
|
if (onPlay) {
|
|
856
893
|
onPlay.apply(void 0, arguments);
|
|
@@ -861,9 +898,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
861
898
|
}, {
|
|
862
899
|
key: "handlePause",
|
|
863
900
|
value: function handlePause() {
|
|
864
|
-
var _this$
|
|
865
|
-
actions = _this$
|
|
866
|
-
onPause = _this$
|
|
901
|
+
var _this$props16 = this.props,
|
|
902
|
+
actions = _this$props16.actions,
|
|
903
|
+
onPause = _this$props16.onPause;
|
|
867
904
|
actions.handlePause(this.getProperties());
|
|
868
905
|
if (onPause) {
|
|
869
906
|
onPause.apply(void 0, arguments);
|
|
@@ -877,9 +914,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
877
914
|
}, {
|
|
878
915
|
key: "handleDurationChange",
|
|
879
916
|
value: function handleDurationChange() {
|
|
880
|
-
var _this$
|
|
881
|
-
actions = _this$
|
|
882
|
-
onDurationChange = _this$
|
|
917
|
+
var _this$props17 = this.props,
|
|
918
|
+
actions = _this$props17.actions,
|
|
919
|
+
onDurationChange = _this$props17.onDurationChange;
|
|
883
920
|
actions.handleDurationChange(this.getProperties());
|
|
884
921
|
if (onDurationChange) {
|
|
885
922
|
onDurationChange.apply(void 0, arguments);
|
|
@@ -893,9 +930,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
893
930
|
}, {
|
|
894
931
|
key: "handleProgress",
|
|
895
932
|
value: function handleProgress() {
|
|
896
|
-
var _this$
|
|
897
|
-
actions = _this$
|
|
898
|
-
onProgress = _this$
|
|
933
|
+
var _this$props18 = this.props,
|
|
934
|
+
actions = _this$props18.actions,
|
|
935
|
+
onProgress = _this$props18.onProgress;
|
|
899
936
|
if (this.video) {
|
|
900
937
|
actions.handleProgressChange(this.getProperties());
|
|
901
938
|
}
|
|
@@ -916,11 +953,11 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
916
953
|
}, {
|
|
917
954
|
key: "displaySubtitle",
|
|
918
955
|
value: function displaySubtitle(marker) {
|
|
919
|
-
var _this$
|
|
920
|
-
markers = _this$
|
|
921
|
-
resetSubtitleData = _this$
|
|
922
|
-
subtitleReadOnly = _this$
|
|
923
|
-
subtitleDataList = _this$
|
|
956
|
+
var _this$props19 = this.props,
|
|
957
|
+
markers = _this$props19.markers,
|
|
958
|
+
resetSubtitleData = _this$props19.resetSubtitleData,
|
|
959
|
+
subtitleReadOnly = _this$props19.subtitleReadOnly,
|
|
960
|
+
subtitleDataList = _this$props19.subtitleDataList;
|
|
924
961
|
var currentSubtitleObj = this.state.currentSubtitleObj;
|
|
925
962
|
if (resetSubtitleData) {
|
|
926
963
|
resetSubtitleData();
|
|
@@ -962,11 +999,11 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
962
999
|
}, {
|
|
963
1000
|
key: "handleEnded",
|
|
964
1001
|
value: function handleEnded() {
|
|
965
|
-
var _this$
|
|
966
|
-
loop = _this$
|
|
967
|
-
player = _this$
|
|
968
|
-
actions = _this$
|
|
969
|
-
onEnded = _this$
|
|
1002
|
+
var _this$props20 = this.props,
|
|
1003
|
+
loop = _this$props20.loop,
|
|
1004
|
+
player = _this$props20.player,
|
|
1005
|
+
actions = _this$props20.actions,
|
|
1006
|
+
onEnded = _this$props20.onEnded;
|
|
970
1007
|
if (loop) {
|
|
971
1008
|
this.seek(0);
|
|
972
1009
|
this.play();
|
|
@@ -983,9 +1020,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
983
1020
|
}, {
|
|
984
1021
|
key: "handleWaiting",
|
|
985
1022
|
value: function handleWaiting() {
|
|
986
|
-
var _this$
|
|
987
|
-
actions = _this$
|
|
988
|
-
onWaiting = _this$
|
|
1023
|
+
var _this$props21 = this.props,
|
|
1024
|
+
actions = _this$props21.actions,
|
|
1025
|
+
onWaiting = _this$props21.onWaiting;
|
|
989
1026
|
actions.handleWaiting(this.getProperties());
|
|
990
1027
|
if (onWaiting) {
|
|
991
1028
|
onWaiting.apply(void 0, arguments);
|
|
@@ -999,9 +1036,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
999
1036
|
}, {
|
|
1000
1037
|
key: "handleSeeking",
|
|
1001
1038
|
value: function handleSeeking() {
|
|
1002
|
-
var _this$
|
|
1003
|
-
actions = _this$
|
|
1004
|
-
onSeeking = _this$
|
|
1039
|
+
var _this$props22 = this.props,
|
|
1040
|
+
actions = _this$props22.actions,
|
|
1041
|
+
onSeeking = _this$props22.onSeeking;
|
|
1005
1042
|
actions.handleSeeking(this.getProperties());
|
|
1006
1043
|
if (onSeeking) {
|
|
1007
1044
|
onSeeking.apply(void 0, arguments);
|
|
@@ -1015,9 +1052,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1015
1052
|
}, {
|
|
1016
1053
|
key: "handleSeeked",
|
|
1017
1054
|
value: function handleSeeked() {
|
|
1018
|
-
var _this$
|
|
1019
|
-
actions = _this$
|
|
1020
|
-
onSeeked = _this$
|
|
1055
|
+
var _this$props23 = this.props,
|
|
1056
|
+
actions = _this$props23.actions,
|
|
1057
|
+
onSeeked = _this$props23.onSeeked;
|
|
1021
1058
|
actions.handleSeeked(this.getProperties());
|
|
1022
1059
|
if (onSeeked) {
|
|
1023
1060
|
onSeeked.apply(void 0, arguments);
|
|
@@ -1036,9 +1073,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1036
1073
|
}, {
|
|
1037
1074
|
key: "handleSuspend",
|
|
1038
1075
|
value: function handleSuspend() {
|
|
1039
|
-
var _this$
|
|
1040
|
-
actions = _this$
|
|
1041
|
-
onSuspend = _this$
|
|
1076
|
+
var _this$props24 = this.props,
|
|
1077
|
+
actions = _this$props24.actions,
|
|
1078
|
+
onSuspend = _this$props24.onSuspend;
|
|
1042
1079
|
actions.handleSuspend(this.getProperties());
|
|
1043
1080
|
if (onSuspend) {
|
|
1044
1081
|
onSuspend.apply(void 0, arguments);
|
|
@@ -1049,9 +1086,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1049
1086
|
}, {
|
|
1050
1087
|
key: "handleAbort",
|
|
1051
1088
|
value: function handleAbort() {
|
|
1052
|
-
var _this$
|
|
1053
|
-
actions = _this$
|
|
1054
|
-
onAbort = _this$
|
|
1089
|
+
var _this$props25 = this.props,
|
|
1090
|
+
actions = _this$props25.actions,
|
|
1091
|
+
onAbort = _this$props25.onAbort;
|
|
1055
1092
|
actions.handleAbort(this.getProperties());
|
|
1056
1093
|
if (onAbort) {
|
|
1057
1094
|
onAbort.apply(void 0, arguments);
|
|
@@ -1062,9 +1099,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1062
1099
|
}, {
|
|
1063
1100
|
key: "handleEmptied",
|
|
1064
1101
|
value: function handleEmptied() {
|
|
1065
|
-
var _this$
|
|
1066
|
-
actions = _this$
|
|
1067
|
-
onEmptied = _this$
|
|
1102
|
+
var _this$props26 = this.props,
|
|
1103
|
+
actions = _this$props26.actions,
|
|
1104
|
+
onEmptied = _this$props26.onEmptied;
|
|
1068
1105
|
actions.handleEmptied(this.getProperties());
|
|
1069
1106
|
if (onEmptied) {
|
|
1070
1107
|
onEmptied.apply(void 0, arguments);
|
|
@@ -1078,9 +1115,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1078
1115
|
}, {
|
|
1079
1116
|
key: "handleStalled",
|
|
1080
1117
|
value: function handleStalled() {
|
|
1081
|
-
var _this$
|
|
1082
|
-
actions = _this$
|
|
1083
|
-
onStalled = _this$
|
|
1118
|
+
var _this$props27 = this.props,
|
|
1119
|
+
actions = _this$props27.actions,
|
|
1120
|
+
onStalled = _this$props27.onStalled;
|
|
1084
1121
|
actions.handleStalled(this.getProperties());
|
|
1085
1122
|
if (onStalled) {
|
|
1086
1123
|
onStalled.apply(void 0, arguments);
|
|
@@ -1094,10 +1131,10 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1094
1131
|
}, {
|
|
1095
1132
|
key: "handleLoadedMetaData",
|
|
1096
1133
|
value: function handleLoadedMetaData() {
|
|
1097
|
-
var _this$
|
|
1098
|
-
actions = _this$
|
|
1099
|
-
onLoadedMetadata = _this$
|
|
1100
|
-
startTime = _this$
|
|
1134
|
+
var _this$props28 = this.props,
|
|
1135
|
+
actions = _this$props28.actions,
|
|
1136
|
+
onLoadedMetadata = _this$props28.onLoadedMetadata,
|
|
1137
|
+
startTime = _this$props28.startTime;
|
|
1101
1138
|
if (startTime && startTime > 0) {
|
|
1102
1139
|
this.video.currentTime = startTime;
|
|
1103
1140
|
}
|
|
@@ -1114,9 +1151,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1114
1151
|
}, {
|
|
1115
1152
|
key: "handleLoadedData",
|
|
1116
1153
|
value: function handleLoadedData() {
|
|
1117
|
-
var _this$
|
|
1118
|
-
actions = _this$
|
|
1119
|
-
onLoadedData = _this$
|
|
1154
|
+
var _this$props29 = this.props,
|
|
1155
|
+
actions = _this$props29.actions,
|
|
1156
|
+
onLoadedData = _this$props29.onLoadedData;
|
|
1120
1157
|
actions.handleLoadedData(this.getProperties());
|
|
1121
1158
|
if (onLoadedData) {
|
|
1122
1159
|
onLoadedData.apply(void 0, arguments);
|
|
@@ -1130,11 +1167,11 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1130
1167
|
}, {
|
|
1131
1168
|
key: "handleTimeUpdate",
|
|
1132
1169
|
value: function handleTimeUpdate() {
|
|
1133
|
-
var _this$
|
|
1134
|
-
previewActive = _this$
|
|
1135
|
-
actions = _this$
|
|
1136
|
-
onTimeUpdate = _this$
|
|
1137
|
-
rightMarker = _this$
|
|
1170
|
+
var _this$props30 = this.props,
|
|
1171
|
+
previewActive = _this$props30.player.previewActive,
|
|
1172
|
+
actions = _this$props30.actions,
|
|
1173
|
+
onTimeUpdate = _this$props30.onTimeUpdate,
|
|
1174
|
+
rightMarker = _this$props30.playerSelectedMarker.rightMarker;
|
|
1138
1175
|
|
|
1139
1176
|
//for annotation time updataton for svg
|
|
1140
1177
|
var _this$getTimeData3 = this.getTimeData(this.video.currentTime),
|
|
@@ -1162,9 +1199,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1162
1199
|
}, {
|
|
1163
1200
|
key: "handleRateChange",
|
|
1164
1201
|
value: function handleRateChange() {
|
|
1165
|
-
var _this$
|
|
1166
|
-
actions = _this$
|
|
1167
|
-
onRateChange = _this$
|
|
1202
|
+
var _this$props31 = this.props,
|
|
1203
|
+
actions = _this$props31.actions,
|
|
1204
|
+
onRateChange = _this$props31.onRateChange;
|
|
1168
1205
|
actions.handleRateChange(this.getProperties());
|
|
1169
1206
|
if (onRateChange) {
|
|
1170
1207
|
onRateChange.apply(void 0, arguments);
|
|
@@ -1175,9 +1212,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1175
1212
|
}, {
|
|
1176
1213
|
key: "handleVolumeChange",
|
|
1177
1214
|
value: function handleVolumeChange() {
|
|
1178
|
-
var _this$
|
|
1179
|
-
actions = _this$
|
|
1180
|
-
onVolumeChange = _this$
|
|
1215
|
+
var _this$props32 = this.props,
|
|
1216
|
+
actions = _this$props32.actions,
|
|
1217
|
+
onVolumeChange = _this$props32.onVolumeChange;
|
|
1181
1218
|
actions.handleVolumeChange(this.getProperties());
|
|
1182
1219
|
if (onVolumeChange) {
|
|
1183
1220
|
onVolumeChange.apply(void 0, arguments);
|
|
@@ -1191,9 +1228,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1191
1228
|
}, {
|
|
1192
1229
|
key: "handleError",
|
|
1193
1230
|
value: function handleError() {
|
|
1194
|
-
var _this$
|
|
1195
|
-
actions = _this$
|
|
1196
|
-
onError = _this$
|
|
1231
|
+
var _this$props33 = this.props,
|
|
1232
|
+
actions = _this$props33.actions,
|
|
1233
|
+
onError = _this$props33.onError;
|
|
1197
1234
|
actions.handleError(this.getProperties());
|
|
1198
1235
|
if (onError) {
|
|
1199
1236
|
onError.apply(void 0, arguments);
|
|
@@ -1202,6 +1239,74 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1202
1239
|
}, {
|
|
1203
1240
|
key: "handleKeypress",
|
|
1204
1241
|
value: function handleKeypress() {}
|
|
1242
|
+
}, {
|
|
1243
|
+
key: "updateSvgSize",
|
|
1244
|
+
value: function updateSvgSize() {
|
|
1245
|
+
var el = this.video || this.playerBlock || this.video && this.video.parentNode;
|
|
1246
|
+
if (!el || typeof el.getBoundingClientRect !== 'function') return;
|
|
1247
|
+
var rect = el.getBoundingClientRect();
|
|
1248
|
+
var next = {
|
|
1249
|
+
width: Math.round(rect.width),
|
|
1250
|
+
height: Math.round(rect.height)
|
|
1251
|
+
};
|
|
1252
|
+
var svgSize = this.state.svgSize;
|
|
1253
|
+
if (svgSize.width !== next.width || svgSize.height !== next.height) {
|
|
1254
|
+
this.setState({
|
|
1255
|
+
svgSize: next
|
|
1256
|
+
});
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
}, {
|
|
1260
|
+
key: "calculateHeightBasedOnResolution",
|
|
1261
|
+
value: function calculateHeightBasedOnResolution() {
|
|
1262
|
+
var _this$props34 = this.props,
|
|
1263
|
+
player = _this$props34.player,
|
|
1264
|
+
isRightMenuVisible = _this$props34.isRightMenuVisible,
|
|
1265
|
+
heightRatio = _this$props34.heightRatio;
|
|
1266
|
+
var ratio = typeof heightRatio === 'number' ? heightRatio : 1;
|
|
1267
|
+
if (!(player !== null && player !== void 0 && player.isFullscreen) || !isRightMenuVisible) {
|
|
1268
|
+
if (this.state.calculatedHeight !== null) {
|
|
1269
|
+
this.setState({
|
|
1270
|
+
calculatedHeight: null
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
1273
|
+
return;
|
|
1274
|
+
}
|
|
1275
|
+
try {
|
|
1276
|
+
var videoElement = this.video;
|
|
1277
|
+
if (!videoElement) return;
|
|
1278
|
+
var videoWidth = videoElement.videoWidth;
|
|
1279
|
+
var videoHeight = videoElement.videoHeight;
|
|
1280
|
+
if (!videoWidth || !videoHeight) return;
|
|
1281
|
+
var aspectRatio = videoWidth / videoHeight;
|
|
1282
|
+
var leftVideoSection = document.querySelector('.left-video-section');
|
|
1283
|
+
if (!leftVideoSection) return;
|
|
1284
|
+
var containerWidth = leftVideoSection.getBoundingClientRect().width;
|
|
1285
|
+
var newHeight = aspectRatio < 1.5 ? containerWidth * (3 / 4) : containerWidth * (9 / 16);
|
|
1286
|
+
var finalHeight = newHeight * ratio;
|
|
1287
|
+
if (this.state.calculatedHeight !== finalHeight) {
|
|
1288
|
+
this.setState({
|
|
1289
|
+
calculatedHeight: finalHeight
|
|
1290
|
+
});
|
|
1291
|
+
}
|
|
1292
|
+
} catch (error) {
|
|
1293
|
+
// eslint-disable-next-line no-console
|
|
1294
|
+
console.error('Error calculating height:', error);
|
|
1295
|
+
if (this.state.calculatedHeight !== null) {
|
|
1296
|
+
this.setState({
|
|
1297
|
+
calculatedHeight: null
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
}, {
|
|
1303
|
+
key: "disconnectResizeObserver",
|
|
1304
|
+
value: function disconnectResizeObserver() {
|
|
1305
|
+
if (this.resizeObserver) {
|
|
1306
|
+
this.resizeObserver.disconnect();
|
|
1307
|
+
this.resizeObserver = null;
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1205
1310
|
}, {
|
|
1206
1311
|
key: "audioVisualizer",
|
|
1207
1312
|
value: function audioVisualizer() {
|
|
@@ -1253,7 +1358,7 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1253
1358
|
}, {
|
|
1254
1359
|
key: "renderChildren",
|
|
1255
1360
|
value: function renderChildren() {
|
|
1256
|
-
var
|
|
1361
|
+
var _this6 = this;
|
|
1257
1362
|
var props = _objectSpread(_objectSpread({}, this.props), {}, {
|
|
1258
1363
|
video: this.video
|
|
1259
1364
|
});
|
|
@@ -1275,7 +1380,7 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1275
1380
|
if (preOnError) {
|
|
1276
1381
|
preOnError.apply(void 0, arguments);
|
|
1277
1382
|
}
|
|
1278
|
-
|
|
1383
|
+
_this6.handleError.apply(_this6, arguments);
|
|
1279
1384
|
};
|
|
1280
1385
|
}
|
|
1281
1386
|
} else {
|
|
@@ -1287,9 +1392,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1287
1392
|
}, {
|
|
1288
1393
|
key: "handleSubtitleContainerClick",
|
|
1289
1394
|
value: function handleSubtitleContainerClick() {
|
|
1290
|
-
var _this$
|
|
1291
|
-
actions = _this$
|
|
1292
|
-
player = _this$
|
|
1395
|
+
var _this$props35 = this.props,
|
|
1396
|
+
actions = _this$props35.actions,
|
|
1397
|
+
player = _this$props35.player;
|
|
1293
1398
|
if (player.paused) {
|
|
1294
1399
|
actions.play();
|
|
1295
1400
|
} else {
|
|
@@ -1299,11 +1404,11 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1299
1404
|
}, {
|
|
1300
1405
|
key: "handleSubtitleClick",
|
|
1301
1406
|
value: function handleSubtitleClick(e) {
|
|
1302
|
-
var _this$
|
|
1303
|
-
actions = _this$
|
|
1304
|
-
player = _this$
|
|
1305
|
-
onScreenSubtitleClick = _this$
|
|
1306
|
-
controlType = _this$
|
|
1407
|
+
var _this$props36 = this.props,
|
|
1408
|
+
actions = _this$props36.actions,
|
|
1409
|
+
player = _this$props36.player,
|
|
1410
|
+
onScreenSubtitleClick = _this$props36.onScreenSubtitleClick,
|
|
1411
|
+
controlType = _this$props36.controlType;
|
|
1307
1412
|
var currentSubtitleObj = this.state.currentSubtitleObj;
|
|
1308
1413
|
if (controlType === 'advanced') {
|
|
1309
1414
|
if (onScreenSubtitleClick) {
|
|
@@ -1323,37 +1428,37 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1323
1428
|
}, {
|
|
1324
1429
|
key: "render",
|
|
1325
1430
|
value: function render() {
|
|
1326
|
-
var
|
|
1431
|
+
var _this7 = this,
|
|
1327
1432
|
_this$props$parentAnn,
|
|
1328
1433
|
_this$props$parentAnn2,
|
|
1329
1434
|
_this$props$parentAnn3,
|
|
1330
1435
|
_this$props$parentAnn4;
|
|
1331
|
-
var _this$
|
|
1332
|
-
loop = _this$
|
|
1333
|
-
poster = _this$
|
|
1334
|
-
preload = _this$
|
|
1335
|
-
autoPlay = _this$
|
|
1336
|
-
playsInline = _this$
|
|
1337
|
-
muted = _this$
|
|
1338
|
-
crossOrigin = _this$
|
|
1339
|
-
videoId = _this$
|
|
1340
|
-
fileType = _this$
|
|
1341
|
-
userEmail = _this$
|
|
1342
|
-
theme = _this$
|
|
1343
|
-
player = _this$
|
|
1344
|
-
playerType = _this$
|
|
1345
|
-
markers = _this$
|
|
1346
|
-
isRightMenuVisible = _this$
|
|
1436
|
+
var _this$props37 = this.props,
|
|
1437
|
+
loop = _this$props37.loop,
|
|
1438
|
+
poster = _this$props37.poster,
|
|
1439
|
+
preload = _this$props37.preload,
|
|
1440
|
+
autoPlay = _this$props37.autoPlay,
|
|
1441
|
+
playsInline = _this$props37.playsInline,
|
|
1442
|
+
muted = _this$props37.muted,
|
|
1443
|
+
crossOrigin = _this$props37.crossOrigin,
|
|
1444
|
+
videoId = _this$props37.videoId,
|
|
1445
|
+
fileType = _this$props37.fileType,
|
|
1446
|
+
userEmail = _this$props37.userEmail,
|
|
1447
|
+
theme = _this$props37.theme,
|
|
1448
|
+
player = _this$props37.player,
|
|
1449
|
+
playerType = _this$props37.playerType,
|
|
1450
|
+
markers = _this$props37.markers,
|
|
1451
|
+
isRightMenuVisible = _this$props37.isRightMenuVisible;
|
|
1347
1452
|
var _this$state2 = this.state,
|
|
1348
1453
|
isBuffering = _this$state2.isBuffering,
|
|
1349
1454
|
watermark = _this$state2.watermark,
|
|
1350
1455
|
currentSubtitleObj = _this$state2.currentSubtitleObj;
|
|
1351
1456
|
var children = this.getChildren(this.props);
|
|
1352
|
-
var isSubtitleActive = player.SubtitleStatus && playerType ===
|
|
1457
|
+
var isSubtitleActive = player.SubtitleStatus && playerType === 'default' || playerType === 'subtitle' && markers && markers.length || player.SubtitleStatus;
|
|
1353
1458
|
return /*#__PURE__*/_react["default"].createElement(VideoBlock, {
|
|
1354
1459
|
className: "video-react-player-block",
|
|
1355
1460
|
ref: function ref(c) {
|
|
1356
|
-
|
|
1461
|
+
_this7.playerBlock = c;
|
|
1357
1462
|
},
|
|
1358
1463
|
style: this.getStyle(),
|
|
1359
1464
|
HDBorder: player.HDBorderActive,
|
|
@@ -1363,7 +1468,7 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1363
1468
|
}, isBuffering && /*#__PURE__*/_react["default"].createElement("div", {
|
|
1364
1469
|
className: "loader-container",
|
|
1365
1470
|
onClick: function onClick() {
|
|
1366
|
-
return
|
|
1471
|
+
return _this7.togglePlay();
|
|
1367
1472
|
}
|
|
1368
1473
|
}, /*#__PURE__*/_react["default"].createElement(_components.Loader, {
|
|
1369
1474
|
theme: theme,
|
|
@@ -1371,7 +1476,7 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1371
1476
|
})) || null, fileType === 'audio' ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("canvas", {
|
|
1372
1477
|
id: "canvas",
|
|
1373
1478
|
ref: function ref(c) {
|
|
1374
|
-
|
|
1479
|
+
_this7.canvas = c;
|
|
1375
1480
|
},
|
|
1376
1481
|
style: {
|
|
1377
1482
|
top: 0,
|
|
@@ -1382,7 +1487,7 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1382
1487
|
id: videoId,
|
|
1383
1488
|
crossOrigin: "anonymous",
|
|
1384
1489
|
ref: function ref(c) {
|
|
1385
|
-
|
|
1490
|
+
_this7.video = c;
|
|
1386
1491
|
},
|
|
1387
1492
|
muted: muted,
|
|
1388
1493
|
preload: preload,
|
|
@@ -1418,7 +1523,7 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1418
1523
|
id: videoId,
|
|
1419
1524
|
crossOrigin: crossOrigin,
|
|
1420
1525
|
ref: function ref(c) {
|
|
1421
|
-
|
|
1526
|
+
_this7.video = c;
|
|
1422
1527
|
},
|
|
1423
1528
|
muted: muted,
|
|
1424
1529
|
preload: preload,
|
|
@@ -1451,23 +1556,24 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1451
1556
|
}, /*#__PURE__*/_react["default"].createElement("track", {
|
|
1452
1557
|
kind: "captions"
|
|
1453
1558
|
}), 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", {
|
|
1454
|
-
key: "".concat(this.state.annotationsVersion),
|
|
1559
|
+
key: "".concat(this.state.annotationsVersion, "-").concat(this.state.svgSize.width, "x").concat(this.state.svgSize.height, "-").concat(this.state.calculatedHeight),
|
|
1455
1560
|
ref: this.props.playerSvgRef,
|
|
1456
1561
|
onMouseDown: this.props.handleMouseDown,
|
|
1457
1562
|
onMouseMove: this.props.handleMouseMove,
|
|
1458
1563
|
onMouseUp: this.props.handleMouseUp,
|
|
1459
1564
|
style: {
|
|
1460
1565
|
position: 'absolute',
|
|
1461
|
-
top: 0,
|
|
1462
|
-
left: 0,
|
|
1463
|
-
width: '100%',
|
|
1464
|
-
height: '100%',
|
|
1566
|
+
top: this.isFullscreenWithRightMenu() ? '50%' : 0,
|
|
1567
|
+
left: this.isFullscreenWithRightMenu() ? '50%' : 0,
|
|
1568
|
+
width: this.isFullscreenWithRightMenu() ? this.state.svgSize.width : '100%',
|
|
1569
|
+
height: this.isFullscreenWithRightMenu() ? "".concat(this.state.calculatedHeight) : '100%',
|
|
1465
1570
|
pointerEvents: this.state.shouldShowAnnotate ? 'auto' : 'none',
|
|
1466
|
-
zIndex:
|
|
1571
|
+
zIndex: 1,
|
|
1572
|
+
transform: this.isFullscreenWithRightMenu() ? 'translate(-50%, -50%)' : 'none'
|
|
1467
1573
|
}
|
|
1468
1574
|
}, ((_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) {
|
|
1469
|
-
var
|
|
1470
|
-
var svg = (
|
|
1575
|
+
var _this7$props$playerSv;
|
|
1576
|
+
var svg = (_this7$props$playerSv = _this7.props.playerSvgRef) === null || _this7$props$playerSv === void 0 ? void 0 : _this7$props$playerSv.current;
|
|
1471
1577
|
if (!svg) return null;
|
|
1472
1578
|
var svgData = svg.getBoundingClientRect();
|
|
1473
1579
|
var width = svgData.width;
|
|
@@ -1487,10 +1593,10 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1487
1593
|
strokeWidth: "4",
|
|
1488
1594
|
fill: "none",
|
|
1489
1595
|
onMouseDown: function onMouseDown(e) {
|
|
1490
|
-
return
|
|
1596
|
+
return _this7.props.onShapeMouseDown(e, idx, ann);
|
|
1491
1597
|
},
|
|
1492
1598
|
style: {
|
|
1493
|
-
cursor:
|
|
1599
|
+
cursor: _this7.props.isSvgLayer ? 'move' : 'default'
|
|
1494
1600
|
}
|
|
1495
1601
|
});
|
|
1496
1602
|
} else if (ann.type === 'line' || ann.type === 'arrow') {
|
|
@@ -1508,25 +1614,25 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1508
1614
|
strokeWidth: "4",
|
|
1509
1615
|
markerEnd: ann.type === 'arrow' ? "url(#open-arrowhead-".concat(ann.color.replace('#', ''), "-").concat(idx, ")") : undefined,
|
|
1510
1616
|
onMouseDown: function onMouseDown(e) {
|
|
1511
|
-
return
|
|
1617
|
+
return _this7.props.onShapeMouseDown(e, idx, ann);
|
|
1512
1618
|
},
|
|
1513
1619
|
style: {
|
|
1514
1620
|
color: ann.color,
|
|
1515
|
-
cursor:
|
|
1621
|
+
cursor: _this7.props.isSvgLayer ? 'move' : 'default'
|
|
1516
1622
|
}
|
|
1517
1623
|
});
|
|
1518
1624
|
} else if (ann.type === 'pencil') {
|
|
1519
1625
|
return /*#__PURE__*/_react["default"].createElement("path", {
|
|
1520
1626
|
key: idx,
|
|
1521
|
-
d:
|
|
1627
|
+
d: _this7.buildSmoothPath(ann.points, width, height),
|
|
1522
1628
|
stroke: ann.color,
|
|
1523
1629
|
strokeWidth: "4",
|
|
1524
1630
|
fill: "none",
|
|
1525
1631
|
onMouseDown: function onMouseDown(e) {
|
|
1526
|
-
return
|
|
1632
|
+
return _this7.props.onShapeMouseDown(e, idx, ann);
|
|
1527
1633
|
},
|
|
1528
1634
|
style: {
|
|
1529
|
-
cursor:
|
|
1635
|
+
cursor: _this7.props.isSvgLayer ? 'move' : 'default'
|
|
1530
1636
|
}
|
|
1531
1637
|
});
|
|
1532
1638
|
}
|
|
@@ -1558,11 +1664,11 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1558
1664
|
id: "outer",
|
|
1559
1665
|
currentSubtitleObj: currentSubtitleObj,
|
|
1560
1666
|
onClick: function onClick() {
|
|
1561
|
-
return
|
|
1667
|
+
return _this7.handleSubtitleContainerClick();
|
|
1562
1668
|
}
|
|
1563
1669
|
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
1564
1670
|
onClick: function onClick(e) {
|
|
1565
|
-
return
|
|
1671
|
+
return _this7.handleSubtitleClick(e);
|
|
1566
1672
|
},
|
|
1567
1673
|
className: "subtitleContainer longSubtitleStyles",
|
|
1568
1674
|
style: _objectSpread({}, currentSubtitleObj.style)
|
|
@@ -89,7 +89,6 @@ var clampHoverBoxLeft = function clampHoverBoxLeft(rawLeftPx, boxWidth, containe
|
|
|
89
89
|
MAIN COMPONENT
|
|
90
90
|
---------------------------------------------------------- */
|
|
91
91
|
var RenderCommentMarkers = function RenderCommentMarkers(_ref) {
|
|
92
|
-
var _containerRef$current;
|
|
93
92
|
var _ref$data = _ref.data,
|
|
94
93
|
data = _ref$data === void 0 ? [] : _ref$data,
|
|
95
94
|
_ref$duration = _ref.duration,
|
|
@@ -118,6 +117,53 @@ var RenderCommentMarkers = function RenderCommentMarkers(_ref) {
|
|
|
118
117
|
var isLineVisible = function isLineVisible(time) {
|
|
119
118
|
return hovered === time || hoverBoxHold && hovered === time;
|
|
120
119
|
};
|
|
120
|
+
var _useState5 = (0, _react.useState)(0),
|
|
121
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
122
|
+
containerWidth = _useState6[0],
|
|
123
|
+
setContainerWidth = _useState6[1];
|
|
124
|
+
|
|
125
|
+
// Measure eagerly during layout to avoid first-paint misalignment.
|
|
126
|
+
(0, _react.useLayoutEffect)(function () {
|
|
127
|
+
var measure = function measure() {
|
|
128
|
+
var _containerRef$current;
|
|
129
|
+
return setContainerWidth(((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.offsetWidth) || 0);
|
|
130
|
+
};
|
|
131
|
+
measure();
|
|
132
|
+
// double rAF to catch layout after fullscreen/right-panel changes
|
|
133
|
+
requestAnimationFrame(function () {
|
|
134
|
+
return requestAnimationFrame(measure);
|
|
135
|
+
});
|
|
136
|
+
}, []);
|
|
137
|
+
|
|
138
|
+
// Keep width in sync on first render, fullscreen toggle, right-menu visibility, and resize.
|
|
139
|
+
(0, _react.useEffect)(function () {
|
|
140
|
+
var updateWidth = function updateWidth() {
|
|
141
|
+
var _containerRef$current2;
|
|
142
|
+
return setContainerWidth(((_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.offsetWidth) || 0);
|
|
143
|
+
};
|
|
144
|
+
updateWidth();
|
|
145
|
+
requestAnimationFrame(updateWidth);
|
|
146
|
+
var onResize = function onResize() {
|
|
147
|
+
return updateWidth();
|
|
148
|
+
};
|
|
149
|
+
window.addEventListener('resize', onResize);
|
|
150
|
+
return function () {
|
|
151
|
+
return window.removeEventListener('resize', onResize);
|
|
152
|
+
};
|
|
153
|
+
}, [isRightMenuVisible, player === null || player === void 0 ? void 0 : player.isFullscreen]);
|
|
154
|
+
|
|
155
|
+
// Observe container size for layout shifts.
|
|
156
|
+
(0, _react.useEffect)(function () {
|
|
157
|
+
if (!containerRef.current || typeof ResizeObserver === 'undefined') return;
|
|
158
|
+
var observer = new ResizeObserver(function () {
|
|
159
|
+
var _containerRef$current3;
|
|
160
|
+
return setContainerWidth(((_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.offsetWidth) || 0);
|
|
161
|
+
});
|
|
162
|
+
observer.observe(containerRef.current);
|
|
163
|
+
return function () {
|
|
164
|
+
return observer.disconnect();
|
|
165
|
+
};
|
|
166
|
+
}, [containerRef.current]);
|
|
121
167
|
var handleMouseEnter = function handleMouseEnter(time) {
|
|
122
168
|
clearTimeout(hideTimer.current);
|
|
123
169
|
setHovered(time);
|
|
@@ -147,7 +193,6 @@ var RenderCommentMarkers = function RenderCommentMarkers(_ref) {
|
|
|
147
193
|
data.forEach(function (item, i) {
|
|
148
194
|
originalIndexMap.set(item.id, i);
|
|
149
195
|
});
|
|
150
|
-
var containerWidth = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.offsetWidth;
|
|
151
196
|
return /*#__PURE__*/_react["default"].createElement(MarkerTimeline, {
|
|
152
197
|
ref: containerRef
|
|
153
198
|
}, Object.entries(grouped).map(function (_ref2) {
|