@desynova-digital/player 4.0.62 → 4.0.63

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.
Files changed (70) hide show
  1. package/Manager.js +9 -8
  2. package/actions/player.js +1 -1
  3. package/components/AudioMeter.js +28 -27
  4. package/components/BigPlayButton.js +17 -16
  5. package/components/ImageViewer.js +17 -16
  6. package/components/MarkerBar.js +17 -16
  7. package/components/Menu.js +2 -2
  8. package/components/Player.js +91 -52
  9. package/components/PlayerHeader.js +24 -23
  10. package/components/Playlist.js +15 -14
  11. package/components/PointersBar.js +20 -19
  12. package/components/PosterImage.js +1 -1
  13. package/components/SDOutline.js +2 -2
  14. package/components/Shortcut.js +87 -70
  15. package/components/Slider.js +33 -33
  16. package/components/TagsBar.js +16 -15
  17. package/components/Video.js +438 -241
  18. package/components/control-bar/AudioTracksMenuButton.js +15 -14
  19. package/components/control-bar/CameraButton.js +16 -15
  20. package/components/control-bar/CaptionControlMenuButton.js +20 -19
  21. package/components/control-bar/CommentsButton.js +17 -16
  22. package/components/control-bar/ControlBar.js +18 -17
  23. package/components/control-bar/EditorControlMenuButton.js +17 -16
  24. package/components/control-bar/ForwardControl.js +1 -1
  25. package/components/control-bar/ForwardReplayControl.js +16 -15
  26. package/components/control-bar/FullscreenToggle.js +16 -15
  27. package/components/control-bar/PlayToggle.js +16 -15
  28. package/components/control-bar/ReplayControl.js +1 -1
  29. package/components/control-bar/SettingsMenuButton.js +4 -4
  30. package/components/control-bar/SubtitleLanguagesMenuButton.js +15 -14
  31. package/components/control-bar/SubtitleMovementMenu.js +17 -16
  32. package/components/control-bar/VolumeMenuButton.js +17 -16
  33. package/components/control-bar/ZoomMenuButton.js +17 -16
  34. package/components/marking-controls/MarkInControl.js +16 -15
  35. package/components/marking-controls/MarkOutControl.js +16 -15
  36. package/components/marking-controls/MarkingAddButton.js +16 -15
  37. package/components/marking-controls/MarkingControl.js +2 -2
  38. package/components/marking-controls/MarkingDeleteButton.js +16 -15
  39. package/components/marking-controls/MarkingDuration.js +2 -2
  40. package/components/marking-controls/MarkingPreview.js +16 -15
  41. package/components/marking-controls/TimecodeFormatSelector.js +7 -7
  42. package/components/progress-bar/AudioWaveform.js +16 -15
  43. package/components/progress-bar/LoadProgressBar.js +1 -1
  44. package/components/progress-bar/MouseTimeDisplay.js +1 -1
  45. package/components/progress-bar/PlayProgressBar.js +2 -2
  46. package/components/progress-bar/ProgressControl.js +20 -19
  47. package/components/progress-bar/SeekBar.js +28 -27
  48. package/components/progress-bar/Timeline.js +15 -14
  49. package/components/settings-menu-control/CameraControl.js +3 -3
  50. package/components/settings-menu-control/ChildMenuComponent.js +29 -28
  51. package/components/settings-menu-control/ParentMenuComponent.js +18 -17
  52. package/components/settings-menu-control/PlaybackRateControl.js +16 -15
  53. package/components/settings-menu-control/SafeAreaControl.js +16 -15
  54. package/components/settings-menu-control/SettingsMenu.js +12 -12
  55. package/components/time-controls/CurrentTimeDisplay.js +7 -7
  56. package/components/time-controls/DurationDisplay.js +2 -2
  57. package/components/time-controls/TimeDivider.js +2 -2
  58. package/components/volume-control/VolumeBar.js +25 -24
  59. package/components/volume-control/VolumeControl.js +1 -1
  60. package/components/volume-control/VolumeLevel.js +2 -2
  61. package/components/zoom-control/ZoomBar.js +24 -23
  62. package/components/zoom-control/ZoomLevel.js +2 -2
  63. package/index.js +2 -2
  64. package/package.json +1 -1
  65. package/reducers/operation.js +2 -2
  66. package/reducers/player.js +2 -2
  67. package/utils/browser.js +14 -14
  68. package/utils/dom.js +18 -18
  69. package/utils/fullscreen.js +6 -5
  70. package/utils/index.js +54 -54
@@ -15,27 +15,34 @@ 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
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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
- 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
+ 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 && Object.prototype.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
- 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 _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
27
- 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
- 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); }
25
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
26
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _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(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
29
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
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(arr) { if (Array.isArray(arr)) return arr; }
32
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
33
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
34
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
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
- 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
- function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
36
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
34
37
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
35
- function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
36
- 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
- function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
38
- function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
38
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
39
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
40
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
41
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
42
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
43
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(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); }
45
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
39
46
  var propTypes = {
40
47
  actions: _propTypes.PropTypes.instanceOf(Object),
41
48
  player: _propTypes.PropTypes.instanceOf(Object),
@@ -97,17 +104,68 @@ 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,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 }\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) {
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) {
104
111
  return props.HDBorder ? '"16:9 Safe Area"' : '';
105
112
  });
