@desynova-digital/player 4.0.62 → 4.0.64
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 +45 -7
- package/components/Shortcut.js +17 -1
- package/components/Video.js +326 -132
- package/package.json +1 -1
package/components/Player.js
CHANGED
|
@@ -359,6 +359,16 @@ var Player = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
359
359
|
key: "getDefaultChildren",
|
|
360
360
|
value: function getDefaultChildren(props, fullProps) {
|
|
361
361
|
var _this2 = this;
|
|
362
|
+
var _this$props3 = this.props,
|
|
363
|
+
playerSvgRef = _this$props3.playerSvgRef,
|
|
364
|
+
parentAnnotations = _this$props3.parentAnnotations,
|
|
365
|
+
onShapeMouseDown = _this$props3.onShapeMouseDown,
|
|
366
|
+
handleMouseDown = _this$props3.handleMouseDown,
|
|
367
|
+
handleMouseMove = _this$props3.handleMouseMove,
|
|
368
|
+
handleMouseUp = _this$props3.handleMouseUp,
|
|
369
|
+
isSvgLayer = _this$props3.isSvgLayer,
|
|
370
|
+
inTime = _this$props3.inTime,
|
|
371
|
+
outTime = _this$props3.outTime;
|
|
362
372
|
return [/*#__PURE__*/_react["default"].createElement(_PlayerHeader["default"], _extends({
|
|
363
373
|
ref: function ref(c) {
|
|
364
374
|
_this2._playerHeader = c;
|
|
@@ -370,6 +380,15 @@ var Player = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
370
380
|
_this2.video = c;
|
|
371
381
|
_this2.manager.video = _this2.video;
|
|
372
382
|
},
|
|
383
|
+
playerSvgRef: playerSvgRef,
|
|
384
|
+
parentAnnotations: parentAnnotations,
|
|
385
|
+
onShapeMouseDown: onShapeMouseDown,
|
|
386
|
+
handleMouseDown: handleMouseDown,
|
|
387
|
+
handleMouseMove: handleMouseMove,
|
|
388
|
+
handleMouseUp: handleMouseUp,
|
|
389
|
+
isSvgLayer: isSvgLayer,
|
|
390
|
+
inTime: inTime,
|
|
391
|
+
outTime: outTime,
|
|
373
392
|
key: "video",
|
|
374
393
|
order: 2
|
|
375
394
|
}, fullProps)), /*#__PURE__*/_react["default"].createElement(_ProgressControl["default"], _extends({
|
|
@@ -434,6 +453,16 @@ var Player = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
434
453
|
key: "getAdvancedChildren",
|
|
435
454
|
value: function getAdvancedChildren(props, fullProps) {
|
|
436
455
|
var _this4 = this;
|
|
456
|
+
var _this$props4 = this.props,
|
|
457
|
+
playerSvgRef = _this$props4.playerSvgRef,
|
|
458
|
+
parentAnnotations = _this$props4.parentAnnotations,
|
|
459
|
+
onShapeMouseDown = _this$props4.onShapeMouseDown,
|
|
460
|
+
handleMouseDown = _this$props4.handleMouseDown,
|
|
461
|
+
handleMouseMove = _this$props4.handleMouseMove,
|
|
462
|
+
handleMouseUp = _this$props4.handleMouseUp,
|
|
463
|
+
isSvgLayer = _this$props4.isSvgLayer,
|
|
464
|
+
inTime = _this$props4.inTime,
|
|
465
|
+
outTime = _this$props4.outTime;
|
|
437
466
|
return [/*#__PURE__*/_react["default"].createElement(_PlayerHeader["default"], _extends({
|
|
438
467
|
ref: function ref(c) {
|
|
439
468
|
_this4._playerHeader = c;
|
|
@@ -445,6 +474,15 @@ var Player = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
445
474
|
_this4.video = c;
|
|
446
475
|
_this4.manager.video = _this4.video;
|
|
447
476
|
},
|
|
477
|
+
playerSvgRef: playerSvgRef,
|
|
478
|
+
parentAnnotations: parentAnnotations,
|
|
479
|
+
onShapeMouseDown: onShapeMouseDown,
|
|
480
|
+
handleMouseDown: handleMouseDown,
|
|
481
|
+
handleMouseMove: handleMouseMove,
|
|
482
|
+
handleMouseUp: handleMouseUp,
|
|
483
|
+
isSvgLayer: isSvgLayer,
|
|
484
|
+
inTime: inTime,
|
|
485
|
+
outTime: outTime,
|
|
448
486
|
key: "video",
|
|
449
487
|
order: 0.0
|
|
450
488
|
}, fullProps)), /*#__PURE__*/_react["default"].createElement(_ControlBar["default"], _extends({
|
|
@@ -631,10 +669,10 @@ var Player = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
631
669
|
var controlBar = (0, _reactDom.findDOMNode)(this._controlBar);
|
|
632
670
|
var playlist = (0, _reactDom.findDOMNode)(this._playlist);
|
|
633
671
|
var playerContainer = (0, _reactDom.findDOMNode)(this._playerContainer);
|
|
634
|
-
var _this$
|
|
635
|
-
controlType = _this$
|
|
636
|
-
playerType = _this$
|
|
637
|
-
fileType = _this$
|
|
672
|
+
var _this$props5 = this.props,
|
|
673
|
+
controlType = _this$props5.controlType,
|
|
674
|
+
playerType = _this$props5.playerType,
|
|
675
|
+
fileType = _this$props5.fileType;
|
|
638
676
|
var height = 0;
|
|
639
677
|
_toConsumableArray(leftSectionRef.children).forEach(function (child) {
|
|
640
678
|
return height += child.offsetHeight;
|
|
@@ -747,9 +785,9 @@ var Player = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
747
785
|
video: this.video ? this.video.video : null
|
|
748
786
|
});
|
|
749
787
|
var childrensLeft = this.getChildren(props, 'left');
|
|
750
|
-
var _this$
|
|
751
|
-
rightSection = _this$
|
|
752
|
-
playerType = _this$
|
|
788
|
+
var _this$props6 = this.props,
|
|
789
|
+
rightSection = _this$props6.rightSection,
|
|
790
|
+
playerType = _this$props6.playerType;
|
|
753
791
|
return /*#__PURE__*/_react["default"].createElement(PlayerBlock, {
|
|
754
792
|
ref: function ref(c) {
|
|
755
793
|
_this5.manager.rootElement = c;
|
package/components/Shortcut.js
CHANGED
|
@@ -308,12 +308,27 @@ var Shortcut = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
308
308
|
disablePlayerActions = _this$props4.disablePlayerActions,
|
|
309
309
|
playerSelectedMarker = _this$props4.playerSelectedMarker,
|
|
310
310
|
frameRate = _this$props4.frameRate,
|
|
311
|
-
onMarkerSelect = _this$props4.onMarkerSelect
|
|
311
|
+
onMarkerSelect = _this$props4.onMarkerSelect,
|
|
312
|
+
pauseOnOutMarkerSelect = _this$props4.pauseOnOutMarkerSelect;
|
|
312
313
|
var isHandleDisabled = ["snp_edit", "promo_review", "pgm_edit", "dubbing_review"].includes(playerType);
|
|
314
|
+
if (!player.paused) {
|
|
315
|
+
actions.pause({
|
|
316
|
+
action: 'pause',
|
|
317
|
+
source: 'shortcut'
|
|
318
|
+
});
|
|
319
|
+
actions.seek(player.currentTime);
|
|
320
|
+
}
|
|
313
321
|
if (!isHandleDisabled) {
|
|
314
322
|
if (playerReadOnlyMode || disablePlayerActions.includes('marking_controls')) {
|
|
315
323
|
return;
|
|
316
324
|
}
|
|
325
|
+
if (pauseOnOutMarkerSelect && !player.paused) {
|
|
326
|
+
actions.pause({
|
|
327
|
+
action: 'pause',
|
|
328
|
+
source: 'shortcut'
|
|
329
|
+
});
|
|
330
|
+
actions.seek(player.currentTime);
|
|
331
|
+
}
|
|
317
332
|
var currentAdjustedTime = (0, _utils.handleAdjustingVideoAsPerFrame)(player.currentTime, frameRate);
|
|
318
333
|
for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
319
334
|
args[_key2 - 2] = arguments[_key2];
|
|
@@ -370,6 +385,7 @@ var Shortcut = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
370
385
|
onAddMarker(_currentAdjustedTime, playerSelectedMarker === null || playerSelectedMarker === void 0 ? void 0 : playerSelectedMarker.rightMarker, '', false, {
|
|
371
386
|
markerType: 'create'
|
|
372
387
|
});
|
|
388
|
+
actions.seek(player.currentTime);
|
|
373
389
|
}
|
|
374
390
|
}
|
|
375
391
|
}
|
package/components/Video.js
CHANGED
|
@@ -15,19 +15,23 @@ var _BigPlayButton = _interopRequireDefault(require("./BigPlayButton"));
|
|
|
15
15
|
var _PosterImage = _interopRequireDefault(require("./PosterImage"));
|
|
16
16
|
var _SDOutline = _interopRequireDefault(require("./SDOutline"));
|
|
17
17
|
var _components = require("@desynova-digital/components/components");
|
|
18
|
+
var _utils2 = require("@desynova-digital/player/utils");
|
|
18
19
|
var _templateObject, _templateObject2;
|
|
19
20
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
20
21
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
21
22
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
22
23
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
23
24
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
24
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
25
25
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
26
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
27
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
28
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
29
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
30
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
31
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
26
32
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
27
33
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
28
34
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
29
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
30
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
31
35
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
32
36
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
33
37
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
@@ -35,6 +39,9 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
35
39
|
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
36
40
|
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
37
41
|
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
42
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
43
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
44
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
38
45
|
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
39
46
|
var propTypes = {
|
|
40
47
|
actions: _propTypes.PropTypes.instanceOf(Object),
|
|
@@ -97,7 +104,7 @@ var defaultProps = {
|
|
|
97
104
|
crossOrigin: 'anonymous',
|
|
98
105
|
theme: 'dark'
|
|
99
106
|
};
|
|
100
|
-
var SubTitleSection = _styledComponents["default"].div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n font-family: SFUIText-Regular;\n font-size: 16px;\n bottom: 20px;\n width: 100%;\n display: flex;\n justify-content: center;\n text-align: center;\n color: #ffffff;\n height: 90%;\n align-items: center;\n\n .subtitleContainer {\n border-radius: 4px;\n width: fit-content;\n background: #000000;\n opacity: 0.9;\n padding: ", ";\n line-height: 20px;\n position: absolute;\n\n i
|
|
107
|
+
var SubTitleSection = _styledComponents["default"].div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n font-family: SFUIText-Regular;\n font-size: 16px;\n bottom: 20px;\n width: 100%;\n display: flex;\n justify-content: center;\n text-align: center;\n color: #ffffff;\n height: 90%;\n align-items: center;\n\n .subtitleContainer {\n border-radius: 4px;\n width: fit-content;\n background: #000000;\n opacity: 0.9;\n padding: ", ";\n line-height: 20px;\n position: absolute;\n\n i,\n em {\n font-style: italic; /* Override the font style for <em> tags inside elements with the class .someClass */\n }\n\n strong {\n font-weight: bold;\n }\n }\n .longSubtitleStyles {\n overflow-y: auto;\n height: fit-content;\n max-height: 70px;\n max-width: 75%;\n width: fit-content;\n }\n"])), function (props) {
|
|
101
108
|
return props.currentSubtitleObj && props.currentSubtitleObj.line1 ? '8px 10px' : '0px';
|
|
102
109
|
});
|
|
103
110
|
var VideoBlock = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n &.video-react-player-block {\n position: relative;\n transition: all 0.1s ease-in-out;\n -moz-transition: all 0.1s ease-in-out;\n -webkit-transition: all 0.1s ease-in-out;\n -ms-transition: all 0.1s ease-in-out;\n -o-transition: all 0.1s ease-in-out;\n video {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n right: 0;\n bottom: 0;\n }\n .audio-tracks {\n position: relative;\n display: flex;\n background: rgba(0, 0, 0, 0.5);\n color: #fff;\n z-index: 10;\n position: absolute;\n width: 100%;\n bottom: 0;\n p {\n cursor: pointer;\n padding: 10px;\n }\n }\n .loader-container {\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n z-index: 10;\n background: rgba(0, 0, 0, 0.5);\n }\n }\n &.ratio-border {\n // border: 1px solid rgba(255, 255, 255, 0.5);\n &:after {\n content: ", ";\n position: absolute;\n color: #fff;\n font-family: SFUIText-Regular;\n font-size: 12px;\n transform: rotate(-90deg);\n top: 20%;\n left: -50px;\n }\n }\n"])), function (props) {
|
|
@@ -108,6 +115,56 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
108
115
|
var _this;
|
|
109
116
|
_classCallCheck(this, Video);
|
|
110
117
|
_this = _callSuper(this, Video, [props]);
|
|
118
|
+
_defineProperty(_this, "buildSmoothPath", function (points) {
|
|
119
|
+
if (!points || points.length < 2) return '';
|
|
120
|
+
var path = "M ".concat(points[0].x, " ").concat(points[0].y);
|
|
121
|
+
for (var i = 1; i < points.length - 1; i++) {
|
|
122
|
+
var midX = (points[i].x + points[i + 1].x) / 2;
|
|
123
|
+
var midY = (points[i].y + points[i + 1].y) / 2;
|
|
124
|
+
path += " Q ".concat(points[i].x, " ").concat(points[i].y, " ").concat(midX, " ").concat(midY);
|
|
125
|
+
}
|
|
126
|
+
var last = points[points.length - 1];
|
|
127
|
+
path += " L ".concat(last.x, " ").concat(last.y);
|
|
128
|
+
return path;
|
|
129
|
+
});
|
|
130
|
+
_defineProperty(_this, "getTimeData", function (time) {
|
|
131
|
+
var _this$props = _this.props,
|
|
132
|
+
inTime = _this$props.inTime,
|
|
133
|
+
outTime = _this$props.outTime,
|
|
134
|
+
initialTime = _this$props.initialTime,
|
|
135
|
+
frameRate = _this$props.frameRate;
|
|
136
|
+
var currentFormattedTime = (0, _utils.secondsToTime)(time, frameRate, initialTime);
|
|
137
|
+
var timecodeToSeconds = function timecodeToSeconds(tc) {
|
|
138
|
+
if (!tc || tc === '-1') return null;
|
|
139
|
+
var _tc$split$map = tc.split(':').map(Number),
|
|
140
|
+
_tc$split$map2 = _slicedToArray(_tc$split$map, 4),
|
|
141
|
+
hh = _tc$split$map2[0],
|
|
142
|
+
mm = _tc$split$map2[1],
|
|
143
|
+
ss = _tc$split$map2[2],
|
|
144
|
+
ff = _tc$split$map2[3];
|
|
145
|
+
var newTime = hh * 3600 + mm * 60 + ss + (ff || 0) / frameRate;
|
|
146
|
+
return newTime;
|
|
147
|
+
};
|
|
148
|
+
var roundTo = function roundTo(value) {
|
|
149
|
+
var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
150
|
+
return value !== null ? Number(value.toFixed(precision)) : null;
|
|
151
|
+
};
|
|
152
|
+
var inSeconds = roundTo(timecodeToSeconds(inTime, 'inTime'));
|
|
153
|
+
var outSeconds = roundTo(timecodeToSeconds(outTime, 'outTime'));
|
|
154
|
+
var currentSeconds = roundTo(timecodeToSeconds(currentFormattedTime, 'currentFormattedTime'));
|
|
155
|
+
var shouldShow = false;
|
|
156
|
+
if (inSeconds !== null) {
|
|
157
|
+
if (outSeconds === null || outSeconds === 0) {
|
|
158
|
+
shouldShow = currentSeconds >= inSeconds && currentSeconds <= inSeconds;
|
|
159
|
+
} else {
|
|
160
|
+
shouldShow = currentSeconds >= inSeconds && currentSeconds <= outSeconds;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
shouldShow: shouldShow,
|
|
165
|
+
formattedTime: currentFormattedTime
|
|
166
|
+
};
|
|
167
|
+
});
|
|
111
168
|
_this.state = {
|
|
112
169
|
audioTracks: [],
|
|
113
170
|
isM3U8: false,
|
|
@@ -124,7 +181,8 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
124
181
|
},
|
|
125
182
|
watermarkInterval: -1,
|
|
126
183
|
isBuffering: false,
|
|
127
|
-
currentSubtitleObj: {}
|
|
184
|
+
currentSubtitleObj: {},
|
|
185
|
+
shouldShowAnnotate: false
|
|
128
186
|
};
|
|
129
187
|
_this.video = null; // the html5 video
|
|
130
188
|
_this.manager = new _Manager["default"](props.store);
|
|
@@ -189,6 +247,13 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
189
247
|
watermarkInterval: watermarkInterval
|
|
190
248
|
});
|
|
191
249
|
}
|
|
250
|
+
}, {
|
|
251
|
+
key: "componentDidUpdate",
|
|
252
|
+
value: function componentDidUpdate(prevProps) {
|
|
253
|
+
if (this.props.isSvgLayer && this.props.isSvgLayer !== prevProps.isSvgLayer) {
|
|
254
|
+
this.toggleViaAnnotatePlay();
|
|
255
|
+
}
|
|
256
|
+
}
|
|
192
257
|
}, {
|
|
193
258
|
key: "componentWillUnmount",
|
|
194
259
|
value: function componentWillUnmount() {
|
|
@@ -210,9 +275,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
210
275
|
key: "checkWatermark",
|
|
211
276
|
value: function checkWatermark() {
|
|
212
277
|
var watermark = this.state.watermark;
|
|
213
|
-
var _this$
|
|
214
|
-
onPlayerClose = _this$
|
|
215
|
-
userEmail = _this$
|
|
278
|
+
var _this$props2 = this.props,
|
|
279
|
+
onPlayerClose = _this$props2.onPlayerClose,
|
|
280
|
+
userEmail = _this$props2.userEmail;
|
|
216
281
|
var watermark_text = document.querySelector('#watermark-text');
|
|
217
282
|
var video_player = null;
|
|
218
283
|
var watermark_dimension = null;
|
|
@@ -245,9 +310,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
245
310
|
key: "setupHLS",
|
|
246
311
|
value: function setupHLS(src) {
|
|
247
312
|
var _this2 = this;
|
|
248
|
-
var _this$
|
|
249
|
-
actions = _this$
|
|
250
|
-
activeTrackIndex = _this$
|
|
313
|
+
var _this$props3 = this.props,
|
|
314
|
+
actions = _this$props3.actions,
|
|
315
|
+
activeTrackIndex = _this$props3.activeTrackIndex;
|
|
251
316
|
var self = this;
|
|
252
317
|
// bind them together
|
|
253
318
|
this.hls.attachMedia(this.video);
|
|
@@ -333,10 +398,10 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
333
398
|
paddingLeftRatio: " 0.9",
|
|
334
399
|
text: "",
|
|
335
400
|
keyData: "sixteenNineSafeArea"
|
|
336
|
-
}, props))
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
401
|
+
}, props))
|
|
402
|
+
//comment as per ticket 2302 of annotattion tools
|
|
403
|
+
// <BigPlayButton key="big-play-button" order={5.0} {...props} />
|
|
404
|
+
];
|
|
340
405
|
}
|
|
341
406
|
}, {
|
|
342
407
|
key: "getChildren",
|
|
@@ -373,10 +438,10 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
373
438
|
var _this$manager$getStat2 = this.manager.getState(),
|
|
374
439
|
player = _this$manager$getStat2.player;
|
|
375
440
|
var style = {};
|
|
376
|
-
var _this$
|
|
377
|
-
aspectRatio = _this$
|
|
378
|
-
width = _this$
|
|
379
|
-
height = _this$
|
|
441
|
+
var _this$props4 = this.props,
|
|
442
|
+
aspectRatio = _this$props4.aspectRatio,
|
|
443
|
+
width = _this$props4.width,
|
|
444
|
+
height = _this$props4.height;
|
|
380
445
|
/*
|
|
381
446
|
* The aspect ratio is either used directly
|
|
382
447
|
* or to calculate width and height.
|
|
@@ -479,12 +544,12 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
479
544
|
}, {
|
|
480
545
|
key: "UNSAFE_componentWillReceiveProps",
|
|
481
546
|
value: function UNSAFE_componentWillReceiveProps(newProps) {
|
|
482
|
-
var _this$
|
|
483
|
-
src = _this$
|
|
484
|
-
activeAudio = _this$
|
|
485
|
-
currentSubtitleObj = _this$
|
|
486
|
-
markers = _this$
|
|
487
|
-
playerType = _this$
|
|
547
|
+
var _this$props5 = this.props,
|
|
548
|
+
src = _this$props5.src,
|
|
549
|
+
activeAudio = _this$props5.player.activeAudio,
|
|
550
|
+
currentSubtitleObj = _this$props5.currentSubtitleObj,
|
|
551
|
+
markers = _this$props5.markers,
|
|
552
|
+
playerType = _this$props5.playerType;
|
|
488
553
|
if (markers && markers !== newProps.markers && newProps.markers) {
|
|
489
554
|
this.displaySubtitle(newProps.markers);
|
|
490
555
|
}
|
|
@@ -593,11 +658,28 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
593
658
|
}
|
|
594
659
|
}
|
|
595
660
|
|
|
661
|
+
// toggle play via annotate button
|
|
662
|
+
}, {
|
|
663
|
+
key: "toggleViaAnnotatePlay",
|
|
664
|
+
value: function toggleViaAnnotatePlay() {
|
|
665
|
+
if (!this.video.paused) {
|
|
666
|
+
this.pause();
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
|
|
596
670
|
// seek video by time
|
|
597
671
|
}, {
|
|
598
672
|
key: "seek",
|
|
599
673
|
value: function seek(time) {
|
|
600
674
|
try {
|
|
675
|
+
//for annotation time updatation for svg
|
|
676
|
+
var _this$getTimeData = this.getTimeData(this.video.currentTime),
|
|
677
|
+
shouldShow = _this$getTimeData.shouldShow;
|
|
678
|
+
if (this.state.shouldShowAnnotate !== shouldShow) {
|
|
679
|
+
this.setState({
|
|
680
|
+
shouldShowAnnotate: shouldShow
|
|
681
|
+
});
|
|
682
|
+
}
|
|
601
683
|
var updatedTime = 0;
|
|
602
684
|
var frameRate = this.props.frameRate;
|
|
603
685
|
if (time < 0) {
|
|
@@ -628,9 +710,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
628
710
|
}, {
|
|
629
711
|
key: "toggleFullscreen",
|
|
630
712
|
value: function toggleFullscreen() {
|
|
631
|
-
var _this$
|
|
632
|
-
player = _this$
|
|
633
|
-
actions = _this$
|
|
713
|
+
var _this$props6 = this.props,
|
|
714
|
+
player = _this$props6.player,
|
|
715
|
+
actions = _this$props6.actions;
|
|
634
716
|
actions.toggleFullscreen(player);
|
|
635
717
|
}
|
|
636
718
|
|
|
@@ -641,10 +723,10 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
641
723
|
}, {
|
|
642
724
|
key: "handleLoadStart",
|
|
643
725
|
value: function handleLoadStart() {
|
|
644
|
-
var _this$
|
|
645
|
-
actions = _this$
|
|
646
|
-
onLoadStart = _this$
|
|
647
|
-
fileType = _this$
|
|
726
|
+
var _this$props7 = this.props,
|
|
727
|
+
actions = _this$props7.actions,
|
|
728
|
+
onLoadStart = _this$props7.onLoadStart,
|
|
729
|
+
fileType = _this$props7.fileType;
|
|
648
730
|
if (fileType === 'audio') {
|
|
649
731
|
this.audioVisualizer();
|
|
650
732
|
}
|
|
@@ -661,9 +743,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
661
743
|
}, {
|
|
662
744
|
key: "handleCanPlay",
|
|
663
745
|
value: function handleCanPlay() {
|
|
664
|
-
var _this$
|
|
665
|
-
actions = _this$
|
|
666
|
-
onCanPlay = _this$
|
|
746
|
+
var _this$props8 = this.props,
|
|
747
|
+
actions = _this$props8.actions,
|
|
748
|
+
onCanPlay = _this$props8.onCanPlay;
|
|
667
749
|
actions.handleCanPlay(this.getProperties());
|
|
668
750
|
if (onCanPlay) {
|
|
669
751
|
onCanPlay.apply(void 0, arguments);
|
|
@@ -677,9 +759,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
677
759
|
}, {
|
|
678
760
|
key: "handleCanPlayThrough",
|
|
679
761
|
value: function handleCanPlayThrough() {
|
|
680
|
-
var _this$
|
|
681
|
-
actions = _this$
|
|
682
|
-
onCanPlayThrough = _this$
|
|
762
|
+
var _this$props9 = this.props,
|
|
763
|
+
actions = _this$props9.actions,
|
|
764
|
+
onCanPlayThrough = _this$props9.onCanPlayThrough;
|
|
683
765
|
actions.handleCanPlayThrough(this.getProperties());
|
|
684
766
|
if (onCanPlayThrough) {
|
|
685
767
|
onCanPlayThrough.apply(void 0, arguments);
|
|
@@ -693,9 +775,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
693
775
|
}, {
|
|
694
776
|
key: "handlePlaying",
|
|
695
777
|
value: function handlePlaying() {
|
|
696
|
-
var _this$
|
|
697
|
-
actions = _this$
|
|
698
|
-
onPlaying = _this$
|
|
778
|
+
var _this$props10 = this.props,
|
|
779
|
+
actions = _this$props10.actions,
|
|
780
|
+
onPlaying = _this$props10.onPlaying;
|
|
699
781
|
actions.handlePlaying(this.getProperties());
|
|
700
782
|
if (onPlaying) {
|
|
701
783
|
onPlaying.apply(void 0, arguments);
|
|
@@ -706,9 +788,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
706
788
|
}, {
|
|
707
789
|
key: "handlePlay",
|
|
708
790
|
value: function handlePlay() {
|
|
709
|
-
var _this$
|
|
710
|
-
actions = _this$
|
|
711
|
-
onPlay = _this$
|
|
791
|
+
var _this$props11 = this.props,
|
|
792
|
+
actions = _this$props11.actions,
|
|
793
|
+
onPlay = _this$props11.onPlay;
|
|
712
794
|
actions.handlePlay(this.getProperties());
|
|
713
795
|
if (onPlay) {
|
|
714
796
|
onPlay.apply(void 0, arguments);
|
|
@@ -719,9 +801,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
719
801
|
}, {
|
|
720
802
|
key: "handlePause",
|
|
721
803
|
value: function handlePause() {
|
|
722
|
-
var _this$
|
|
723
|
-
actions = _this$
|
|
724
|
-
onPause = _this$
|
|
804
|
+
var _this$props12 = this.props,
|
|
805
|
+
actions = _this$props12.actions,
|
|
806
|
+
onPause = _this$props12.onPause;
|
|
725
807
|
actions.handlePause(this.getProperties());
|
|
726
808
|
if (onPause) {
|
|
727
809
|
onPause.apply(void 0, arguments);
|
|
@@ -735,9 +817,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
735
817
|
}, {
|
|
736
818
|
key: "handleDurationChange",
|
|
737
819
|
value: function handleDurationChange() {
|
|
738
|
-
var _this$
|
|
739
|
-
actions = _this$
|
|
740
|
-
onDurationChange = _this$
|
|
820
|
+
var _this$props13 = this.props,
|
|
821
|
+
actions = _this$props13.actions,
|
|
822
|
+
onDurationChange = _this$props13.onDurationChange;
|
|
741
823
|
actions.handleDurationChange(this.getProperties());
|
|
742
824
|
if (onDurationChange) {
|
|
743
825
|
onDurationChange.apply(void 0, arguments);
|
|
@@ -751,9 +833,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
751
833
|
}, {
|
|
752
834
|
key: "handleProgress",
|
|
753
835
|
value: function handleProgress() {
|
|
754
|
-
var _this$
|
|
755
|
-
actions = _this$
|
|
756
|
-
onProgress = _this$
|
|
836
|
+
var _this$props14 = this.props,
|
|
837
|
+
actions = _this$props14.actions,
|
|
838
|
+
onProgress = _this$props14.onProgress;
|
|
757
839
|
if (this.video) {
|
|
758
840
|
actions.handleProgressChange(this.getProperties());
|
|
759
841
|
}
|
|
@@ -774,11 +856,11 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
774
856
|
}, {
|
|
775
857
|
key: "displaySubtitle",
|
|
776
858
|
value: function displaySubtitle(marker) {
|
|
777
|
-
var _this$
|
|
778
|
-
markers = _this$
|
|
779
|
-
resetSubtitleData = _this$
|
|
780
|
-
subtitleReadOnly = _this$
|
|
781
|
-
subtitleDataList = _this$
|
|
859
|
+
var _this$props15 = this.props,
|
|
860
|
+
markers = _this$props15.markers,
|
|
861
|
+
resetSubtitleData = _this$props15.resetSubtitleData,
|
|
862
|
+
subtitleReadOnly = _this$props15.subtitleReadOnly,
|
|
863
|
+
subtitleDataList = _this$props15.subtitleDataList;
|
|
782
864
|
var currentSubtitleObj = this.state.currentSubtitleObj;
|
|
783
865
|
if (resetSubtitleData) {
|
|
784
866
|
resetSubtitleData();
|
|
@@ -820,11 +902,11 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
820
902
|
}, {
|
|
821
903
|
key: "handleEnded",
|
|
822
904
|
value: function handleEnded() {
|
|
823
|
-
var _this$
|
|
824
|
-
loop = _this$
|
|
825
|
-
player = _this$
|
|
826
|
-
actions = _this$
|
|
827
|
-
onEnded = _this$
|
|
905
|
+
var _this$props16 = this.props,
|
|
906
|
+
loop = _this$props16.loop,
|
|
907
|
+
player = _this$props16.player,
|
|
908
|
+
actions = _this$props16.actions,
|
|
909
|
+
onEnded = _this$props16.onEnded;
|
|
828
910
|
if (loop) {
|
|
829
911
|
this.seek(0);
|
|
830
912
|
this.play();
|
|
@@ -841,9 +923,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
841
923
|
}, {
|
|
842
924
|
key: "handleWaiting",
|
|
843
925
|
value: function handleWaiting() {
|
|
844
|
-
var _this$
|
|
845
|
-
actions = _this$
|
|
846
|
-
onWaiting = _this$
|
|
926
|
+
var _this$props17 = this.props,
|
|
927
|
+
actions = _this$props17.actions,
|
|
928
|
+
onWaiting = _this$props17.onWaiting;
|
|
847
929
|
actions.handleWaiting(this.getProperties());
|
|
848
930
|
if (onWaiting) {
|
|
849
931
|
onWaiting.apply(void 0, arguments);
|
|
@@ -857,9 +939,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
857
939
|
}, {
|
|
858
940
|
key: "handleSeeking",
|
|
859
941
|
value: function handleSeeking() {
|
|
860
|
-
var _this$
|
|
861
|
-
actions = _this$
|
|
862
|
-
onSeeking = _this$
|
|
942
|
+
var _this$props18 = this.props,
|
|
943
|
+
actions = _this$props18.actions,
|
|
944
|
+
onSeeking = _this$props18.onSeeking;
|
|
863
945
|
actions.handleSeeking(this.getProperties());
|
|
864
946
|
if (onSeeking) {
|
|
865
947
|
onSeeking.apply(void 0, arguments);
|
|
@@ -873,9 +955,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
873
955
|
}, {
|
|
874
956
|
key: "handleSeeked",
|
|
875
957
|
value: function handleSeeked() {
|
|
876
|
-
var _this$
|
|
877
|
-
actions = _this$
|
|
878
|
-
onSeeked = _this$
|
|
958
|
+
var _this$props19 = this.props,
|
|
959
|
+
actions = _this$props19.actions,
|
|
960
|
+
onSeeked = _this$props19.onSeeked;
|
|
879
961
|
actions.handleSeeked(this.getProperties());
|
|
880
962
|
if (onSeeked) {
|
|
881
963
|
onSeeked.apply(void 0, arguments);
|
|
@@ -894,9 +976,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
894
976
|
}, {
|
|
895
977
|
key: "handleSuspend",
|
|
896
978
|
value: function handleSuspend() {
|
|
897
|
-
var _this$
|
|
898
|
-
actions = _this$
|
|
899
|
-
onSuspend = _this$
|
|
979
|
+
var _this$props20 = this.props,
|
|
980
|
+
actions = _this$props20.actions,
|
|
981
|
+
onSuspend = _this$props20.onSuspend;
|
|
900
982
|
actions.handleSuspend(this.getProperties());
|
|
901
983
|
if (onSuspend) {
|
|
902
984
|
onSuspend.apply(void 0, arguments);
|
|
@@ -907,9 +989,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
907
989
|
}, {
|
|
908
990
|
key: "handleAbort",
|
|
909
991
|
value: function handleAbort() {
|
|
910
|
-
var _this$
|
|
911
|
-
actions = _this$
|
|
912
|
-
onAbort = _this$
|
|
992
|
+
var _this$props21 = this.props,
|
|
993
|
+
actions = _this$props21.actions,
|
|
994
|
+
onAbort = _this$props21.onAbort;
|
|
913
995
|
actions.handleAbort(this.getProperties());
|
|
914
996
|
if (onAbort) {
|
|
915
997
|
onAbort.apply(void 0, arguments);
|
|
@@ -920,9 +1002,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
920
1002
|
}, {
|
|
921
1003
|
key: "handleEmptied",
|
|
922
1004
|
value: function handleEmptied() {
|
|
923
|
-
var _this$
|
|
924
|
-
actions = _this$
|
|
925
|
-
onEmptied = _this$
|
|
1005
|
+
var _this$props22 = this.props,
|
|
1006
|
+
actions = _this$props22.actions,
|
|
1007
|
+
onEmptied = _this$props22.onEmptied;
|
|
926
1008
|
actions.handleEmptied(this.getProperties());
|
|
927
1009
|
if (onEmptied) {
|
|
928
1010
|
onEmptied.apply(void 0, arguments);
|
|
@@ -936,9 +1018,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
936
1018
|
}, {
|
|
937
1019
|
key: "handleStalled",
|
|
938
1020
|
value: function handleStalled() {
|
|
939
|
-
var _this$
|
|
940
|
-
actions = _this$
|
|
941
|
-
onStalled = _this$
|
|
1021
|
+
var _this$props23 = this.props,
|
|
1022
|
+
actions = _this$props23.actions,
|
|
1023
|
+
onStalled = _this$props23.onStalled;
|
|
942
1024
|
actions.handleStalled(this.getProperties());
|
|
943
1025
|
if (onStalled) {
|
|
944
1026
|
onStalled.apply(void 0, arguments);
|
|
@@ -952,10 +1034,10 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
952
1034
|
}, {
|
|
953
1035
|
key: "handleLoadedMetaData",
|
|
954
1036
|
value: function handleLoadedMetaData() {
|
|
955
|
-
var _this$
|
|
956
|
-
actions = _this$
|
|
957
|
-
onLoadedMetadata = _this$
|
|
958
|
-
startTime = _this$
|
|
1037
|
+
var _this$props24 = this.props,
|
|
1038
|
+
actions = _this$props24.actions,
|
|
1039
|
+
onLoadedMetadata = _this$props24.onLoadedMetadata,
|
|
1040
|
+
startTime = _this$props24.startTime;
|
|
959
1041
|
if (startTime && startTime > 0) {
|
|
960
1042
|
this.video.currentTime = startTime;
|
|
961
1043
|
}
|
|
@@ -972,9 +1054,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
972
1054
|
}, {
|
|
973
1055
|
key: "handleLoadedData",
|
|
974
1056
|
value: function handleLoadedData() {
|
|
975
|
-
var _this$
|
|
976
|
-
actions = _this$
|
|
977
|
-
onLoadedData = _this$
|
|
1057
|
+
var _this$props25 = this.props,
|
|
1058
|
+
actions = _this$props25.actions,
|
|
1059
|
+
onLoadedData = _this$props25.onLoadedData;
|
|
978
1060
|
actions.handleLoadedData(this.getProperties());
|
|
979
1061
|
if (onLoadedData) {
|
|
980
1062
|
onLoadedData.apply(void 0, arguments);
|
|
@@ -988,11 +1070,20 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
988
1070
|
}, {
|
|
989
1071
|
key: "handleTimeUpdate",
|
|
990
1072
|
value: function handleTimeUpdate() {
|
|
991
|
-
var _this$
|
|
992
|
-
previewActive = _this$
|
|
993
|
-
actions = _this$
|
|
994
|
-
onTimeUpdate = _this$
|
|
995
|
-
rightMarker = _this$
|
|
1073
|
+
var _this$props26 = this.props,
|
|
1074
|
+
previewActive = _this$props26.player.previewActive,
|
|
1075
|
+
actions = _this$props26.actions,
|
|
1076
|
+
onTimeUpdate = _this$props26.onTimeUpdate,
|
|
1077
|
+
rightMarker = _this$props26.playerSelectedMarker.rightMarker;
|
|
1078
|
+
|
|
1079
|
+
//for annotation time updataton for svg
|
|
1080
|
+
var _this$getTimeData2 = this.getTimeData(this.video.currentTime),
|
|
1081
|
+
shouldShow = _this$getTimeData2.shouldShow;
|
|
1082
|
+
if (this.state.shouldShowAnnotate !== shouldShow) {
|
|
1083
|
+
this.setState({
|
|
1084
|
+
shouldShowAnnotate: shouldShow
|
|
1085
|
+
});
|
|
1086
|
+
}
|
|
996
1087
|
actions.handleTimeUpdate(this.getProperties());
|
|
997
1088
|
if (previewActive && this.video.currentTime >= rightMarker) {
|
|
998
1089
|
this.video.pause();
|
|
@@ -1011,9 +1102,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1011
1102
|
}, {
|
|
1012
1103
|
key: "handleRateChange",
|
|
1013
1104
|
value: function handleRateChange() {
|
|
1014
|
-
var _this$
|
|
1015
|
-
actions = _this$
|
|
1016
|
-
onRateChange = _this$
|
|
1105
|
+
var _this$props27 = this.props,
|
|
1106
|
+
actions = _this$props27.actions,
|
|
1107
|
+
onRateChange = _this$props27.onRateChange;
|
|
1017
1108
|
actions.handleRateChange(this.getProperties());
|
|
1018
1109
|
if (onRateChange) {
|
|
1019
1110
|
onRateChange.apply(void 0, arguments);
|
|
@@ -1024,9 +1115,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1024
1115
|
}, {
|
|
1025
1116
|
key: "handleVolumeChange",
|
|
1026
1117
|
value: function handleVolumeChange() {
|
|
1027
|
-
var _this$
|
|
1028
|
-
actions = _this$
|
|
1029
|
-
onVolumeChange = _this$
|
|
1118
|
+
var _this$props28 = this.props,
|
|
1119
|
+
actions = _this$props28.actions,
|
|
1120
|
+
onVolumeChange = _this$props28.onVolumeChange;
|
|
1030
1121
|
actions.handleVolumeChange(this.getProperties());
|
|
1031
1122
|
if (onVolumeChange) {
|
|
1032
1123
|
onVolumeChange.apply(void 0, arguments);
|
|
@@ -1040,9 +1131,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1040
1131
|
}, {
|
|
1041
1132
|
key: "handleError",
|
|
1042
1133
|
value: function handleError() {
|
|
1043
|
-
var _this$
|
|
1044
|
-
actions = _this$
|
|
1045
|
-
onError = _this$
|
|
1134
|
+
var _this$props29 = this.props,
|
|
1135
|
+
actions = _this$props29.actions,
|
|
1136
|
+
onError = _this$props29.onError;
|
|
1046
1137
|
actions.handleError(this.getProperties());
|
|
1047
1138
|
if (onError) {
|
|
1048
1139
|
onError.apply(void 0, arguments);
|
|
@@ -1136,9 +1227,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1136
1227
|
}, {
|
|
1137
1228
|
key: "handleSubtitleContainerClick",
|
|
1138
1229
|
value: function handleSubtitleContainerClick() {
|
|
1139
|
-
var _this$
|
|
1140
|
-
actions = _this$
|
|
1141
|
-
player = _this$
|
|
1230
|
+
var _this$props30 = this.props,
|
|
1231
|
+
actions = _this$props30.actions,
|
|
1232
|
+
player = _this$props30.player;
|
|
1142
1233
|
if (player.paused) {
|
|
1143
1234
|
actions.play();
|
|
1144
1235
|
} else {
|
|
@@ -1148,11 +1239,11 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1148
1239
|
}, {
|
|
1149
1240
|
key: "handleSubtitleClick",
|
|
1150
1241
|
value: function handleSubtitleClick(e) {
|
|
1151
|
-
var _this$
|
|
1152
|
-
actions = _this$
|
|
1153
|
-
player = _this$
|
|
1154
|
-
onScreenSubtitleClick = _this$
|
|
1155
|
-
controlType = _this$
|
|
1242
|
+
var _this$props31 = this.props,
|
|
1243
|
+
actions = _this$props31.actions,
|
|
1244
|
+
player = _this$props31.player,
|
|
1245
|
+
onScreenSubtitleClick = _this$props31.onScreenSubtitleClick,
|
|
1246
|
+
controlType = _this$props31.controlType;
|
|
1156
1247
|
var currentSubtitleObj = this.state.currentSubtitleObj;
|
|
1157
1248
|
if (controlType === 'advanced') {
|
|
1158
1249
|
if (onScreenSubtitleClick) {
|
|
@@ -1172,28 +1263,32 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1172
1263
|
}, {
|
|
1173
1264
|
key: "render",
|
|
1174
1265
|
value: function render() {
|
|
1175
|
-
var _this5 = this
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1266
|
+
var _this5 = this,
|
|
1267
|
+
_this$props$parentAnn,
|
|
1268
|
+
_this$props$parentAnn2,
|
|
1269
|
+
_this$props$parentAnn3,
|
|
1270
|
+
_this$props$parentAnn4;
|
|
1271
|
+
var _this$props32 = this.props,
|
|
1272
|
+
loop = _this$props32.loop,
|
|
1273
|
+
poster = _this$props32.poster,
|
|
1274
|
+
preload = _this$props32.preload,
|
|
1275
|
+
autoPlay = _this$props32.autoPlay,
|
|
1276
|
+
playsInline = _this$props32.playsInline,
|
|
1277
|
+
muted = _this$props32.muted,
|
|
1278
|
+
crossOrigin = _this$props32.crossOrigin,
|
|
1279
|
+
videoId = _this$props32.videoId,
|
|
1280
|
+
fileType = _this$props32.fileType,
|
|
1281
|
+
userEmail = _this$props32.userEmail,
|
|
1282
|
+
theme = _this$props32.theme,
|
|
1283
|
+
player = _this$props32.player,
|
|
1284
|
+
playerType = _this$props32.playerType,
|
|
1285
|
+
markers = _this$props32.markers;
|
|
1191
1286
|
var _this$state2 = this.state,
|
|
1192
1287
|
isBuffering = _this$state2.isBuffering,
|
|
1193
1288
|
watermark = _this$state2.watermark,
|
|
1194
1289
|
currentSubtitleObj = _this$state2.currentSubtitleObj;
|
|
1195
1290
|
var children = this.getChildren(this.props);
|
|
1196
|
-
var isSubtitleActive = player.SubtitleStatus && playerType ===
|
|
1291
|
+
var isSubtitleActive = player.SubtitleStatus && playerType === 'default' || playerType === 'subtitle' && markers && markers.length;
|
|
1197
1292
|
return /*#__PURE__*/_react["default"].createElement(VideoBlock, {
|
|
1198
1293
|
className: "video-react-player-block",
|
|
1199
1294
|
ref: function ref(c) {
|
|
@@ -1255,7 +1350,7 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1255
1350
|
onVolumeChange: this.handleVolumeChange
|
|
1256
1351
|
}, /*#__PURE__*/_react["default"].createElement("track", {
|
|
1257
1352
|
kind: "captions"
|
|
1258
|
-
}), this.renderChildren())) : /*#__PURE__*/_react["default"].createElement("video", {
|
|
1353
|
+
}), this.renderChildren())) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("video", {
|
|
1259
1354
|
id: videoId,
|
|
1260
1355
|
crossOrigin: crossOrigin,
|
|
1261
1356
|
ref: function ref(c) {
|
|
@@ -1291,7 +1386,106 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
1291
1386
|
onVolumeChange: this.handleVolumeChange
|
|
1292
1387
|
}, /*#__PURE__*/_react["default"].createElement("track", {
|
|
1293
1388
|
kind: "captions"
|
|
1294
|
-
}), this.renderChildren()),
|
|
1389
|
+
}), 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", {
|
|
1390
|
+
ref: this.props.playerSvgRef,
|
|
1391
|
+
onMouseDown: this.props.handleMouseDown,
|
|
1392
|
+
onMouseMove: this.props.handleMouseMove,
|
|
1393
|
+
onMouseUp: this.props.handleMouseUp,
|
|
1394
|
+
style: {
|
|
1395
|
+
position: 'absolute',
|
|
1396
|
+
top: 0,
|
|
1397
|
+
left: 0,
|
|
1398
|
+
width: '100%',
|
|
1399
|
+
height: '100%',
|
|
1400
|
+
pointerEvents: this.state.shouldShowAnnotate ? 'auto' : 'none',
|
|
1401
|
+
zIndex: 999
|
|
1402
|
+
}
|
|
1403
|
+
}, ((_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) {
|
|
1404
|
+
var _this5$props$playerSv;
|
|
1405
|
+
var svg = (_this5$props$playerSv = _this5.props.playerSvgRef) === null || _this5$props$playerSv === void 0 ? void 0 : _this5$props$playerSv.current;
|
|
1406
|
+
if (!svg) return null;
|
|
1407
|
+
var svgData = svg.getBoundingClientRect();
|
|
1408
|
+
var width = svgData.width;
|
|
1409
|
+
var height = svgData.height;
|
|
1410
|
+
var x = ann.x * width;
|
|
1411
|
+
var y = ann.y * height;
|
|
1412
|
+
var w = ann.width * width;
|
|
1413
|
+
var h = ann.height * height;
|
|
1414
|
+
if (ann.type === 'rect') {
|
|
1415
|
+
return /*#__PURE__*/_react["default"].createElement("rect", {
|
|
1416
|
+
key: idx,
|
|
1417
|
+
x: x,
|
|
1418
|
+
y: y,
|
|
1419
|
+
width: w,
|
|
1420
|
+
height: h,
|
|
1421
|
+
stroke: ann.color,
|
|
1422
|
+
strokeWidth: "4",
|
|
1423
|
+
fill: "none",
|
|
1424
|
+
onMouseDown: function onMouseDown(e) {
|
|
1425
|
+
return _this5.props.onShapeMouseDown(e, idx, ann);
|
|
1426
|
+
},
|
|
1427
|
+
style: {
|
|
1428
|
+
cursor: _this5.props.isSvgLayer ? 'move' : 'default'
|
|
1429
|
+
}
|
|
1430
|
+
});
|
|
1431
|
+
} else if (ann.type === 'line' || ann.type === 'arrow') {
|
|
1432
|
+
var x1 = ann.x1 * width;
|
|
1433
|
+
var y1 = ann.y1 * height;
|
|
1434
|
+
var x2 = ann.x2 * width;
|
|
1435
|
+
var y2 = ann.y2 * height;
|
|
1436
|
+
return /*#__PURE__*/_react["default"].createElement("line", {
|
|
1437
|
+
key: idx,
|
|
1438
|
+
x1: x1,
|
|
1439
|
+
y1: y1,
|
|
1440
|
+
x2: x2,
|
|
1441
|
+
y2: y2,
|
|
1442
|
+
stroke: ann.color,
|
|
1443
|
+
strokeWidth: "4",
|
|
1444
|
+
markerEnd: ann.type === 'arrow' ? "url(#open-arrowhead-".concat(ann.color.replace('#', ''), "-").concat(idx, ")") : undefined,
|
|
1445
|
+
onMouseDown: function onMouseDown(e) {
|
|
1446
|
+
return _this5.props.onShapeMouseDown(e, idx, ann);
|
|
1447
|
+
},
|
|
1448
|
+
style: {
|
|
1449
|
+
color: ann.color,
|
|
1450
|
+
cursor: _this5.props.isSvgLayer ? 'move' : 'default'
|
|
1451
|
+
}
|
|
1452
|
+
});
|
|
1453
|
+
} else if (ann.type === 'pencil') {
|
|
1454
|
+
return /*#__PURE__*/_react["default"].createElement("path", {
|
|
1455
|
+
key: idx,
|
|
1456
|
+
d: _this5.buildSmoothPath(ann.points, width, height),
|
|
1457
|
+
stroke: ann.color,
|
|
1458
|
+
strokeWidth: "4",
|
|
1459
|
+
fill: "none",
|
|
1460
|
+
onMouseDown: function onMouseDown(e) {
|
|
1461
|
+
return _this5.props.onShapeMouseDown(e, idx, ann);
|
|
1462
|
+
},
|
|
1463
|
+
style: {
|
|
1464
|
+
cursor: _this5.props.isSvgLayer ? 'move' : 'default'
|
|
1465
|
+
}
|
|
1466
|
+
});
|
|
1467
|
+
}
|
|
1468
|
+
return null;
|
|
1469
|
+
})), /*#__PURE__*/_react["default"].createElement("defs", null, (_this$props$parentAnn4 = this.props.parentAnnotations) === null || _this$props$parentAnn4 === void 0 ? void 0 : _this$props$parentAnn4.map(function (ann, idx) {
|
|
1470
|
+
if (ann.type === 'arrow') {
|
|
1471
|
+
return /*#__PURE__*/_react["default"].createElement("marker", {
|
|
1472
|
+
key: idx,
|
|
1473
|
+
id: "open-arrowhead-".concat(ann.color.replace('#', ''), "-").concat(idx),
|
|
1474
|
+
markerWidth: "10",
|
|
1475
|
+
markerHeight: "10",
|
|
1476
|
+
refX: "8",
|
|
1477
|
+
refY: "5",
|
|
1478
|
+
orient: "auto",
|
|
1479
|
+
markerUnits: "strokeWidth"
|
|
1480
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
1481
|
+
d: "M 1 1 L 8 5 L 1 10",
|
|
1482
|
+
fill: "none",
|
|
1483
|
+
stroke: ann.color,
|
|
1484
|
+
strokeWidth: "1"
|
|
1485
|
+
}));
|
|
1486
|
+
}
|
|
1487
|
+
return null;
|
|
1488
|
+
})))), children, /*#__PURE__*/_react["default"].createElement("p", {
|
|
1295
1489
|
className: "user-name-wrapper",
|
|
1296
1490
|
id: "watermark-text",
|
|
1297
1491
|
style: _objectSpread({}, watermark)
|