@desynova-digital/player 3.9.7 → 4.0.0

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 (130) hide show
  1. package/Player.js +945 -0
  2. package/control/AudioTracksMenuButton.js +91 -0
  3. package/control/AudioTracksMenuButton.jsx +80 -0
  4. package/control/ControlBar.js +303 -0
  5. package/control/ControlBar.jsx +264 -0
  6. package/control/CurrentTimeDisplay.js +34 -0
  7. package/control/CurrentTimeDisplay.jsx +35 -0
  8. package/control/DurationDisplay.js +38 -0
  9. package/control/DurationDisplay.jsx +48 -0
  10. package/control/ForwardBackwardControl.js +76 -0
  11. package/control/ForwardBackwardControl.jsx +79 -0
  12. package/control/FullscreenToggle.js +82 -0
  13. package/control/FullscreenToggle.jsx +83 -0
  14. package/control/MarkInControl.js +124 -0
  15. package/control/MarkInControl.jsx +109 -0
  16. package/control/MarkOutControl.js +137 -0
  17. package/control/MarkOutControl.jsx +131 -0
  18. package/control/MarkerBar.js +127 -0
  19. package/control/MarkerBar.jsx +107 -0
  20. package/control/MarkingControl.js +82 -0
  21. package/control/MarkingControl.jsx +143 -0
  22. package/control/MarkingDuration.js +44 -0
  23. package/control/MarkingPreview.js +49 -0
  24. package/control/MarkingPreview.jsx +60 -0
  25. package/control/PlayBackRateControl.js +106 -0
  26. package/control/PlayBackRateControl.jsx +106 -0
  27. package/control/PlayProgressBar.js +61 -0
  28. package/control/PlayProgressBar.jsx +92 -0
  29. package/control/PlayToggle.js +56 -0
  30. package/control/PlayToggle.jsx +57 -0
  31. package/control/PointersBar.js +231 -0
  32. package/control/PointersBar.jsx +286 -0
  33. package/control/ProgressControl.js +127 -0
  34. package/control/ProgressControl.jsx +155 -0
  35. package/control/SeekBar.js +204 -0
  36. package/control/SeekBar.jsx +229 -0
  37. package/control/SettingsMenuButton.js +63 -0
  38. package/control/SettingsMenuButton.jsx +69 -0
  39. package/control/Slider.js +274 -0
  40. package/control/Slider.jsx +243 -0
  41. package/control/Timeline.js +118 -0
  42. package/control/Timeline.jsx +131 -0
  43. package/control/VolumeBar.js +198 -0
  44. package/control/VolumeBar.jsx +174 -0
  45. package/control/VolumeLevel.js +61 -0
  46. package/control/VolumeLevel.jsx +66 -0
  47. package/control/VolumneMenuButton.js +112 -0
  48. package/control/VolumneMenuButton.jsx +111 -0
  49. package/header/Header.js +309 -0
  50. package/header/Header.jsx +479 -0
  51. package/index.js +9 -151
  52. package/media/AudioMeter.js +381 -0
  53. package/media/AudioMeter.jsx +411 -0
  54. package/media/SDOutline.js +82 -0
  55. package/media/SDOutline.jsx +90 -0
  56. package/media/Video.js +684 -0
  57. package/media/Video.jsx +714 -0
  58. package/package.json +5 -1
  59. package/playlist/Playlist.js +67 -0
  60. package/playlist/Playlist.jsx +91 -0
  61. package/playlist/index.js +13 -0
  62. package/shortcuts/Shortcut.js +662 -0
  63. package/utils/Menu.js +50 -0
  64. package/utils/Menu.jsx +105 -0
  65. package/{colors.js → utils/colors.js} +13 -13
  66. package/utils/index.js +52 -122
  67. package/Manager.js +0 -124
  68. package/actions/player.js +0 -375
  69. package/actions/video.js +0 -230
  70. package/components/AudioMeter.js +0 -414
  71. package/components/BigPlayButton.js +0 -110
  72. package/components/ImageViewer.js +0 -318
  73. package/components/MarkerBar.js +0 -138
  74. package/components/Menu.js +0 -77
  75. package/components/Player.js +0 -821
  76. package/components/PlayerHeader.js +0 -472
  77. package/components/Playlist.js +0 -133
  78. package/components/PointersBar.js +0 -299
  79. package/components/PosterImage.js +0 -61
  80. package/components/SDOutline.js +0 -68
  81. package/components/Shortcut.js +0 -621
  82. package/components/Slider.js +0 -317
  83. package/components/TagsBar.js +0 -100
  84. package/components/Video.js +0 -1431
  85. package/components/control-bar/AudioTracksMenuButton.js +0 -113
  86. package/components/control-bar/CameraButton.js +0 -88
  87. package/components/control-bar/CommentsButton.js +0 -216
  88. package/components/control-bar/ControlBar.js +0 -260
  89. package/components/control-bar/EditorControlMenuButton.js +0 -412
  90. package/components/control-bar/ForwardControl.js +0 -17
  91. package/components/control-bar/ForwardReplayControl.js +0 -122
  92. package/components/control-bar/FullscreenToggle.js +0 -101
  93. package/components/control-bar/PlayToggle.js +0 -98
  94. package/components/control-bar/ReplayControl.js +0 -17
  95. package/components/control-bar/SettingsMenuButton.js +0 -43
  96. package/components/control-bar/SubtitleLanguagesMenuButton.js +0 -174
  97. package/components/control-bar/VolumeMenuButton.js +0 -134
  98. package/components/control-bar/ZoomMenuButton.js +0 -116
  99. package/components/marking-controls/MarkInControl.js +0 -140
  100. package/components/marking-controls/MarkOutControl.js +0 -155
  101. package/components/marking-controls/MarkingAddButton.js +0 -94
  102. package/components/marking-controls/MarkingControl.js +0 -135
  103. package/components/marking-controls/MarkingDeleteButton.js +0 -84
  104. package/components/marking-controls/MarkingDuration.js +0 -77
  105. package/components/marking-controls/MarkingPreview.js +0 -86
  106. package/components/progress-bar/AudioWaveform.js +0 -144
  107. package/components/progress-bar/LoadProgressBar.js +0 -90
  108. package/components/progress-bar/MouseTimeDisplay.js +0 -53
  109. package/components/progress-bar/PlayProgressBar.js +0 -79
  110. package/components/progress-bar/ProgressControl.js +0 -222
  111. package/components/progress-bar/SeekBar.js +0 -261
  112. package/components/progress-bar/Timeline.js +0 -134
  113. package/components/settings-menu-control/PlaybackRateControl.js +0 -147
  114. package/components/settings-menu-control/SafeAreaControl.js +0 -92
  115. package/components/settings-menu-control/SettingsMenu.js +0 -68
  116. package/components/settings-menu-control/SubtitleControl.js +0 -1
  117. package/components/time-controls/CurrentTimeDisplay.js +0 -53
  118. package/components/time-controls/DurationDisplay.js +0 -51
  119. package/components/time-controls/TimeDivider.js +0 -41
  120. package/components/volume-control/VolumeBar.js +0 -216
  121. package/components/volume-control/VolumeControl.js +0 -35
  122. package/components/volume-control/VolumeLevel.js +0 -78
  123. package/components/zoom-control/ZoomBar.js +0 -189
  124. package/components/zoom-control/ZoomLevel.js +0 -68
  125. package/reducers/index.js +0 -23
  126. package/reducers/operation.js +0 -36
  127. package/reducers/player.js +0 -222
  128. package/utils/browser.js +0 -29
  129. package/utils/dom.js +0 -104
  130. package/utils/fullscreen.js +0 -73