106
113
  var Video = exports["default"] = /*#__PURE__*/function (_Component) {
114
+ _inherits(Video, _Component);
107
115
  function Video(props) {
108
116
  var _this;
109
117
  _classCallCheck(this, Video);
110
118
  _this = _callSuper(this, Video, [props]);
119
+ _defineProperty(_assertThisInitialized(_this), "buildSmoothPath", function (points) {
120
+ if (!points || points.length < 2) return '';
121
+ var path = "M ".concat(points[0].x, " ").concat(points[0].y);
122
+ for (var i = 1; i < points.length - 1; i++) {
123
+ var midX = (points[i].x + points[i + 1].x) / 2;
124
+ var midY = (points[i].y + points[i + 1].y) / 2;
125
+ path += " Q ".concat(points[i].x, " ").concat(points[i].y, " ").concat(midX, " ").concat(midY);
126
+ }
127
+ var last = points[points.length - 1];
128
+ path += " L ".concat(last.x, " ").concat(last.y);
129
+ return path;
130
+ });
131
+ _defineProperty(_assertThisInitialized(_this), "getTimeData", function (time) {
132
+ var _this$props = _this.props,
133
+ inTime = _this$props.inTime,
134
+ outTime = _this$props.outTime,
135
+ initialTime = _this$props.initialTime,
136
+ frameRate = _this$props.frameRate;
137
+ var currentFormattedTime = (0, _utils.secondsToTime)(time, frameRate, initialTime);
138
+ var timecodeToSeconds = function timecodeToSeconds(tc) {
139
+ if (!tc || tc === '-1') return null;
140
+ var _tc$split$map = tc.split(':').map(Number),
141
+ _tc$split$map2 = _slicedToArray(_tc$split$map, 4),
142
+ hh = _tc$split$map2[0],
143
+ mm = _tc$split$map2[1],
144
+ ss = _tc$split$map2[2],
145
+ ff = _tc$split$map2[3];
146
+ var newTime = hh * 3600 + mm * 60 + ss + (ff || 0) / frameRate;
147
+ return newTime;
148
+ };
149
+ var roundTo = function roundTo(value) {
150
+ var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
151
+ return value !== null ? Number(value.toFixed(precision)) : null;
152
+ };
153
+ var inSeconds = roundTo(timecodeToSeconds(inTime, 'inTime'));
154
+ var outSeconds = roundTo(timecodeToSeconds(outTime, 'outTime'));
155
+ var currentSeconds = roundTo(timecodeToSeconds(currentFormattedTime, 'currentFormattedTime'));
156
+ var shouldShow = false;
157
+ if (inSeconds !== null) {
158
+ if (outSeconds === null || outSeconds === 0) {
159
+ shouldShow = currentSeconds >= inSeconds && currentSeconds <= inSeconds;
160
+ } else {
161
+ shouldShow = currentSeconds >= inSeconds && currentSeconds <= outSeconds;
162
+ }
163
+ }
164
+ return {
165
+ shouldShow: shouldShow,
166
+ formattedTime: currentFormattedTime
167
+ };
168
+ });
111
169
  _this.state = {
112
170
  audioTracks: [],
113
171
  isM3U8: false,
@@ -124,50 +182,50 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
124
182
  },
125
183
  watermarkInterval: -1,
126
184
  isBuffering: false,
127
- currentSubtitleObj: {}
185
+ currentSubtitleObj: {},
186
+ shouldShowAnnotate: false
128
187
  };
129
188
  _this.video = null; // the html5 video
130
189
  _this.manager = new _Manager["default"](props.store);
131
- _this.getStyle = _this.getStyle.bind(_this);
132
- _this.getChildren = _this.getChildren.bind(_this);
133
- _this.play = _this.play.bind(_this);
134
- _this.pause = _this.pause.bind(_this);
135
- _this.seek = _this.seek.bind(_this);
136
- _this.forward = _this.forward.bind(_this);
137
- _this.replay = _this.replay.bind(_this);
138
- _this.toggleFullscreen = _this.toggleFullscreen.bind(_this);
139
- _this.getProperties = _this.getProperties.bind(_this);
140
- _this.renderChildren = _this.renderChildren.bind(_this);
141
- _this.handleLoadStart = _this.handleLoadStart.bind(_this);
142
- _this.handleCanPlay = _this.handleCanPlay.bind(_this);
143
- _this.handleCanPlayThrough = _this.handleCanPlayThrough.bind(_this);
144
- _this.handlePlay = _this.handlePlay.bind(_this);
145
- _this.handlePlaying = _this.handlePlaying.bind(_this);
146
- _this.handlePause = _this.handlePause.bind(_this);
147
- _this.handleEnded = _this.handleEnded.bind(_this);
148
- _this.handleWaiting = _this.handleWaiting.bind(_this);
149
- _this.handleSeeking = _this.handleSeeking.bind(_this);
150
- _this.handleSeeked = _this.handleSeeked.bind(_this);
151
- _this.handleFullscreenChange = _this.handleFullscreenChange.bind(_this);
152
- _this.handleError = _this.handleError.bind(_this);
153
- _this.handleSuspend = _this.handleSuspend.bind(_this);
154
- _this.handleAbort = _this.handleAbort.bind(_this);
155
- _this.handleEmptied = _this.handleEmptied.bind(_this);
156
- _this.handleStalled = _this.handleStalled.bind(_this);
157
- _this.handleLoadedMetaData = _this.handleLoadedMetaData.bind(_this);
158
- _this.handleLoadedData = _this.handleLoadedData.bind(_this);
159
- _this.handleTimeUpdate = _this.handleTimeUpdate.bind(_this);
160
- _this.handleRateChange = _this.handleRateChange.bind(_this);
161
- _this.handleVolumeChange = _this.handleVolumeChange.bind(_this);
162
- _this.handleDurationChange = _this.handleDurationChange.bind(_this);
163
- _this.handleProgress = (0, _utils.throttle)(_this.handleProgress.bind(_this), 250);
164
- _this.handleKeypress = _this.handleKeypress.bind(_this);
165
- _this.audioVisualizer = _this.audioVisualizer.bind(_this);
166
- _this.checkWatermark = _this.checkWatermark.bind(_this);
190
+ _this.getStyle = _this.getStyle.bind(_assertThisInitialized(_this));
191
+ _this.getChildren = _this.getChildren.bind(_assertThisInitialized(_this));
192
+ _this.play = _this.play.bind(_assertThisInitialized(_this));
193
+ _this.pause = _this.pause.bind(_assertThisInitialized(_this));
194
+ _this.seek = _this.seek.bind(_assertThisInitialized(_this));
195
+ _this.forward = _this.forward.bind(_assertThisInitialized(_this));
196
+ _this.replay = _this.replay.bind(_assertThisInitialized(_this));
197
+ _this.toggleFullscreen = _this.toggleFullscreen.bind(_assertThisInitialized(_this));
198
+ _this.getProperties = _this.getProperties.bind(_assertThisInitialized(_this));
199
+ _this.renderChildren = _this.renderChildren.bind(_assertThisInitialized(_this));
200
+ _this.handleLoadStart = _this.handleLoadStart.bind(_assertThisInitialized(_this));
201
+ _this.handleCanPlay = _this.handleCanPlay.bind(_assertThisInitialized(_this));
202
+ _this.handleCanPlayThrough = _this.handleCanPlayThrough.bind(_assertThisInitialized(_this));
203
+ _this.handlePlay = _this.handlePlay.bind(_assertThisInitialized(_this));
204
+ _this.handlePlaying = _this.handlePlaying.bind(_assertThisInitialized(_this));
205
+ _this.handlePause = _this.handlePause.bind(_assertThisInitialized(_this));
206
+ _this.handleEnded = _this.handleEnded.bind(_assertThisInitialized(_this));
207
+ _this.handleWaiting = _this.handleWaiting.bind(_assertThisInitialized(_this));
208
+ _this.handleSeeking = _this.handleSeeking.bind(_assertThisInitialized(_this));
209
+ _this.handleSeeked = _this.handleSeeked.bind(_assertThisInitialized(_this));
210
+ _this.handleFullscreenChange = _this.handleFullscreenChange.bind(_assertThisInitialized(_this));
211
+ _this.handleError = _this.handleError.bind(_assertThisInitialized(_this));
212
+ _this.handleSuspend = _this.handleSuspend.bind(_assertThisInitialized(_this));
213
+ _this.handleAbort = _this.handleAbort.bind(_assertThisInitialized(_this));
214
+ _this.handleEmptied = _this.handleEmptied.bind(_assertThisInitialized(_this));
215
+ _this.handleStalled = _this.handleStalled.bind(_assertThisInitialized(_this));
216
+ _this.handleLoadedMetaData = _this.handleLoadedMetaData.bind(_assertThisInitialized(_this));
217
+ _this.handleLoadedData = _this.handleLoadedData.bind(_assertThisInitialized(_this));
218
+ _this.handleTimeUpdate = _this.handleTimeUpdate.bind(_assertThisInitialized(_this));
219
+ _this.handleRateChange = _this.handleRateChange.bind(_assertThisInitialized(_this));
220
+ _this.handleVolumeChange = _this.handleVolumeChange.bind(_assertThisInitialized(_this));
221
+ _this.handleDurationChange = _this.handleDurationChange.bind(_assertThisInitialized(_this));
222
+ _this.handleProgress = (0, _utils.throttle)(_this.handleProgress.bind(_assertThisInitialized(_this)), 250);
223
+ _this.handleKeypress = _this.handleKeypress.bind(_assertThisInitialized(_this));
224
+ _this.audioVisualizer = _this.audioVisualizer.bind(_assertThisInitialized(_this));
225
+ _this.checkWatermark = _this.checkWatermark.bind(_assertThisInitialized(_this));
167
226
  return _this;
168
227
  }
169
- _inherits(Video, _Component);
170
- return _createClass(Video, [{
228
+ _createClass(Video, [{
171
229
  key: "componentDidMount",
172
230
  value: function componentDidMount() {
173
231
  var src = this.props.src;
@@ -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() {
@@ -203,16 +268,16 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
203
268
  clearInterval(watermarkInterval);
204
269
  }
205
270
 
206
- /**
207
- * This function is triggered on interval to shuffle the position of watermark on Player area
271
+ /**
272
+ * This function is triggered on interval to shuffle the position of watermark on Player area
208
273
  */
209
274
  }, {
210
275
  key: "checkWatermark",
211
276
  value: function checkWatermark() {
212
277
  var watermark = this.state.watermark;
213
- var _this$props = this.props,
214
- onPlayerClose = _this$props.onPlayerClose,
215
- userEmail = _this$props.userEmail;
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$props2 = this.props,
249
- actions = _this$props2.actions,
250
- activeTrackIndex = _this$props2.activeTrackIndex;
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)), /*#__PURE__*/_react["default"].createElement(_BigPlayButton["default"], _extends({
337
- key: "big-play-button",
338
- order: 5.0
339
- }, props))];
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,13 +438,13 @@ 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$props3 = this.props,
377
- aspectRatio = _this$props3.aspectRatio,
378
- width = _this$props3.width,
379
- height = _this$props3.height;
380
- /*
381
- * The aspect ratio is either used directly
382
- * or to calculate width and height.
441
+ var _this$props4 = this.props,
442
+ aspectRatio = _this$props4.aspectRatio,
443
+ width = _this$props4.width,
444
+ height = _this$props4.height;
445
+ /*
446
+ * The aspect ratio is either used directly
447
+ * or to calculate width and height.
383
448
  */
384
449
  if (player.videoWidth) {
385
450
  // Otherwise try to get the aspect ratio from the video metadata
@@ -433,9 +498,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
433
498
  return this.video.playbackRate;
434
499
  }
435
500
 
436
- /*
437
- * set playback rate
438
- * speed of video
501
+ /*
502
+ * set playback rate
503
+ * speed of video
439
504
  */,
440
505
  set: function set(rate) {
441
506
  this.video.playbackRate = rate;
@@ -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$props4 = this.props,
483
- src = _this$props4.src,
484
- activeAudio = _this$props4.player.activeAudio,
485
- currentSubtitleObj = _this$props4.currentSubtitleObj,
486
- markers = _this$props4.markers,
487
- playerType = _this$props4.playerType;
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,30 @@ 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.play();
667
+ } else {
668
+ this.pause();
669
+ }
670
+ }
671
+
596
672
  // seek video by time
597
673
  }, {
598
674
  key: "seek",
599
675
  value: function seek(time) {
600
676
  try {
677
+ //for annotation time updatation for svg
678
+ var _this$getTimeData = this.getTimeData(this.video.currentTime),
679
+ shouldShow = _this$getTimeData.shouldShow;
680
+ if (this.state.shouldShowAnnotate !== shouldShow) {
681
+ this.setState({
682
+ shouldShowAnnotate: shouldShow
683
+ });
684
+ }
601
685
  var updatedTime = 0;
602
686
  var frameRate = this.props.frameRate;
603
687
  if (time < 0) {
@@ -628,23 +712,23 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
628
712
  }, {
629
713
  key: "toggleFullscreen",
630
714
  value: function toggleFullscreen() {
631
- var _this$props5 = this.props,
632
- player = _this$props5.player,
633
- actions = _this$props5.actions;
715
+ var _this$props6 = this.props,
716
+ player = _this$props6.player,
717
+ actions = _this$props6.actions;
634
718
  actions.toggleFullscreen(player);
635
719
  }
636
720
 
637
- /*
638
- * Fired when the user agent
639
- * begins looking for media data
721
+ /*
722
+ * Fired when the user agent
723
+ * begins looking for media data
640
724
  */
641
725
  }, {
642
726
  key: "handleLoadStart",
643
727
  value: function handleLoadStart() {
644
- var _this$props6 = this.props,
645
- actions = _this$props6.actions,
646
- onLoadStart = _this$props6.onLoadStart,
647
- fileType = _this$props6.fileType;
728
+ var _this$props7 = this.props,
729
+ actions = _this$props7.actions,
730
+ onLoadStart = _this$props7.onLoadStart,
731
+ fileType = _this$props7.fileType;
648
732
  if (fileType === 'audio') {
649
733
  this.audioVisualizer();
650
734
  }
@@ -654,48 +738,48 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
654
738
  }
655
739
  }
656
740
 
657
- /*
658
- * A handler for events that
659
- * signal that waiting has ended
741
+ /*
742
+ * A handler for events that
743
+ * signal that waiting has ended
660
744
  */
661
745
  }, {
662
746
  key: "handleCanPlay",
663
747
  value: function handleCanPlay() {
664
- var _this$props7 = this.props,
665
- actions = _this$props7.actions,
666
- onCanPlay = _this$props7.onCanPlay;
748
+ var _this$props8 = this.props,
749
+ actions = _this$props8.actions,
750
+ onCanPlay = _this$props8.onCanPlay;
667
751
  actions.handleCanPlay(this.getProperties());
668
752
  if (onCanPlay) {
669
753
  onCanPlay.apply(void 0, arguments);
670
754
  }
671
755
  }
672
756
 
673
- /*
674
- * A handler for events that
675
- * signal that waiting has ended
757
+ /*
758
+ * A handler for events that
759
+ * signal that waiting has ended
676
760
  */
677
761
  }, {
678
762
  key: "handleCanPlayThrough",
679
763
  value: function handleCanPlayThrough() {
680
- var _this$props8 = this.props,
681
- actions = _this$props8.actions,
682
- onCanPlayThrough = _this$props8.onCanPlayThrough;
764
+ var _this$props9 = this.props,
765
+ actions = _this$props9.actions,
766
+ onCanPlayThrough = _this$props9.onCanPlayThrough;
683
767
  actions.handleCanPlayThrough(this.getProperties());
684
768
  if (onCanPlayThrough) {
685
769
  onCanPlayThrough.apply(void 0, arguments);
686
770
  }
687
771
  }
688
772
 
689
- /*
690
- * A handler for events that
691
- * signal that waiting has ended
773
+ /*
774
+ * A handler for events that
775
+ * signal that waiting has ended
692
776
  */
693
777
  }, {
694
778
  key: "handlePlaying",
695
779
  value: function handlePlaying() {
696
- var _this$props9 = this.props,
697
- actions = _this$props9.actions,
698
- onPlaying = _this$props9.onPlaying;
780
+ var _this$props10 = this.props,
781
+ actions = _this$props10.actions,
782
+ onPlaying = _this$props10.onPlaying;
699
783
  actions.handlePlaying(this.getProperties());
700
784
  if (onPlaying) {
701
785
  onPlaying.apply(void 0, arguments);
@@ -706,9 +790,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
706
790
  }, {
707
791
  key: "handlePlay",
708
792
  value: function handlePlay() {
709
- var _this$props10 = this.props,
710
- actions = _this$props10.actions,
711
- onPlay = _this$props10.onPlay;
793
+ var _this$props11 = this.props,
794
+ actions = _this$props11.actions,
795
+ onPlay = _this$props11.onPlay;
712
796
  actions.handlePlay(this.getProperties());
713
797
  if (onPlay) {
714
798
  onPlay.apply(void 0, arguments);
@@ -719,41 +803,41 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
719
803
  }, {
720
804
  key: "handlePause",
721
805
  value: function handlePause() {
722
- var _this$props11 = this.props,
723
- actions = _this$props11.actions,
724
- onPause = _this$props11.onPause;
806
+ var _this$props12 = this.props,
807
+ actions = _this$props12.actions,
808
+ onPause = _this$props12.onPause;
725
809
  actions.handlePause(this.getProperties());
726
810
  if (onPause) {
727
811
  onPause.apply(void 0, arguments);
728
812
  }
729
813
  }
730
814
 
731
- /*
732
- * Fired when the duration of
733
- * the media resource is first known or changed
815
+ /*
816
+ * Fired when the duration of
817
+ * the media resource is first known or changed
734
818
  */
735
819
  }, {
736
820
  key: "handleDurationChange",
737
821
  value: function handleDurationChange() {
738
- var _this$props12 = this.props,
739
- actions = _this$props12.actions,
740
- onDurationChange = _this$props12.onDurationChange;
822
+ var _this$props13 = this.props,
823
+ actions = _this$props13.actions,
824
+ onDurationChange = _this$props13.onDurationChange;
741
825
  actions.handleDurationChange(this.getProperties());
742
826
  if (onDurationChange) {
743
827
  onDurationChange.apply(void 0, arguments);
744
828
  }
745
829
  }
746
830
 
747
- /*
748
- * Fired while the user agent
749
- * is downloading media data
831
+ /*
832
+ * Fired while the user agent
833
+ * is downloading media data
750
834
  */
751
835
  }, {
752
836
  key: "handleProgress",
753
837
  value: function handleProgress() {
754
- var _this$props13 = this.props,
755
- actions = _this$props13.actions,
756
- onProgress = _this$props13.onProgress;
838
+ var _this$props14 = this.props,
839
+ actions = _this$props14.actions,
840
+ onProgress = _this$props14.onProgress;
757
841
  if (this.video) {
758
842
  actions.handleProgressChange(this.getProperties());
759
843
  }
@@ -774,11 +858,11 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
774
858
  }, {
775
859
  key: "displaySubtitle",
776
860
  value: function displaySubtitle(marker) {
777
- var _this$props14 = this.props,
778
- markers = _this$props14.markers,
779
- resetSubtitleData = _this$props14.resetSubtitleData,
780
- subtitleReadOnly = _this$props14.subtitleReadOnly,
781
- subtitleDataList = _this$props14.subtitleDataList;
861
+ var _this$props15 = this.props,
862
+ markers = _this$props15.markers,
863
+ resetSubtitleData = _this$props15.resetSubtitleData,
864
+ subtitleReadOnly = _this$props15.subtitleReadOnly,
865
+ subtitleDataList = _this$props15.subtitleDataList;
782
866
  var currentSubtitleObj = this.state.currentSubtitleObj;
783
867
  if (resetSubtitleData) {
784
868
  resetSubtitleData();
@@ -813,18 +897,18 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
813
897
  }
814
898
  }
815
899
 
816
- /*
817
- * Fired when the end of the media resource
818
- * is reached (currentTime == duration)
900
+ /*
901
+ * Fired when the end of the media resource
902
+ * is reached (currentTime == duration)
819
903
  */
820
904
  }, {
821
905
  key: "handleEnded",
822
906
  value: function handleEnded() {
823
- var _this$props15 = this.props,
824
- loop = _this$props15.loop,
825
- player = _this$props15.player,
826
- actions = _this$props15.actions,
827
- onEnded = _this$props15.onEnded;
907
+ var _this$props16 = this.props,
908
+ loop = _this$props16.loop,
909
+ player = _this$props16.player,
910
+ actions = _this$props16.actions,
911
+ onEnded = _this$props16.onEnded;
828
912
  if (loop) {
829
913
  this.seek(0);
830
914
  this.play();
@@ -841,41 +925,41 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
841
925
  }, {
842
926
  key: "handleWaiting",
843
927
  value: function handleWaiting() {
844
- var _this$props16 = this.props,
845
- actions = _this$props16.actions,
846
- onWaiting = _this$props16.onWaiting;
928
+ var _this$props17 = this.props,
929
+ actions = _this$props17.actions,
930
+ onWaiting = _this$props17.onWaiting;
847
931
  actions.handleWaiting(this.getProperties());
848
932
  if (onWaiting) {
849
933
  onWaiting.apply(void 0, arguments);
850
934
  }
851
935
  }
852
936
 
853
- /*
854
- * Fired whenever the player
855
- * is jumping to a new time
937
+ /*
938
+ * Fired whenever the player
939
+ * is jumping to a new time
856
940
  */
857
941
  }, {
858
942
  key: "handleSeeking",
859
943
  value: function handleSeeking() {
860
- var _this$props17 = this.props,
861
- actions = _this$props17.actions,
862
- onSeeking = _this$props17.onSeeking;
944
+ var _this$props18 = this.props,
945
+ actions = _this$props18.actions,
946
+ onSeeking = _this$props18.onSeeking;
863
947
  actions.handleSeeking(this.getProperties());
864
948
  if (onSeeking) {
865
949
  onSeeking.apply(void 0, arguments);
866
950
  }
867
951
  }
868
952
 
869
- /*
870
- * Fired when the player has
871
- * finished jumping to a new time
953
+ /*
954
+ * Fired when the player has
955
+ * finished jumping to a new time
872
956
  */
873
957
  }, {
874
958
  key: "handleSeeked",
875
959
  value: function handleSeeked() {
876
- var _this$props18 = this.props,
877
- actions = _this$props18.actions,
878
- onSeeked = _this$props18.onSeeked;
960
+ var _this$props19 = this.props,
961
+ actions = _this$props19.actions,
962
+ onSeeked = _this$props19.onSeeked;
879
963
  actions.handleSeeked(this.getProperties());
880
964
  if (onSeeked) {
881
965
  onSeeked.apply(void 0, arguments);
@@ -887,16 +971,16 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
887
971
  key: "handleFullscreenChange",
888
972
  value: function handleFullscreenChange() {}
889
973
 
890
- /*
891
- * Fires when the browser is
892
- * intentionally not getting media data
974
+ /*
975
+ * Fires when the browser is
976
+ * intentionally not getting media data
893
977
  */
894
978
  }, {
895
979
  key: "handleSuspend",
896
980
  value: function handleSuspend() {
897
- var _this$props19 = this.props,
898
- actions = _this$props19.actions,
899
- onSuspend = _this$props19.onSuspend;
981
+ var _this$props20 = this.props,
982
+ actions = _this$props20.actions,
983
+ onSuspend = _this$props20.onSuspend;
900
984
  actions.handleSuspend(this.getProperties());
901
985
  if (onSuspend) {
902
986
  onSuspend.apply(void 0, arguments);
@@ -907,9 +991,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
907
991
  }, {
908
992
  key: "handleAbort",
909
993
  value: function handleAbort() {
910
- var _this$props20 = this.props,
911
- actions = _this$props20.actions,
912
- onAbort = _this$props20.onAbort;
994
+ var _this$props21 = this.props,
995
+ actions = _this$props21.actions,
996
+ onAbort = _this$props21.onAbort;
913
997
  actions.handleAbort(this.getProperties());
914
998
  if (onAbort) {
915
999
  onAbort.apply(void 0, arguments);
@@ -920,42 +1004,42 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
920
1004
  }, {
921
1005
  key: "handleEmptied",
922
1006
  value: function handleEmptied() {
923
- var _this$props21 = this.props,
924
- actions = _this$props21.actions,
925
- onEmptied = _this$props21.onEmptied;
1007
+ var _this$props22 = this.props,
1008
+ actions = _this$props22.actions,
1009
+ onEmptied = _this$props22.onEmptied;
926
1010
  actions.handleEmptied(this.getProperties());
927
1011
  if (onEmptied) {
928
1012
  onEmptied.apply(void 0, arguments);
929
1013
  }
930
1014
  }
931
1015
 
932
- /*
933
- * Fires when the browser is trying to
934
- * get media data, but data is not available
1016
+ /*
1017
+ * Fires when the browser is trying to
1018
+ * get media data, but data is not available
935
1019
  */
936
1020
  }, {
937
1021
  key: "handleStalled",
938
1022
  value: function handleStalled() {
939
- var _this$props22 = this.props,
940
- actions = _this$props22.actions,
941
- onStalled = _this$props22.onStalled;
1023
+ var _this$props23 = this.props,
1024
+ actions = _this$props23.actions,
1025
+ onStalled = _this$props23.onStalled;
942
1026
  actions.handleStalled(this.getProperties());
943
1027
  if (onStalled) {
944
1028
  onStalled.apply(void 0, arguments);
945
1029
  }
946
1030
  }
947
1031
 
948
- /*
949
- * Fires when the browser has loaded
950
- * meta data for the audio/video
1032
+ /*
1033
+ * Fires when the browser has loaded
1034
+ * meta data for the audio/video
951
1035
  */
952
1036
  }, {
953
1037
  key: "handleLoadedMetaData",
954
1038
  value: function handleLoadedMetaData() {
955
- var _this$props23 = this.props,
956
- actions = _this$props23.actions,
957
- onLoadedMetadata = _this$props23.onLoadedMetadata,
958
- startTime = _this$props23.startTime;
1039
+ var _this$props24 = this.props,
1040
+ actions = _this$props24.actions,
1041
+ onLoadedMetadata = _this$props24.onLoadedMetadata,
1042
+ startTime = _this$props24.startTime;
959
1043
  if (startTime && startTime > 0) {
960
1044
  this.video.currentTime = startTime;
961
1045
  }
@@ -965,34 +1049,43 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
965
1049
  }
966
1050
  }
967
1051
 
968
- /*
969
- * Fires when the browser has loaded
970
- * the current frame of the audio/video
1052
+ /*
1053
+ * Fires when the browser has loaded
1054
+ * the current frame of the audio/video
971
1055
  */
972
1056
  }, {
973
1057
  key: "handleLoadedData",
974
1058
  value: function handleLoadedData() {
975
- var _this$props24 = this.props,
976
- actions = _this$props24.actions,
977
- onLoadedData = _this$props24.onLoadedData;
1059
+ var _this$props25 = this.props,
1060
+ actions = _this$props25.actions,
1061
+ onLoadedData = _this$props25.onLoadedData;
978
1062
  actions.handleLoadedData(this.getProperties());
979
1063
  if (onLoadedData) {
980
1064
  onLoadedData.apply(void 0, arguments);
981
1065
  }
982
1066
  }
983
1067
 
984
- /*
985
- * Fires when the current
986
- * playback position has changed
1068
+ /*
1069
+ * Fires when the current
1070
+ * playback position has changed
987
1071
  */
988
1072
  }, {
989
1073
  key: "handleTimeUpdate",
990
1074
  value: function handleTimeUpdate() {
991
- var _this$props25 = this.props,
992
- previewActive = _this$props25.player.previewActive,
993
- actions = _this$props25.actions,
994
- onTimeUpdate = _this$props25.onTimeUpdate,
995
- rightMarker = _this$props25.playerSelectedMarker.rightMarker;
1075
+ var _this$props26 = this.props,
1076
+ previewActive = _this$props26.player.previewActive,
1077
+ actions = _this$props26.actions,
1078
+ onTimeUpdate = _this$props26.onTimeUpdate,
1079
+ rightMarker = _this$props26.playerSelectedMarker.rightMarker;
1080
+
1081
+ //for annotation time updataton for svg
1082
+ var _this$getTimeData2 = this.getTimeData(this.video.currentTime),
1083
+ shouldShow = _this$getTimeData2.shouldShow;
1084
+ if (this.state.shouldShowAnnotate !== shouldShow) {
1085
+ this.setState({
1086
+ shouldShowAnnotate: shouldShow
1087
+ });
1088
+ }
996
1089
  actions.handleTimeUpdate(this.getProperties());
997
1090
  if (previewActive && this.video.currentTime >= rightMarker) {
998
1091
  this.video.pause();
@@ -1005,15 +1098,15 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1005
1098
  this.displaySubtitle();
1006
1099
  }
1007
1100
 
1008
- /**
1009
- * Fires when the playing speed of the audio/video is changed
1101
+ /**
1102
+ * Fires when the playing speed of the audio/video is changed
1010
1103
  */
1011
1104
  }, {
1012
1105
  key: "handleRateChange",
1013
1106
  value: function handleRateChange() {
1014
- var _this$props26 = this.props,
1015
- actions = _this$props26.actions,
1016
- onRateChange = _this$props26.onRateChange;
1107
+ var _this$props27 = this.props,
1108
+ actions = _this$props27.actions,
1109
+ onRateChange = _this$props27.onRateChange;
1017
1110
  actions.handleRateChange(this.getProperties());
1018
1111
  if (onRateChange) {
1019
1112
  onRateChange.apply(void 0, arguments);
@@ -1024,25 +1117,25 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1024
1117
  }, {
1025
1118
  key: "handleVolumeChange",
1026
1119
  value: function handleVolumeChange() {
1027
- var _this$props27 = this.props,
1028
- actions = _this$props27.actions,
1029
- onVolumeChange = _this$props27.onVolumeChange;
1120
+ var _this$props28 = this.props,
1121
+ actions = _this$props28.actions,
1122
+ onVolumeChange = _this$props28.onVolumeChange;
1030
1123
  actions.handleVolumeChange(this.getProperties());
1031
1124
  if (onVolumeChange) {
1032
1125
  onVolumeChange.apply(void 0, arguments);
1033
1126
  }
1034
1127
  }
1035
1128
 
1036
- /*
1037
- * Fires when an error occurred
1038
- * during the loading of an audio/video
1129
+ /*
1130
+ * Fires when an error occurred
1131
+ * during the loading of an audio/video
1039
1132
  */
1040
1133
  }, {
1041
1134
  key: "handleError",
1042
1135
  value: function handleError() {
1043
- var _this$props28 = this.props,
1044
- actions = _this$props28.actions,
1045
- onError = _this$props28.onError;
1136
+ var _this$props29 = this.props,
1137
+ actions = _this$props29.actions,
1138
+ onError = _this$props29.onError;
1046
1139
  actions.handleError(this.getProperties());
1047
1140
  if (onError) {
1048
1141
  onError.apply(void 0, arguments);
@@ -1086,10 +1179,10 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1086
1179
  for (var i = 0; i < bufferLength; i++) {
1087
1180
  barHeight = dataArray[i] * 2;
1088
1181
 
1089
- /*
1090
- * var r = barHeight + (25 * (i / bufferLength));
1091
- * var g = 250 * (i / bufferLength);
1092
- * var b = s50;
1182
+ /*
1183
+ * var r = barHeight + (25 * (i / bufferLength));
1184
+ * var g = 250 * (i / bufferLength);
1185
+ * var b = s50;
1093
1186
  */
1094
1187
 
1095
1188
  ctx.fillStyle = '#0c141d'; // 'rgb(' + r + ',' + g + ',' + b + ')';
@@ -1136,9 +1229,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1136
1229
  }, {
1137
1230
  key: "handleSubtitleContainerClick",
1138
1231
  value: function handleSubtitleContainerClick() {
1139
- var _this$props29 = this.props,
1140
- actions = _this$props29.actions,
1141
- player = _this$props29.player;
1232
+ var _this$props30 = this.props,
1233
+ actions = _this$props30.actions,
1234
+ player = _this$props30.player;
1142
1235
  if (player.paused) {
1143
1236
  actions.play();
1144
1237
  } else {
@@ -1148,11 +1241,11 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1148
1241
  }, {
1149
1242
  key: "handleSubtitleClick",
1150
1243
  value: function handleSubtitleClick(e) {
1151
- var _this$props30 = this.props,
1152
- actions = _this$props30.actions,
1153
- player = _this$props30.player,
1154
- onScreenSubtitleClick = _this$props30.onScreenSubtitleClick,
1155
- controlType = _this$props30.controlType;
1244
+ var _this$props31 = this.props,
1245
+ actions = _this$props31.actions,
1246
+ player = _this$props31.player,
1247
+ onScreenSubtitleClick = _this$props31.onScreenSubtitleClick,
1248
+ controlType = _this$props31.controlType;
1156
1249
  var currentSubtitleObj = this.state.currentSubtitleObj;
1157
1250
  if (controlType === 'advanced') {
1158
1251
  if (onScreenSubtitleClick) {
@@ -1172,28 +1265,32 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1172
1265
  }, {
1173
1266
  key: "render",
1174
1267
  value: function render() {
1175
- var _this5 = this;
1176
- var _this$props31 = this.props,
1177
- loop = _this$props31.loop,
1178
- poster = _this$props31.poster,
1179
- preload = _this$props31.preload,
1180
- autoPlay = _this$props31.autoPlay,
1181
- playsInline = _this$props31.playsInline,
1182
- muted = _this$props31.muted,
1183
- crossOrigin = _this$props31.crossOrigin,
1184
- videoId = _this$props31.videoId,
1185
- fileType = _this$props31.fileType,
1186
- userEmail = _this$props31.userEmail,
1187
- theme = _this$props31.theme,
1188
- player = _this$props31.player,
1189
- playerType = _this$props31.playerType,
1190
- markers = _this$props31.markers;
1268
+ var _this5 = this,
1269
+ _this$props$parentAnn,
1270
+ _this$props$parentAnn2,
1271
+ _this$props$parentAnn3,
1272
+ _this$props$parentAnn4;
1273
+ var _this$props32 = this.props,
1274
+ loop = _this$props32.loop,
1275
+ poster = _this$props32.poster,
1276
+ preload = _this$props32.preload,
1277
+ autoPlay = _this$props32.autoPlay,
1278
+ playsInline = _this$props32.playsInline,
1279
+ muted = _this$props32.muted,
1280
+ crossOrigin = _this$props32.crossOrigin,
1281
+ videoId = _this$props32.videoId,
1282
+ fileType = _this$props32.fileType,
1283
+ userEmail = _this$props32.userEmail,
1284
+ theme = _this$props32.theme,
1285
+ player = _this$props32.player,
1286
+ playerType = _this$props32.playerType,
1287
+ markers = _this$props32.markers;
1191
1288
  var _this$state2 = this.state,
1192
1289
  isBuffering = _this$state2.isBuffering,
1193
1290
  watermark = _this$state2.watermark,
1194
1291
  currentSubtitleObj = _this$state2.currentSubtitleObj;
1195
1292
  var children = this.getChildren(this.props);
1196
- var isSubtitleActive = player.SubtitleStatus && playerType === "default" || playerType === 'subtitle' && markers && markers.length;
1293
+ var isSubtitleActive = player.SubtitleStatus && playerType === 'default' || playerType === 'subtitle' && markers && markers.length;
1197
1294
  return /*#__PURE__*/_react["default"].createElement(VideoBlock, {
1198
1295
  className: "video-react-player-block",
1199
1296
  ref: function ref(c) {
@@ -1255,7 +1352,7 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1255
1352
  onVolumeChange: this.handleVolumeChange
1256
1353
  }, /*#__PURE__*/_react["default"].createElement("track", {
1257
1354
  kind: "captions"
1258
- }), this.renderChildren())) : /*#__PURE__*/_react["default"].createElement("video", {
1355
+ }), this.renderChildren())) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("video", {
1259
1356
  id: videoId,
1260
1357
  crossOrigin: crossOrigin,
1261
1358
  ref: function ref(c) {
@@ -1291,7 +1388,106 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1291
1388
  onVolumeChange: this.handleVolumeChange
1292
1389
  }, /*#__PURE__*/_react["default"].createElement("track", {
1293
1390
  kind: "captions"
1294
- }), this.renderChildren()), children, /*#__PURE__*/_react["default"].createElement("p", {
1391
+ }), 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", {
1392
+ ref: this.props.playerSvgRef,
1393
+ onMouseDown: this.props.handleMouseDown,
1394
+ onMouseMove: this.props.handleMouseMove,
1395
+ onMouseUp: this.props.handleMouseUp,
1396
+ style: {
1397
+ position: 'absolute',
1398
+ top: 0,
1399
+ left: 0,
1400
+ width: '100%',
1401
+ height: '100%',
1402
+ pointerEvents: this.state.shouldShowAnnotate ? 'auto' : 'none',
1403
+ zIndex: 9999
1404
+ }
1405
+ }, ((_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) {
1406
+ var _this5$props$playerSv;
1407
+ var svg = (_this5$props$playerSv = _this5.props.playerSvgRef) === null || _this5$props$playerSv === void 0 ? void 0 : _this5$props$playerSv.current;
1408
+ if (!svg) return null;
1409
+ var svgData = svg.getBoundingClientRect();
1410
+ var width = svgData.width;
1411
+ var height = svgData.height;
1412
+ var x = ann.x * width;
1413
+ var y = ann.y * height;
1414
+ var w = ann.width * width;
1415
+ var h = ann.height * height;
1416
+ if (ann.type === 'rect') {
1417
+ return /*#__PURE__*/_react["default"].createElement("rect", {
1418
+ key: idx,
1419
+ x: x,
1420
+ y: y,
1421
+ width: w,
1422
+ height: h,
1423
+ stroke: ann.color,
1424
+ strokeWidth: "4",
1425
+ fill: "none",
1426
+ onMouseDown: function onMouseDown(e) {
1427
+ return _this5.props.onShapeMouseDown(e, idx, ann);
1428
+ },
1429
+ style: {
1430
+ cursor: _this5.props.isSvgLayer ? 'move' : 'default'
1431
+ }
1432
+ });
1433
+ } else if (ann.type === 'line' || ann.type === 'arrow') {
1434
+ var x1 = ann.x1 * width;
1435
+ var y1 = ann.y1 * height;
1436
+ var x2 = ann.x2 * width;
1437
+ var y2 = ann.y2 * height;
1438
+ return /*#__PURE__*/_react["default"].createElement("line", {
1439
+ key: idx,
1440
+ x1: x1,
1441
+ y1: y1,
1442
+ x2: x2,
1443
+ y2: y2,
1444
+ stroke: ann.color,
1445
+ strokeWidth: "4",
1446
+ markerEnd: ann.type === 'arrow' ? "url(#open-arrowhead-".concat(ann.color.replace('#', ''), "-").concat(idx, ")") : undefined,
1447
+ onMouseDown: function onMouseDown(e) {
1448
+ return _this5.props.onShapeMouseDown(e, idx, ann);
1449
+ },
1450
+ style: {
1451
+ color: ann.color,
1452
+ cursor: _this5.props.isSvgLayer ? 'move' : 'default'
1453
+ }
1454
+ });
1455
+ } else if (ann.type === 'pencil') {
1456
+ return /*#__PURE__*/_react["default"].createElement("path", {
1457
+ key: idx,
1458
+ d: _this5.buildSmoothPath(ann.points, width, height),
1459
+ stroke: ann.color,
1460
+ strokeWidth: "4",
1461
+ fill: "none",
1462
+ onMouseDown: function onMouseDown(e) {
1463
+ return _this5.props.onShapeMouseDown(e, idx, ann);
1464
+ },
1465
+ style: {
1466
+ cursor: _this5.props.isSvgLayer ? 'move' : 'default'
1467
+ }
1468
+ });
1469
+ }
1470
+ return null;
1471
+ })), /*#__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) {
1472
+ if (ann.type === 'arrow') {
1473
+ return /*#__PURE__*/_react["default"].createElement("marker", {
1474
+ key: idx,
1475
+ id: "open-arrowhead-".concat(ann.color.replace('#', ''), "-").concat(idx),
1476
+ markerWidth: "10",
1477
+ markerHeight: "10",
1478
+ refX: "8",
1479
+ refY: "5",
1480
+ orient: "auto",
1481
+ markerUnits: "strokeWidth"
1482
+ }, /*#__PURE__*/_react["default"].createElement("path", {
1483
+ d: "M 1 1 L 8 5 L 1 10",
1484
+ fill: "none",
1485
+ stroke: ann.color,
1486
+ strokeWidth: "1"
1487
+ }));
1488
+ }
1489
+ return null;
1490
+ })))), children, /*#__PURE__*/_react["default"].createElement("p", {
1295
1491
  className: "user-name-wrapper",
1296
1492
  id: "watermark-text",
1297
1493
  style: _objectSpread({}, watermark)
@@ -1325,6 +1521,7 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1325
1521
  }) || null)));
1326
1522
  }
1327
1523
  }]);
1524
+ return Video;
1328
1525
  }(_react.Component);
1329
1526
  Video.propTypes = propTypes;
1330
1527
  Video.defaultProps = defaultProps;