@@ -0,0 +1,231 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
10
+ var _propTypes = require("prop-types");
11
+ var _components = require("@desynova-digital/components");
12
+ var _lodash = _interopRequireDefault(require("lodash"));
13
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
18
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
19
+ 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; }
20
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
21
+ 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); } }
22
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
23
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
24
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
25
+ 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); }
26
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
27
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
28
+ 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); }
29
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
30
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
31
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
32
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
33
+ /*
34
+ * import { colors } from '@desynova-digital/tokens';
35
+ * import colors from '../colors';
36
+ */
37
+
38
+ var propTypes = {
39
+ player: _propTypes.PropTypes.instanceOf(Object),
40
+ actions: _propTypes.PropTypes.instanceOf(Object),
41
+ markers: _propTypes.PropTypes.instanceOf(Array),
42
+ onTagClick: _propTypes.PropTypes.func
43
+ };
44
+ var defaultProps = {
45
+ player: {}
46
+ };
47
+ var PointersContainer = _styledComponents["default"].div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n"])));
48
+ var PointerBlock = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 100%;\n height: 20px;\n position: relative;\n border-top: 1px solid #333333;\n border-bottom: 1px solid #333333;\n .empty-pointers-msg {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n p {\n font-family: SFUIText-Medium;\n font-size: 11px;\n color: #aaaaaa;\n }\n ", " {\n margin: 0 5px;\n }\n }\n"])), _components.Icon.Element);
49
+ var MarkerTagsBlock = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n min-width: 100px;\n max-width: 100px;\n position: relative;\n height: 100%;\n .tags-block {\n height: 20px;\n font-family: SFUIText-Medium;\n font-size: 10px;\n color: #ffffff;\n text-transform: uppercase;\n border-top: 1px solid #333333;\n border-bottom: 1px solid #333333;\n p {\n line-height: 18px;\n padding: 0 10px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n"])));
50
+ var ToolTipStyles = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 2;\n height: 18px;\n transition: left 0.1s ease-in-out;\n\n .tooltip-container {\n border-radius: 0.25rem;\n padding: 5px;\n width: fit-content;\n background: #ffffff;\n color: #666666;\n\n h4 {\n white-space: nowrap;\n font-size: 12px;\n }\n\n &:after {\n content: '';\n position: absolute;\n border-left: 5px solid transparent;\n border-right: 5px solid transparent;\n border-top: 5px solid white;\n ", "\n left: 50%;\n transform: translateX(-50%);\n }\n }\n"])), function (props) {
51
+ return props.multiline ? 'bottom: -21px;' : 'bottom: -9px;';
52
+ });
53
+ var PointersBar = /*#__PURE__*/function (_Component) {
54
+ _inherits(PointersBar, _Component);
55
+ var _super = _createSuper(PointersBar);
56
+ function PointersBar(props) {
57
+ var _this;
58
+ _classCallCheck(this, PointersBar);
59
+ _this = _super.call(this, props);
60
+ _this.getPointerStyle = _this.getPointerStyle.bind(_assertThisInitialized(_this));
61
+ _this.state = {
62
+ tooltip: {
63
+ isVisible: false
64
+ }
65
+ };
66
+ _this._tooltipRef = /*#__PURE__*/_react["default"].createRef();
67
+ _this.renderComp = 0;
68
+ return _this;
69
+ }
70
+ _createClass(PointersBar, [{
71
+ key: "shouldComponentUpdate",
72
+ value: function shouldComponentUpdate(nextProps, nextState) {
73
+ if (_lodash["default"].isEqual(nextProps.markers, this.props.markers) && !this.renderComp) {
74
+ return false;
75
+ }
76
+ this.renderComp = 0;
77
+ return true;
78
+ }
79
+ }, {
80
+ key: "onMarkerClick",
81
+ value: function onMarkerClick(e, marker) {
82
+ var _this$props = this.props,
83
+ onTagClick = _this$props.onTagClick,
84
+ actionClick = _this$props.actionClick;
85
+ var start_time = parseFloat(e.target.getAttribute('leftpos'));
86
+ var end_time = parseFloat(e.target.getAttribute('rightpos'));
87
+ // actions.handleMarkerUpdate(start_time, end_time);
88
+ actionClick({
89
+ action: 'pause'
90
+ });
91
+ // actions.pause();
92
+ actionClick({
93
+ action: 'seek',
94
+ value: start_time
95
+ });
96
+ // actions.seek(start_time);
97
+ onTagClick(start_time, end_time, marker);
98
+ }
99
+ }, {
100
+ key: "getPointerStyle",
101
+ value: function getPointerStyle(leftMarker, rightMarker, index) {
102
+ var duration = this.props.duration;
103
+ var left = leftMarker / duration.seconds * 100;
104
+ var right = rightMarker / duration.seconds * 100;
105
+ var width = right - left;
106
+ var style = {
107
+ left: "".concat(left, "%"),
108
+ position: 'absolute',
109
+ bottom: 0,
110
+ height: '100%',
111
+ width: "".concat(width, "%"),
112
+ cursor: 'pointer',
113
+ backgroundColor: index % 2 === 0 ? '#00cec6' : '#146778',
114
+ opacity: 0.8,
115
+ minWidth: '0.3px'
116
+ };
117
+ return style;
118
+ }
119
+ }, {
120
+ key: "setTooltipData",
121
+ value: function setTooltipData(e, title) {
122
+ var _this2 = this;
123
+ var tooltip = this.state.tooltip;
124
+ tooltip.isVisible = false;
125
+ tooltip.text = title;
126
+ tooltip.bottom = window.innerHeight - e.target.getBoundingClientRect().top; // e.target.getBoundingClientRect().top - e.target.getBoundingClientRect().height - 10;
127
+ tooltip.bottom = title.line1 ? tooltip.bottom + 22 : tooltip.bottom + 10;
128
+ tooltip.left = e.target.getBoundingClientRect().left + (e.target.getBoundingClientRect().right - e.target.getBoundingClientRect().left) / 2;
129
+ this.renderComp = 1;
130
+ this.setState(_objectSpread({}, tooltip), function () {
131
+ var tooltip = _this2.state.tooltip;
132
+ var tooltipRefOffset = _this2._tooltipRef.current && _this2._tooltipRef.current.offsetWidth ? _this2._tooltipRef.current.offsetWidth / 2 : 0;
133
+ tooltip.isVisible = true;
134
+ tooltip.left = tooltip.left - tooltipRefOffset;
135
+ _this2.renderComp = 1;
136
+ _this2.setState(_objectSpread({}, tooltip));
137
+ });
138
+ }
139
+ }, {
140
+ key: "getTitle",
141
+ value: function getTitle(marker) {
142
+ var data = marker.segment_title || marker.word || '';
143
+ if (!data.length && marker.line1) {
144
+ return {
145
+ line1: marker.line1,
146
+ line2: marker.line2
147
+ };
148
+ }
149
+ return data;
150
+ }
151
+ }, {
152
+ key: "render",
153
+ value: function render() {
154
+ var _this3 = this;
155
+ var markers = this.props.markers;
156
+ var _this$state$tooltip = this.state.tooltip,
157
+ isVisible = _this$state$tooltip.isVisible,
158
+ text = _this$state$tooltip.text,
159
+ left = _this$state$tooltip.left,
160
+ bottom = _this$state$tooltip.bottom;
161
+ var self = this;
162
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, markers && markers.length ? markers.map(function (marker_obj) {
163
+ return /*#__PURE__*/_react["default"].createElement(PointersContainer, {
164
+ key: marker_obj.name
165
+ }, /*#__PURE__*/_react["default"].createElement(MarkerTagsBlock, {
166
+ key: "".concat(marker_obj.name, "-tags-block")
167
+ }, /*#__PURE__*/_react["default"].createElement("div", {
168
+ className: "tags-block"
169
+ }, /*#__PURE__*/_react["default"].createElement("p", null, marker_obj.name))), /*#__PURE__*/_react["default"].createElement(PointerBlock, {
170
+ key: "".concat(marker_obj.name, "-key-tags-block")
171
+ }, marker_obj && marker_obj.values && marker_obj.values.length ? marker_obj.values.map(function (marker, index) {
172
+ var style = self.getPointerStyle(marker.start_time, marker.end_time, index);
173
+ return /*#__PURE__*/_react["default"].createElement("div", {
174
+ className: "marker-blocks",
175
+ onClick: function onClick(e) {
176
+ _this3.onMarkerClick(e, marker);
177
+ },
178
+ onMouseOver: function onMouseOver(e) {
179
+ self.setTooltipData(e, _this3.getTitle(marker));
180
+ },
181
+ onMouseOut: function onMouseOut() {
182
+ var tooltip = _this3.state.tooltip;
183
+ tooltip.isVisible = false;
184
+ tooltip.text = null;
185
+ _this3.renderComp = 1;
186
+ // tooltip.left = null;
187
+ _this3.setState(_objectSpread({}, tooltip));
188
+ },
189
+ role: "button",
190
+ tabIndex: "-1",
191
+ style: style,
192
+ leftpos: marker.start_time,
193
+ rightpos: marker.end_time,
194
+ key: "".concat(marker.start_time, "-").concat(marker.end_time, "-").concat(index)
195
+ });
196
+ }) : /*#__PURE__*/_react["default"].createElement("div", {
197
+ className: "empty-pointers-msg"
198
+ }, /*#__PURE__*/_react["default"].createElement("p", null, "Mark In"), /*#__PURE__*/_react["default"].createElement(_components.Icon, {
199
+ name: "in-marker",
200
+ stroke: "#fff",
201
+ width: 7,
202
+ height: 11
203
+ }), /*#__PURE__*/_react["default"].createElement("p", null, "and Mark Out"), /*#__PURE__*/_react["default"].createElement(_components.Icon, {
204
+ name: "out-marker",
205
+ stroke: "#fff",
206
+ width: 7,
207
+ height: 11
208
+ }), /*#__PURE__*/_react["default"].createElement("p", null, "to create ", marker_obj.name, " in the selected range. "))), /*#__PURE__*/_react["default"].createElement(MarkerTagsBlock, null, /*#__PURE__*/_react["default"].createElement("div", {
209
+ className: "tags-block"
210
+ }, /*#__PURE__*/_react["default"].createElement("p", null))));
211
+ }) : null, text && /*#__PURE__*/_react["default"].createElement(ToolTipStyles, {
212
+ multiline: !!text.line1,
213
+ ref: this._tooltipRef,
214
+ style: {
215
+ left: left || 0,
216
+ bottom: bottom || 0,
217
+ visibility: isVisible ? 'visible' : 'hidden'
218
+ }
219
+ }, /*#__PURE__*/_react["default"].createElement("div", {
220
+ className: "tooltip-container"
221
+ }, text.line1 && /*#__PURE__*/_react["default"].createElement("h4", null, text.line1), text.line2 && /*#__PURE__*/_react["default"].createElement("h4", null, text.line2), !text.line1 && /*#__PURE__*/_react["default"].createElement("h4", null, text))), /*#__PURE__*/_react["default"].createElement("div", {
222
+ id: "dummy-container"
223
+ }));
224
+ }
225
+ }]);
226
+ return PointersBar;
227
+ }(_react.Component);
228
+ exports["default"] = PointersBar;
229
+ PointersBar.propTypes = propTypes;
230
+ PointersBar.defaultProps = defaultProps;
231
+ PointersBar.displayName = 'PointersBar';
@@ -0,0 +1,286 @@
1
+ /* eslint-disable jsx-a11y/mouse-events-have-key-events */
2
+ /* eslint-disable jsx-a11y/click-events-have-key-events */
3
+ /* eslint-disable react/no-array-index-key */
4
+ import React, { Component } from 'react';
5
+ import styled from 'styled-components';
6
+ import { PropTypes } from 'prop-types';
7
+ import { Icon } from '@desynova-digital/components';
8
+ import _ from 'lodash';
9
+
10
+ /*
11
+ * import { colors } from '@desynova-digital/tokens';
12
+ * import colors from '../colors';
13
+ */
14
+
15
+ const propTypes = {
16
+ player: PropTypes.instanceOf(Object),
17
+ actions: PropTypes.instanceOf(Object),
18
+ markers: PropTypes.instanceOf(Array),
19
+ onTagClick: PropTypes.func
20
+ };
21
+
22
+ const defaultProps = {
23
+ player: {}
24
+ };
25
+
26
+ const PointersContainer = styled.div`
27
+ display: flex;
28
+ `;
29
+
30
+ const PointerBlock = styled.div`
31
+ width: 100%;
32
+ height: 20px;
33
+ position: relative;
34
+ border-top: 1px solid #333333;
35
+ border-bottom: 1px solid #333333;
36
+ .empty-pointers-msg {
37
+ display: flex;
38
+ justify-content: center;
39
+ align-items: center;
40
+ height: 100%;
41
+ p {
42
+ font-family: SFUIText-Medium;
43
+ font-size: 11px;
44
+ color: #aaaaaa;
45
+ }
46
+ ${Icon.Element} {
47
+ margin: 0 5px;
48
+ }
49
+ }
50
+ `;
51
+ const MarkerTagsBlock = styled.div`
52
+ min-width: 100px;
53
+ max-width: 100px;
54
+ position: relative;
55
+ height: 100%;
56
+ .tags-block {
57
+ height: 20px;
58
+ font-family: SFUIText-Medium;
59
+ font-size: 10px;
60
+ color: #ffffff;
61
+ text-transform: uppercase;
62
+ border-top: 1px solid #333333;
63
+ border-bottom: 1px solid #333333;
64
+ p {
65
+ line-height: 18px;
66
+ padding: 0 10px;
67
+ white-space: nowrap;
68
+ overflow: hidden;
69
+ text-overflow: ellipsis;
70
+ }
71
+ }
72
+ `;
73
+
74
+ const ToolTipStyles = styled.div`
75
+ position: absolute;
76
+ z-index: 2;
77
+ height: 18px;
78
+ transition: left 0.1s ease-in-out;
79
+
80
+ .tooltip-container {
81
+ border-radius: 0.25rem;
82
+ padding: 5px;
83
+ width: fit-content;
84
+ background: #ffffff;
85
+ color: #666666;
86
+
87
+ h4 {
88
+ white-space: nowrap;
89
+ font-size: 12px;
90
+ }
91
+
92
+ &:after {
93
+ content: '';
94
+ position: absolute;
95
+ border-left: 5px solid transparent;
96
+ border-right: 5px solid transparent;
97
+ border-top: 5px solid white;
98
+ ${(props) => {
99
+ return props.multiline ? 'bottom: -21px;' : 'bottom: -9px;';
100
+ }}
101
+ left: 50%;
102
+ transform: translateX(-50%);
103
+ }
104
+ }
105
+ `;
106
+
107
+ export default class PointersBar extends Component {
108
+ constructor(props) {
109
+ super(props);
110
+ this.getPointerStyle = this.getPointerStyle.bind(this);
111
+ this.state = {
112
+ tooltip: {
113
+ isVisible: false
114
+ }
115
+ };
116
+ this._tooltipRef = React.createRef();
117
+ this.renderComp = 0;
118
+ }
119
+
120
+ shouldComponentUpdate(nextProps, nextState) {
121
+ if (_.isEqual(nextProps.markers, this.props.markers) && !this.renderComp) {
122
+ return false;
123
+ }
124
+ this.renderComp = 0;
125
+ return true;
126
+ }
127
+ onMarkerClick(e, marker) {
128
+ const { onTagClick, actionClick } = this.props;
129
+ const start_time = parseFloat(e.target.getAttribute('leftpos'));
130
+ const end_time = parseFloat(e.target.getAttribute('rightpos'));
131
+ // actions.handleMarkerUpdate(start_time, end_time);
132
+ actionClick({
133
+ action: 'pause'
134
+ });
135
+ // actions.pause();
136
+ actionClick({
137
+ action: 'seek',
138
+ value: start_time
139
+ });
140
+ // actions.seek(start_time);
141
+ onTagClick(start_time, end_time, marker);
142
+ }
143
+
144
+ getPointerStyle(leftMarker, rightMarker, index) {
145
+ const { duration } = this.props;
146
+ const left = (leftMarker / duration.seconds) * 100;
147
+ const right = (rightMarker / duration.seconds) * 100;
148
+ const width = right - left;
149
+ const style = {
150
+ left: `${left}%`,
151
+ position: 'absolute',
152
+ bottom: 0,
153
+ height: '100%',
154
+ width: `${width}%`,
155
+ cursor: 'pointer',
156
+ backgroundColor: index % 2 === 0 ? '#00cec6' : '#146778',
157
+ opacity: 0.8,
158
+ minWidth: '0.3px'
159
+ };
160
+ return style;
161
+ }
162
+
163
+ setTooltipData(e, title) {
164
+ const { tooltip } = this.state;
165
+ tooltip.isVisible = false;
166
+ tooltip.text = title;
167
+ tooltip.bottom = window.innerHeight - e.target.getBoundingClientRect().top; // e.target.getBoundingClientRect().top - e.target.getBoundingClientRect().height - 10;
168
+ tooltip.bottom = title.line1 ? tooltip.bottom + 22 : tooltip.bottom + 10;
169
+ tooltip.left =
170
+ e.target.getBoundingClientRect().left +
171
+ (e.target.getBoundingClientRect().right - e.target.getBoundingClientRect().left) / 2;
172
+ this.renderComp = 1;
173
+ this.setState({ ...tooltip }, () => {
174
+ const { tooltip } = this.state;
175
+ const tooltipRefOffset =
176
+ this._tooltipRef.current && this._tooltipRef.current.offsetWidth ? this._tooltipRef.current.offsetWidth / 2 : 0;
177
+ tooltip.isVisible = true;
178
+ tooltip.left = tooltip.left - tooltipRefOffset;
179
+ this.renderComp = 1;
180
+ this.setState({
181
+ ...tooltip
182
+ });
183
+ });
184
+ }
185
+
186
+ getTitle(marker) {
187
+ let data = marker.segment_title || marker.word || '';
188
+ if (!data.length && marker.line1) {
189
+ return {
190
+ line1: marker.line1,
191
+ line2: marker.line2
192
+ };
193
+ }
194
+ return data;
195
+ }
196
+
197
+ render() {
198
+ const { markers } = this.props;
199
+ const {
200
+ tooltip: { isVisible, text, left, bottom }
201
+ } = this.state;
202
+ const self = this;
203
+ return (
204
+ <React.Fragment>
205
+ {markers && markers.length
206
+ ? markers.map((marker_obj) => {
207
+ return (
208
+ <PointersContainer key={marker_obj.name}>
209
+ <MarkerTagsBlock key={`${marker_obj.name}-tags-block`}>
210
+ <div className="tags-block">
211
+ <p>{marker_obj.name}</p>
212
+ </div>
213
+ </MarkerTagsBlock>
214
+ <PointerBlock key={`${marker_obj.name}-key-tags-block`}>
215
+ {marker_obj && marker_obj.values && marker_obj.values.length ? (
216
+ marker_obj.values.map((marker, index) => {
217
+ const style = self.getPointerStyle(marker.start_time, marker.end_time, index);
218
+ return (
219
+ <div
220
+ className="marker-blocks"
221
+ onClick={(e) => {
222
+ this.onMarkerClick(e, marker);
223
+ }}
224
+ onMouseOver={(e) => {
225
+ self.setTooltipData(e, this.getTitle(marker));
226
+ }}
227
+ onMouseOut={() => {
228
+ const { tooltip } = this.state;
229
+ tooltip.isVisible = false;
230
+ tooltip.text = null;
231
+ this.renderComp = 1;
232
+ // tooltip.left = null;
233
+ this.setState({ ...tooltip });
234
+ }}
235
+ role="button"
236
+ tabIndex="-1"
237
+ style={style}
238
+ leftpos={marker.start_time}
239
+ rightpos={marker.end_time}
240
+ key={`${marker.start_time}-${marker.end_time}-${index}`}
241
+ />
242
+ );
243
+ })
244
+ ) : (
245
+ <div className="empty-pointers-msg">
246
+ <p>Mark In</p>
247
+ <Icon name="in-marker" stroke="#fff" width={7} height={11} />
248
+ <p>and Mark Out</p>
249
+ <Icon name="out-marker" stroke="#fff" width={7} height={11} />
250
+ <p>to create {marker_obj.name} in the selected range. </p>
251
+ {/* <p>Then press</p>
252
+ <Icon name="add" stroke="#fff" width={10} height={10} />
253
+ <p>to create {marker_obj.name}.</p> */}
254
+ </div>
255
+ )}
256
+ </PointerBlock>
257
+ <MarkerTagsBlock>
258
+ <div className="tags-block">
259
+ <p />
260
+ </div>
261
+ </MarkerTagsBlock>
262
+ </PointersContainer>
263
+ );
264
+ })
265
+ : null}
266
+ {text && (
267
+ <ToolTipStyles
268
+ multiline={!!text.line1}
269
+ ref={this._tooltipRef}
270
+ style={{ left: left || 0, bottom: bottom || 0, visibility: isVisible ? 'visible' : 'hidden' }}>
271
+ <div className="tooltip-container">
272
+ {text.line1 && <h4>{text.line1}</h4>}
273
+ {text.line2 && <h4>{text.line2}</h4>}
274
+ {!text.line1 && <h4>{text}</h4>}
275
+ </div>
276
+ </ToolTipStyles>
277
+ )}
278
+ <div id="dummy-container"></div>
279
+ </React.Fragment>
280
+ );
281
+ }
282
+ }
283
+
284
+ PointersBar.propTypes = propTypes;
285
+ PointersBar.defaultProps = defaultProps;
286
+ PointersBar.displayName = 'PointersBar';
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = void 0;
8
+ var _propTypes = require("prop-types");
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _reactDom = require("react-dom");
11
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
12
+ var Dom = _interopRequireWildcard(require("../utils/dom"));
13
+ var _SeekBar = _interopRequireDefault(require("./SeekBar"));
14
+ var _PointersBar = _interopRequireDefault(require("./PointersBar"));
15
+ var _colors = _interopRequireDefault(require("../utils/colors"));
16
+ var _templateObject, _templateObject2, _templateObject3;
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
18
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
20
+ 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); }
21
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
22
+ 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); } }
23
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
24
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
25
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
26
+ 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); }
27
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
28
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
29
+ 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); }
30
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
31
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
32
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
33
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
34
+ var propTypes = {
35
+ player: _propTypes.PropTypes.instanceOf(Object),
36
+ controlType: _propTypes.PropTypes.string,
37
+ playerType: _propTypes.PropTypes.oneOf(['dubbing_review', 'clipping_default', 'default', 'tagging', 'qc', 'subtitle', 'snp_edit', 'archive', 'restore', 'clipping', 'storyboard', 'panel'])
38
+ };
39
+ var defaultProps = {};
40
+ var ProgressControlBlock = _styledComponents["default"].div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n height: ", ";\n position: relative;\n overflow: ", ";\n padding-top: 0px;\n background: #000000;\n background: ", ";\n display: flex;\n justify-content: center;\n align-items: center;\n transition: all 250ms ease-in-out;\n bottom: ", ";\n"])), function (props) {
41
+ return props.controlType === 'advanced' && !props.isFullscreen ? '80px' : '4px';
42
+ }, function (props) {
43
+ return props.controlType === 'advanced' && !props.isFullscreen ? 'none' : 'visible';
44
+ }, _colors["default"].common.base.black, function (props) {
45
+ return props.player === 'panel' && props.active ? '50px' : 'initial';
46
+ });
47
+ var SeekControlBar = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 100%;\n height: 100%;\n position: relative;\n cursor: pointer;\n z-index: ", ";\n"])), function (props) {
48
+ return props.controlType === 'advanced' && !props.isFullscreen ? '2' : '1';
49
+ });
50
+ var MarkerTagsBlock = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n min-width: 100px;\n max-width: 100px;\n position: relative;\n height: 100%;\n .empty-block {\n height: calc(100% - 20px);\n }\n .tags-block {\n height: 20px;\n font-family: SFUIText-Medium;\n font-size: 12px;\n color: #ffffff;\n text-transform: uppercase;\n border-top: 1px solid #333333;\n border-bottom: 1px solid #333333;\n p {\n line-height: 18px;\n padding-left: 10px;\n }\n }\n"])));
51
+ var ProgressControl = /*#__PURE__*/function (_Component) {
52
+ _inherits(ProgressControl, _Component);
53
+ var _super = _createSuper(ProgressControl);
54
+ function ProgressControl(props, context) {
55
+ var _this;
56
+ _classCallCheck(this, ProgressControl);
57
+ _this = _super.call(this, props, context);
58
+ _this.state = {
59
+ mouseTime: {
60
+ time: null,
61
+ position: 0,
62
+ stateZoom: null
63
+ }
64
+ };
65
+ _this.handleMouseMoveThrottle = _this.handleMouseMove.bind(_assertThisInitialized(_this));
66
+ return _this;
67
+ }
68
+ _createClass(ProgressControl, [{
69
+ key: "handleMouseMove",
70
+ value: function handleMouseMove(event) {
71
+ // if (!event.pageX) {
72
+ // return;
73
+ // }
74
+ // const {
75
+ // duration: { seconds }
76
+ // } = this.props;
77
+ // const node = findDOMNode(this.seekBar);
78
+ // const newTime = Dom.getPointerPosition(node, event).x * seconds;
79
+ // const position = event.pageX - Dom.findElPosition(node).left;
80
+ // this.setState({
81
+ // mouseTime: {
82
+ // time: newTime,
83
+ // position
84
+ // }
85
+ // });
86
+ }
87
+ }, {
88
+ key: "render",
89
+ value: function render() {
90
+ var _this2 = this;
91
+ var _this$props = this.props,
92
+ controlType = _this$props.controlType,
93
+ playerType = _this$props.playerType,
94
+ isFullscreen = _this$props.isFullscreen,
95
+ userActivity = _this$props.userActivity;
96
+ var mouseTime = this.state.mouseTime;
97
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(ProgressControlBlock, {
98
+ controlType: controlType,
99
+ player: playerType,
100
+ active: userActivity,
101
+ isFullscreen: isFullscreen,
102
+ ref: function ref(c) {
103
+ _this2.progressControlBlock = c;
104
+ }
105
+ }, controlType === 'advanced' && !isFullscreen ? /*#__PURE__*/_react["default"].createElement(MarkerTagsBlock, null, /*#__PURE__*/_react["default"].createElement("div", {
106
+ className: "empty-block"
107
+ })) : null, /*#__PURE__*/_react["default"].createElement(SeekControlBar, {
108
+ ref: function ref(c) {
109
+ _this2.seekControlBar = c;
110
+ },
111
+ onMouseMove: this.handleMouseMoveThrottle
112
+ }, /*#__PURE__*/_react["default"].createElement(_SeekBar["default"], _extends({
113
+ mouseTime: mouseTime,
114
+ ref: function ref(c) {
115
+ _this2.seekBar = c;
116
+ }
117
+ }, this.props))), controlType === 'advanced' && !isFullscreen ? /*#__PURE__*/_react["default"].createElement(MarkerTagsBlock, null, /*#__PURE__*/_react["default"].createElement("div", {
118
+ className: "empty-block"
119
+ })) : null), controlType === 'advanced' && !isFullscreen ? /*#__PURE__*/_react["default"].createElement(_PointersBar["default"], this.props) : null);
120
+ }
121
+ }]);
122
+ return ProgressControl;
123
+ }(_react.Component);
124
+ exports["default"] = ProgressControl;
125
+ ProgressControl.propTypes = propTypes;
126
+ ProgressControl.defaultProps = defaultProps;
127
+ ProgressControl.displayName = 'ProgressControl';