@desynova-digital/player 3.13.17 → 3.13.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Manager.js +9 -10
- package/actions/player.js +15 -30
- package/actions/video.js +25 -50
- package/colors.js +1 -2
- package/components/AudioMeter.js +12 -14
- package/components/BigPlayButton.js +12 -14
- package/components/ImageViewer.js +13 -15
- package/components/MarkerBar.js +12 -14
- package/components/Player.js +14 -16
- package/components/PlayerHeader.js +12 -14
- package/components/Playlist.js +15 -14
- package/components/PointersBar.js +14 -16
- package/components/PosterImage.js +1 -2
- package/components/Shortcut.js +210 -162
- package/components/Slider.js +12 -14
- package/components/TagsBar.js +12 -14
- package/components/Video.js +14 -17
- package/components/control-bar/AudioTracksMenuButton.js +11 -13
- package/components/control-bar/CameraButton.js +12 -14
- package/components/control-bar/CommentsButton.js +12 -14
- package/components/control-bar/ControlBar.js +12 -14
- package/components/control-bar/EditorControlMenuButton.js +12 -14
- package/components/control-bar/ForwardControl.js +1 -2
- package/components/control-bar/ForwardReplayControl.js +13 -15
- package/components/control-bar/FullscreenToggle.js +12 -14
- package/components/control-bar/PlayToggle.js +12 -14
- package/components/control-bar/ReplayControl.js +1 -2
- package/components/control-bar/SubtitleLanguagesMenuButton.js +11 -13
- package/components/control-bar/SubtitleMovementMenu.js +12 -14
- package/components/control-bar/VolumeMenuButton.js +12 -14
- package/components/control-bar/ZoomMenuButton.js +12 -14
- package/components/marking-controls/MarkInControl.js +12 -14
- package/components/marking-controls/MarkOutControl.js +12 -14
- package/components/marking-controls/MarkingAddButton.js +12 -14
- package/components/marking-controls/MarkingDeleteButton.js +12 -14
- package/components/marking-controls/MarkingPreview.js +12 -14
- package/components/progress-bar/AudioWaveform.js +12 -14
- package/components/progress-bar/MouseTimeDisplay.js +1 -2
- package/components/progress-bar/ProgressControl.js +12 -14
- package/components/progress-bar/SeekBar.js +12 -14
- package/components/progress-bar/Timeline.js +12 -14
- package/components/settings-menu-control/PlaybackRateControl.js +12 -14
- package/components/settings-menu-control/SafeAreaControl.js +12 -14
- package/components/time-controls/CurrentTimeDisplay.js +1 -2
- package/components/time-controls/DurationDisplay.js +1 -2
- package/components/volume-control/VolumeBar.js +12 -14
- package/components/volume-control/VolumeLevel.js +1 -2
- package/components/zoom-control/ZoomBar.js +12 -14
- package/components/zoom-control/ZoomLevel.js +1 -2
- package/index.js +3 -3
- package/package.json +1 -1
- package/reducers/index.js +2 -4
- package/reducers/operation.js +6 -7
- package/reducers/player.js +6 -8
- package/utils/browser.js +4 -8
- package/utils/fullscreen.js +4 -5
- package/utils/index.js +6 -7
package/components/Shortcut.js
CHANGED
|
@@ -9,7 +9,7 @@ var _propTypes = require("prop-types");
|
|
|
9
9
|
var _lodash = require("lodash");
|
|
10
10
|
var _hotkeysJs = _interopRequireDefault(require("hotkeys-js"));
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
-
function _typeof(
|
|
12
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
13
13
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
14
14
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
15
15
|
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); }
|
|
@@ -19,16 +19,16 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
19
19
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
20
20
|
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); } }
|
|
21
21
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
22
|
-
function
|
|
23
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
24
|
-
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); }; }
|
|
22
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
25
23
|
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); }
|
|
26
|
-
function
|
|
27
|
-
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; } }
|
|
24
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
28
25
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
26
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
27
|
+
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); }
|
|
28
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
29
29
|
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; }
|
|
30
|
-
function _toPropertyKey(
|
|
31
|
-
function _toPrimitive(
|
|
30
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
31
|
+
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); }
|
|
32
32
|
var propTypes = {
|
|
33
33
|
clickable: _propTypes.PropTypes.bool,
|
|
34
34
|
dblclickable: _propTypes.PropTypes.bool,
|
|
@@ -49,13 +49,12 @@ var defaultProps = {
|
|
|
49
49
|
player: {},
|
|
50
50
|
shortcuts: []
|
|
51
51
|
};
|
|
52
|
-
var Shortcut = /*#__PURE__*/function (_Component) {
|
|
52
|
+
var Shortcut = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
53
53
|
_inherits(Shortcut, _Component);
|
|
54
|
-
var _super = _createSuper(Shortcut);
|
|
55
54
|
function Shortcut(props, context) {
|
|
56
55
|
var _this;
|
|
57
56
|
_classCallCheck(this, Shortcut);
|
|
58
|
-
_this =
|
|
57
|
+
_this = _callSuper(this, Shortcut, [props, context]);
|
|
59
58
|
_defineProperty(_assertThisInitialized(_this), "debounceKeyFunc", (0, _lodash.debounce)(function (keyCode) {
|
|
60
59
|
_this.handleKeyMovement(keyCode);
|
|
61
60
|
}));
|
|
@@ -66,13 +65,26 @@ var Shortcut = /*#__PURE__*/function (_Component) {
|
|
|
66
65
|
*common function to handle the key functionalies. eg-> W Key and Q key functionalities
|
|
67
66
|
*/
|
|
68
67
|
_defineProperty(_assertThisInitialized(_this), "handleKeyMovement", function (keyCode) {
|
|
69
|
-
var
|
|
68
|
+
var _this$props$markers$, _this$props$playerSel, _this$props$player, _this$props$player2;
|
|
69
|
+
if (keyCode === 81 || keyCode === 87) {
|
|
70
|
+
_this.isCalled = true;
|
|
71
|
+
}
|
|
72
|
+
var frameRateNumber = parseInt(_this.props.frameRate);
|
|
73
|
+
var timeAfterOverlap;
|
|
70
74
|
var keyPressHandle = _this.defaultShortcuts.find(function (shortcut) {
|
|
71
75
|
return shortcut.keyCode === keyCode;
|
|
72
76
|
});
|
|
77
|
+
var ans = _this.findAdjacentMarkers((_this$props$markers$ = _this.props.markers[0]) === null || _this$props$markers$ === void 0 ? void 0 : _this$props$markers$.values, (_this$props$playerSel = _this.props.playerSelectedMarker) === null || _this$props$playerSel === void 0 ? void 0 : _this$props$playerSel.data);
|
|
78
|
+
if (((_this$props$player = _this.props.player) === null || _this$props$player === void 0 ? void 0 : _this$props$player.currentTime) >= (ans === null || ans === void 0 ? void 0 : ans.in_time_forward)) {
|
|
79
|
+
timeAfterOverlap = ans.in_time_forward - 1 / frameRateNumber;
|
|
80
|
+
}
|
|
81
|
+
if (((_this$props$player2 = _this.props.player) === null || _this$props$player2 === void 0 ? void 0 : _this$props$player2.currentTime) <= (ans === null || ans === void 0 ? void 0 : ans.out_time_behind)) {
|
|
82
|
+
timeAfterOverlap = ans.out_time_behind + 1 / frameRateNumber;
|
|
83
|
+
}
|
|
73
84
|
if (keyPressHandle) {
|
|
74
|
-
|
|
75
|
-
|
|
85
|
+
keyPressHandle.handle(_this.props.player, _this.props.actions, {
|
|
86
|
+
timeAfterOverlap: timeAfterOverlap
|
|
87
|
+
});
|
|
76
88
|
}
|
|
77
89
|
});
|
|
78
90
|
/**
|
|
@@ -85,42 +97,43 @@ var Shortcut = /*#__PURE__*/function (_Component) {
|
|
|
85
97
|
* Once we leave the keyCombo isCalled variable is set to false. This ensures that on the next combo press we will again execute Q/W key combo first.
|
|
86
98
|
*/
|
|
87
99
|
_defineProperty(_assertThisInitialized(_this), "createThreeKeyCombo", function (event, handleKeyMovement, debounceKeyFunc, keyParameter) {
|
|
88
|
-
|
|
89
|
-
|
|
100
|
+
var _this$props = _this.props,
|
|
101
|
+
playerReadOnlyMode = _this$props.playerReadOnlyMode,
|
|
102
|
+
disablePlayerActions = _this$props.disablePlayerActions;
|
|
103
|
+
if (playerReadOnlyMode || disablePlayerActions.includes('marking_controls')) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (!_this.isCalled) {
|
|
90
107
|
handleKeyMovement();
|
|
91
108
|
}
|
|
92
109
|
if (event.type === 'keydown') {
|
|
93
110
|
debounceKeyFunc();
|
|
94
|
-
_this.
|
|
95
|
-
isCalled: true
|
|
96
|
-
});
|
|
111
|
+
_this.isCalled = true;
|
|
97
112
|
}
|
|
98
113
|
if (event.type === 'keyup') {
|
|
99
|
-
_this.
|
|
100
|
-
isCalled: false
|
|
101
|
-
});
|
|
114
|
+
_this.isCalled = false;
|
|
102
115
|
}
|
|
103
116
|
});
|
|
104
117
|
_defineProperty(_assertThisInitialized(_this), "threeKeyCombo1", (0, _lodash.debounce)(function (event) {
|
|
105
|
-
return _this.createThreeKeyCombo(event, _this.handleKeyMovement.bind(_assertThisInitialized(_this), 87
|
|
118
|
+
return _this.createThreeKeyCombo(event, _this.handleKeyMovement.bind(_assertThisInitialized(_this), 87), _this.debounceKeyFunc.bind(_assertThisInitialized(_this), 79), 'Ctrl + O + Right');
|
|
106
119
|
}, 0, {
|
|
107
120
|
leading: true,
|
|
108
121
|
trailing: true
|
|
109
122
|
}));
|
|
110
123
|
_defineProperty(_assertThisInitialized(_this), "threeKeyCombo2", (0, _lodash.debounce)(function (event) {
|
|
111
|
-
return _this.createThreeKeyCombo(event, _this.handleKeyMovement.bind(_assertThisInitialized(_this), 87
|
|
124
|
+
return _this.createThreeKeyCombo(event, _this.handleKeyMovement.bind(_assertThisInitialized(_this), 87), _this.debounceKeyFunc.bind(_assertThisInitialized(_this), 79), 'Ctrl + O + Left');
|
|
112
125
|
}, 0, {
|
|
113
126
|
leading: true,
|
|
114
127
|
trailing: true
|
|
115
128
|
}));
|
|
116
129
|
_defineProperty(_assertThisInitialized(_this), "threeKeyCombo3", (0, _lodash.debounce)(function (event) {
|
|
117
|
-
return _this.createThreeKeyCombo(event, _this.handleKeyMovement.bind(_assertThisInitialized(_this), 81
|
|
130
|
+
return _this.createThreeKeyCombo(event, _this.handleKeyMovement.bind(_assertThisInitialized(_this), 81), _this.debounceKeyFunc.bind(_assertThisInitialized(_this), 73), 'Ctrl + I + Right');
|
|
118
131
|
}, 0, {
|
|
119
132
|
leading: true,
|
|
120
133
|
trailing: true
|
|
121
134
|
}));
|
|
122
135
|
_defineProperty(_assertThisInitialized(_this), "threeKeyCombo4", (0, _lodash.debounce)(function (event) {
|
|
123
|
-
return _this.createThreeKeyCombo(event, _this.handleKeyMovement.bind(_assertThisInitialized(_this), 81
|
|
136
|
+
return _this.createThreeKeyCombo(event, _this.handleKeyMovement.bind(_assertThisInitialized(_this), 81), _this.debounceKeyFunc.bind(_assertThisInitialized(_this), 73), 'Ctrl + I + Left');
|
|
124
137
|
}, 0, {
|
|
125
138
|
leading: true,
|
|
126
139
|
trailing: true
|
|
@@ -237,49 +250,61 @@ var Shortcut = /*#__PURE__*/function (_Component) {
|
|
|
237
250
|
keyCode: 73,
|
|
238
251
|
// I Key
|
|
239
252
|
handle: function handle(player, actions) {
|
|
240
|
-
var
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
253
|
+
var _args$;
|
|
254
|
+
var _this$props2 = _this.props,
|
|
255
|
+
markers = _this$props2.markers,
|
|
256
|
+
playerType = _this$props2.playerType,
|
|
257
|
+
onAddMarker = _this$props2.onAddMarker,
|
|
258
|
+
playerReadOnlyMode = _this$props2.playerReadOnlyMode,
|
|
259
|
+
disablePlayerActions = _this$props2.disablePlayerActions,
|
|
260
|
+
playerSelectedMarker = _this$props2.playerSelectedMarker;
|
|
247
261
|
if (playerReadOnlyMode || disablePlayerActions.includes('marking_controls')) {
|
|
248
262
|
return;
|
|
249
263
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
264
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
265
|
+
args[_key - 2] = arguments[_key];
|
|
266
|
+
}
|
|
267
|
+
if ((_args$ = args[1]) !== null && _args$ !== void 0 && _args$.ctrlKey) {
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
var isOverLapTime = args[0].timeAfterOverlap;
|
|
271
|
+
if (isOverLapTime) {
|
|
272
|
+
onAddMarker(args[0].timeAfterOverlap, playerSelectedMarker.rightMarker, 'update');
|
|
273
|
+
} else {
|
|
274
|
+
if (playerType !== 'panel') {
|
|
275
|
+
var createPoint = true;
|
|
276
|
+
if (markers && markers.length && markers[0].values && markers[0].values.length) {
|
|
277
|
+
var markerArr = markers[0].values;
|
|
278
|
+
if (Object.keys(player.selectedMarker).length) {
|
|
279
|
+
markerArr = markerArr.filter(function (marker) {
|
|
280
|
+
return marker.start_time !== player.selectedMarker.leftMarker && marker.end_time !== player.selectedMarker.rightMarker;
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
markerArr.filter(function (marker) {
|
|
284
|
+
if (player.currentTime >= marker.start_time && player.currentTime <= marker.end_time || playerSelectedMarker.leftMarker > -1 && player.currentTime > marker.start_time && playerSelectedMarker.leftMarker < marker.start_time || playerSelectedMarker.leftMarker > -1 && player.currentTime < marker.start_time && playerSelectedMarker.leftMarker > marker.end_time) {
|
|
285
|
+
createPoint = false;
|
|
286
|
+
}
|
|
257
287
|
});
|
|
258
288
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
currentTime: player.currentTime
|
|
279
|
-
};
|
|
280
|
-
onAddMarker(player.currentTime, -1, '', true, data);
|
|
281
|
-
if (playerSelectedMarker.leftMarker > -1 && playerSelectedMarker.rightMarker > -1 && (!playerSelectedMarker.markerCreate || playerSelectedMarker.markerType === 'update' || playerSelectedMarker.data && Object.keys(playerSelectedMarker.data).length)) {
|
|
282
|
-
onAddMarker(player.currentTime, playerSelectedMarker.rightMarker, 'update');
|
|
289
|
+
if (!createPoint && playerSelectedMarker.markerType === 'update' && player.currentTime > player.selectedMarker.leftMarker && player.currentTime < player.selectedMarker.rightMarker) {
|
|
290
|
+
createPoint = true;
|
|
291
|
+
}
|
|
292
|
+
if (createPoint) {
|
|
293
|
+
if (playerSelectedMarker.rightMarker < 0 || playerSelectedMarker.rightMarker > -1 && player.currentTime < playerSelectedMarker.rightMarker) {
|
|
294
|
+
// actions.handleMarkerPointChange(
|
|
295
|
+
// player.markerType !== 'update' ? 'add' : 'update',
|
|
296
|
+
// 'left',
|
|
297
|
+
// player.currentTime
|
|
298
|
+
// );
|
|
299
|
+
var data = {
|
|
300
|
+
markerType: playerSelectedMarker.data && Object.keys(playerSelectedMarker.data).length ? 'update' : 'add',
|
|
301
|
+
markerPos: 'left',
|
|
302
|
+
currentTime: player.currentTime
|
|
303
|
+
};
|
|
304
|
+
onAddMarker(player.currentTime, -1, '', true, data);
|
|
305
|
+
if (playerSelectedMarker.leftMarker > -1 && playerSelectedMarker.rightMarker > -1 && (!playerSelectedMarker.markerCreate || playerSelectedMarker.markerType === 'update' || playerSelectedMarker.data && Object.keys(playerSelectedMarker.data).length)) {
|
|
306
|
+
onAddMarker(player.currentTime, playerSelectedMarker.rightMarker, 'update');
|
|
307
|
+
}
|
|
283
308
|
}
|
|
284
309
|
}
|
|
285
310
|
}
|
|
@@ -289,61 +314,77 @@ var Shortcut = /*#__PURE__*/function (_Component) {
|
|
|
289
314
|
keyCode: 79,
|
|
290
315
|
// O Key
|
|
291
316
|
handle: function handle(player, actions) {
|
|
292
|
-
var
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
317
|
+
var _args$2;
|
|
318
|
+
var _this$props3 = _this.props,
|
|
319
|
+
markers = _this$props3.markers,
|
|
320
|
+
onMarkerSelect = _this$props3.onMarkerSelect,
|
|
321
|
+
playerType = _this$props3.playerType,
|
|
322
|
+
onAddMarker = _this$props3.onAddMarker,
|
|
323
|
+
playerReadOnlyMode = _this$props3.playerReadOnlyMode,
|
|
324
|
+
disablePlayerActions = _this$props3.disablePlayerActions,
|
|
325
|
+
playerSelectedMarker = _this$props3.playerSelectedMarker;
|
|
300
326
|
if (playerReadOnlyMode || disablePlayerActions.includes('marking_controls')) {
|
|
301
327
|
return;
|
|
302
328
|
}
|
|
303
|
-
var
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
329
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
330
|
+
args[_key2 - 2] = arguments[_key2];
|
|
331
|
+
}
|
|
332
|
+
if ((_args$2 = args[1]) !== null && _args$2 !== void 0 && _args$2.ctrlKey) {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
var isOverLapTime = args[0].timeAfterOverlap;
|
|
336
|
+
if (isOverLapTime) {
|
|
337
|
+
var data = {
|
|
338
|
+
markerType: playerSelectedMarker.data && Object.keys(playerSelectedMarker.data).length ? 'update' : 'add',
|
|
339
|
+
markerPos: 'right',
|
|
340
|
+
currentTime: args[0].timeAfterOverlap
|
|
341
|
+
};
|
|
342
|
+
onAddMarker(playerSelectedMarker.leftMarker, args[0].timeAfterOverlap, 'update', false, data);
|
|
343
|
+
} else {
|
|
344
|
+
var createPoint = true;
|
|
345
|
+
if (playerType !== 'panel') {
|
|
346
|
+
if (markers && markers.length && markers[0].values && markers[0].values.length) {
|
|
347
|
+
var markerArr = markers[0].values;
|
|
348
|
+
if (Object.keys(player.selectedMarker).length) {
|
|
349
|
+
markerArr = markerArr.filter(function (marker) {
|
|
350
|
+
return marker.start_time !== player.selectedMarker.leftMarker && marker.end_time !== player.selectedMarker.rightMarker;
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
markerArr.filter(function (marker) {
|
|
354
|
+
if (player.currentTime >= marker.start_time && player.currentTime <= marker.end_time || playerSelectedMarker.leftMarker > -1 && player.currentTime > marker.start_time && playerSelectedMarker.leftMarker < marker.start_time || playerSelectedMarker.leftMarker > -1 && player.currentTime < marker.start_time && playerSelectedMarker.leftMarker > marker.end_time) {
|
|
355
|
+
createPoint = false;
|
|
356
|
+
}
|
|
310
357
|
});
|
|
311
358
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
359
|
+
if (!createPoint && playerSelectedMarker.markerType === 'update' && player.currentTime > player.selectedMarker.leftMarker && player.currentTime < player.selectedMarker.rightMarker) {
|
|
360
|
+
createPoint = true;
|
|
361
|
+
}
|
|
362
|
+
if (createPoint && playerSelectedMarker.leftMarker > -1 && player.currentTime > playerSelectedMarker.leftMarker) {
|
|
363
|
+
// actions.handleMarkerPointChange(
|
|
364
|
+
// markerType: player.markerType !== 'update' ? 'add' : 'update',
|
|
365
|
+
// markerPos: 'right',
|
|
366
|
+
// currentTime: player.currentTime
|
|
367
|
+
// );
|
|
368
|
+
var _data = {
|
|
369
|
+
markerType: playerSelectedMarker.data && Object.keys(playerSelectedMarker.data).length ? 'update' : 'add',
|
|
370
|
+
markerPos: 'right',
|
|
371
|
+
currentTime: player.currentTime
|
|
372
|
+
};
|
|
373
|
+
if (playerSelectedMarker.leftMarker > -1 && playerSelectedMarker.rightMarker > -1 && (!playerSelectedMarker.markerCreate || playerSelectedMarker.markerType === 'update' || playerSelectedMarker.data && Object.keys(playerSelectedMarker.data).length)) {
|
|
374
|
+
onAddMarker(playerSelectedMarker.leftMarker, player.currentTime, 'update', false, _data);
|
|
315
375
|
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
}
|
|
321
|
-
if (createPoint && playerSelectedMarker.leftMarker > -1 && player.currentTime > playerSelectedMarker.leftMarker) {
|
|
322
|
-
// actions.handleMarkerPointChange(
|
|
323
|
-
// markerType: player.markerType !== 'update' ? 'add' : 'update',
|
|
324
|
-
// markerPos: 'right',
|
|
325
|
-
// currentTime: player.currentTime
|
|
326
|
-
// );
|
|
327
|
-
var data = {
|
|
328
|
-
markerType: playerSelectedMarker.data && Object.keys(playerSelectedMarker.data).length ? 'update' : 'add',
|
|
329
|
-
markerPos: 'right',
|
|
330
|
-
currentTime: player.currentTime
|
|
331
|
-
};
|
|
332
|
-
if (playerSelectedMarker.leftMarker > -1 && playerSelectedMarker.rightMarker > -1 && (!playerSelectedMarker.markerCreate || playerSelectedMarker.markerType === 'update' || playerSelectedMarker.data && Object.keys(playerSelectedMarker.data).length)) {
|
|
333
|
-
onAddMarker(playerSelectedMarker.leftMarker, player.currentTime, 'update', false, data);
|
|
376
|
+
//Commented for CN-632.
|
|
377
|
+
// if (player.controlType === 'default') {
|
|
378
|
+
// onMarkerSelect(player.leftMarker, player.currentTime);
|
|
379
|
+
// }
|
|
334
380
|
}
|
|
335
|
-
//Commented for CN-632.
|
|
336
|
-
// if (player.controlType === 'default') {
|
|
337
|
-
// onMarkerSelect(player.leftMarker, player.currentTime);
|
|
338
|
-
// }
|
|
339
381
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
});
|
|
382
|
+
if (playerSelectedMarker.leftMarker > -1 && player.currentTime > -1 && playerSelectedMarker.markerCreate && createPoint && player.currentTime > playerSelectedMarker.leftMarker) {
|
|
383
|
+
// actions.handleMarkerPointChange('create');
|
|
384
|
+
onAddMarker(playerSelectedMarker.leftMarker, player.currentTime, '', false, {
|
|
385
|
+
markerType: 'create'
|
|
386
|
+
});
|
|
387
|
+
}
|
|
347
388
|
}
|
|
348
389
|
}
|
|
349
390
|
}, {
|
|
@@ -440,16 +481,11 @@ var Shortcut = /*#__PURE__*/function (_Component) {
|
|
|
440
481
|
//'ctrl + ['
|
|
441
482
|
ctrl: true,
|
|
442
483
|
handle: function handle(player, actions, frameRate, e, markers) {
|
|
443
|
-
var _this$
|
|
444
|
-
leftMarker = _this$
|
|
445
|
-
|
|
446
|
-
_this$props3$playerSe2 = _this$props3$playerSe === void 0 ? {} : _this$props3$playerSe,
|
|
447
|
-
_this$props3$playerSe3 = _this$props3$playerSe2.data,
|
|
448
|
-
_this$props3$playerSe4 = _this$props3$playerSe3 === void 0 ? {} : _this$props3$playerSe3,
|
|
449
|
-
uniqueKey = _this$props3$playerSe4.uniqueKey,
|
|
450
|
-
onTagClick = _this$props3.onTagClick;
|
|
484
|
+
var _this$props4 = _this.props,
|
|
485
|
+
leftMarker = _this$props4.playerSelectedMarker.leftMarker,
|
|
486
|
+
onTagClick = _this$props4.onTagClick;
|
|
451
487
|
var newIndex = markers.findIndex(function (item) {
|
|
452
|
-
return item.
|
|
488
|
+
return item.in_time === leftMarker;
|
|
453
489
|
}) - 1;
|
|
454
490
|
if (leftMarker > -1 && newIndex > -1) {
|
|
455
491
|
var _markers$newIndex, _markers$newIndex2, _markers$newIndex3;
|
|
@@ -462,16 +498,11 @@ var Shortcut = /*#__PURE__*/function (_Component) {
|
|
|
462
498
|
//'ctrl + ]'
|
|
463
499
|
ctrl: true,
|
|
464
500
|
handle: function handle(player, actions, frameRate, e, markers) {
|
|
465
|
-
var _this$
|
|
466
|
-
leftMarker = _this$
|
|
467
|
-
|
|
468
|
-
_this$props4$playerSe2 = _this$props4$playerSe === void 0 ? {} : _this$props4$playerSe,
|
|
469
|
-
_this$props4$playerSe3 = _this$props4$playerSe2.data,
|
|
470
|
-
_this$props4$playerSe4 = _this$props4$playerSe3 === void 0 ? {} : _this$props4$playerSe3,
|
|
471
|
-
uniqueKey = _this$props4$playerSe4.uniqueKey,
|
|
472
|
-
onTagClick = _this$props4.onTagClick;
|
|
501
|
+
var _this$props5 = _this.props,
|
|
502
|
+
leftMarker = _this$props5.playerSelectedMarker.leftMarker,
|
|
503
|
+
onTagClick = _this$props5.onTagClick;
|
|
473
504
|
var newIndex = markers.findIndex(function (item) {
|
|
474
|
-
return item.
|
|
505
|
+
return item.in_time === leftMarker;
|
|
475
506
|
}) + 1;
|
|
476
507
|
if (leftMarker > -1 && newIndex < markers.length) {
|
|
477
508
|
var _markers$newIndex4, _markers$newIndex5, _markers$newIndex6;
|
|
@@ -481,9 +512,7 @@ var Shortcut = /*#__PURE__*/function (_Component) {
|
|
|
481
512
|
}
|
|
482
513
|
}];
|
|
483
514
|
_this.shortcuts = _toConsumableArray(_this.defaultShortcuts);
|
|
484
|
-
_this.
|
|
485
|
-
isCalled: false
|
|
486
|
-
};
|
|
515
|
+
_this.isCalled = false;
|
|
487
516
|
_this.mergeShortcuts = _this.mergeShortcuts.bind(_assertThisInitialized(_this));
|
|
488
517
|
_this.handleKeyPress = _this.handleKeyPress.bind(_assertThisInitialized(_this));
|
|
489
518
|
_this.handleClick = _this.handleClick.bind(_assertThisInitialized(_this));
|
|
@@ -494,19 +523,19 @@ var Shortcut = /*#__PURE__*/function (_Component) {
|
|
|
494
523
|
key: "componentDidMount",
|
|
495
524
|
value: function componentDidMount() {
|
|
496
525
|
this.mergeShortcuts();
|
|
497
|
-
(0, _hotkeysJs["default"])('ctrl+i+left', {
|
|
526
|
+
(0, _hotkeysJs["default"])('ctrl+i+left, ctrl+left+i, i+ctrl+left, i+left+ ctrl, left+ ctrl+ i, left+i+ ctrl', {
|
|
498
527
|
keyup: true,
|
|
499
528
|
keydown: true
|
|
500
529
|
}, this.threeKeyCombo4);
|
|
501
|
-
(0, _hotkeysJs["default"])('ctrl+i+right', {
|
|
530
|
+
(0, _hotkeysJs["default"])('ctrl+i+right,ctrl+right+i,i+ctrl+right,i+right+ctrl,right+ctrl+i,right+i+ctrl', {
|
|
502
531
|
keyup: true,
|
|
503
532
|
keydown: true
|
|
504
533
|
}, this.threeKeyCombo3);
|
|
505
|
-
(0, _hotkeysJs["default"])('ctrl+o+left', {
|
|
534
|
+
(0, _hotkeysJs["default"])('ctrl+o+left,ctrl+left+o,o+ctrl+left,o+left+ctrl,left+ctrl+o,left+o+ctrl', {
|
|
506
535
|
keyup: true,
|
|
507
536
|
keydown: true
|
|
508
537
|
}, this.threeKeyCombo2);
|
|
509
|
-
(0, _hotkeysJs["default"])('ctrl+o+right', {
|
|
538
|
+
(0, _hotkeysJs["default"])('ctrl+o+right,ctrl+right+o,o+ctrl+right,o+right+ctrl,right+ctrl+o,right+o+ctrl', {
|
|
510
539
|
keyup: true,
|
|
511
540
|
keydown: true
|
|
512
541
|
}, this.threeKeyCombo1);
|
|
@@ -514,13 +543,33 @@ var Shortcut = /*#__PURE__*/function (_Component) {
|
|
|
514
543
|
document.addEventListener('click', this.handleClick);
|
|
515
544
|
document.addEventListener('dblclick', this.handleDoubleClick);
|
|
516
545
|
}
|
|
546
|
+
}, {
|
|
547
|
+
key: "findAdjacentMarkers",
|
|
548
|
+
value: function findAdjacentMarkers(markers, selectedMarker) {
|
|
549
|
+
if (markers) {
|
|
550
|
+
var index = markers === null || markers === void 0 ? void 0 : markers.findIndex(function (marker) {
|
|
551
|
+
return marker.in_time === selectedMarker.in_time && marker.out_time === selectedMarker.out_time;
|
|
552
|
+
});
|
|
553
|
+
if (index !== -1) {
|
|
554
|
+
var adjacentMarkerForward = markers[index + 1];
|
|
555
|
+
var adjacentMarkerBehind = markers[index - 1];
|
|
556
|
+
var result = {
|
|
557
|
+
in_time_forward: adjacentMarkerForward ? adjacentMarkerForward.in_time : undefined,
|
|
558
|
+
out_time_behind: adjacentMarkerBehind ? adjacentMarkerBehind.out_time : undefined
|
|
559
|
+
};
|
|
560
|
+
return result;
|
|
561
|
+
}
|
|
562
|
+
} else {
|
|
563
|
+
return undefined;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
517
566
|
}, {
|
|
518
567
|
key: "componentDidUpdate",
|
|
519
568
|
value: function componentDidUpdate(prevProps) {
|
|
520
|
-
var _this$
|
|
521
|
-
shortcuts = _this$
|
|
522
|
-
player = _this$
|
|
523
|
-
frameRate = _this$
|
|
569
|
+
var _this$props6 = this.props,
|
|
570
|
+
shortcuts = _this$props6.shortcuts,
|
|
571
|
+
player = _this$props6.player,
|
|
572
|
+
frameRate = _this$props6.frameRate;
|
|
524
573
|
if (prevProps.shortcuts !== shortcuts) {
|
|
525
574
|
this.mergeShortcuts();
|
|
526
575
|
}
|
|
@@ -533,10 +582,10 @@ var Shortcut = /*#__PURE__*/function (_Component) {
|
|
|
533
582
|
}, {
|
|
534
583
|
key: "componentWillUnmount",
|
|
535
584
|
value: function componentWillUnmount() {
|
|
536
|
-
_hotkeysJs["default"].unbind('ctrl+i+left');
|
|
537
|
-
_hotkeysJs["default"].unbind('ctrl+i+right');
|
|
538
|
-
_hotkeysJs["default"].unbind('ctrl+o+left');
|
|
539
|
-
_hotkeysJs["default"].unbind('ctrl+o+right');
|
|
585
|
+
_hotkeysJs["default"].unbind('ctrl+i+left, ctrl+left+i, i+ctrl+left, i+left+ ctrl, left+ ctrl+ i, left+i+ ctrl');
|
|
586
|
+
_hotkeysJs["default"].unbind('ctrl+i+right,ctrl+right+i,i+ctrl+right,i+right+ctrl,right+ctrl+i,right+i+ctrl');
|
|
587
|
+
_hotkeysJs["default"].unbind('ctrl+o+left,ctrl+left+o,o+ctrl+left,o+left+ctrl,left+ctrl+o,left+o+ctrl');
|
|
588
|
+
_hotkeysJs["default"].unbind('ctrl+o+right,ctrl+right+o,o+ctrl+right,o+right+ctrl,right+ctrl+o,right+o+ctrl');
|
|
540
589
|
document.removeEventListener('keydown', this.handleKeyPress);
|
|
541
590
|
document.removeEventListener('click', this.handleClick);
|
|
542
591
|
document.removeEventListener('dblclick', this.handleDoubleClick);
|
|
@@ -544,10 +593,10 @@ var Shortcut = /*#__PURE__*/function (_Component) {
|
|
|
544
593
|
}, {
|
|
545
594
|
key: "rewindVideo",
|
|
546
595
|
value: function rewindVideo() {
|
|
547
|
-
var _this$
|
|
548
|
-
player = _this$
|
|
549
|
-
actions = _this$
|
|
550
|
-
frameRate = _this$
|
|
596
|
+
var _this$props7 = this.props,
|
|
597
|
+
player = _this$props7.player,
|
|
598
|
+
actions = _this$props7.actions,
|
|
599
|
+
frameRate = _this$props7.frameRate;
|
|
551
600
|
if (player.currentTime == 0 || !player.rewindActive) {
|
|
552
601
|
clearInterval(this.intervalRewind);
|
|
553
602
|
this.intervalRewind = null;
|
|
@@ -676,11 +725,11 @@ var Shortcut = /*#__PURE__*/function (_Component) {
|
|
|
676
725
|
}, {
|
|
677
726
|
key: "handleKeyPress",
|
|
678
727
|
value: function handleKeyPress(e) {
|
|
679
|
-
var _this$
|
|
680
|
-
player = _this$
|
|
681
|
-
actions = _this$
|
|
682
|
-
frameRate = _this$
|
|
683
|
-
markers = _this$
|
|
728
|
+
var _this$props8 = this.props,
|
|
729
|
+
player = _this$props8.player,
|
|
730
|
+
actions = _this$props8.actions,
|
|
731
|
+
frameRate = _this$props8.frameRate,
|
|
732
|
+
markers = _this$props8.markers;
|
|
684
733
|
if (!player.isActive) {
|
|
685
734
|
return;
|
|
686
735
|
}
|
|
@@ -719,10 +768,10 @@ var Shortcut = /*#__PURE__*/function (_Component) {
|
|
|
719
768
|
}, {
|
|
720
769
|
key: "handleClick",
|
|
721
770
|
value: function handleClick(e) {
|
|
722
|
-
var _this$
|
|
723
|
-
player = _this$
|
|
724
|
-
actions = _this$
|
|
725
|
-
clickable = _this$
|
|
771
|
+
var _this$props9 = this.props,
|
|
772
|
+
player = _this$props9.player,
|
|
773
|
+
actions = _this$props9.actions,
|
|
774
|
+
clickable = _this$props9.clickable;
|
|
726
775
|
if (!this.canBeClicked(player, e) || !clickable) {
|
|
727
776
|
return;
|
|
728
777
|
}
|
|
@@ -732,10 +781,10 @@ var Shortcut = /*#__PURE__*/function (_Component) {
|
|
|
732
781
|
}, {
|
|
733
782
|
key: "handleDoubleClick",
|
|
734
783
|
value: function handleDoubleClick(e) {
|
|
735
|
-
var _this$
|
|
736
|
-
player = _this$
|
|
737
|
-
actions = _this$
|
|
738
|
-
dblclickable = _this$
|
|
784
|
+
var _this$props10 = this.props,
|
|
785
|
+
player = _this$props10.player,
|
|
786
|
+
actions = _this$props10.actions,
|
|
787
|
+
dblclickable = _this$props10.dblclickable;
|
|
739
788
|
if (!this.canBeClicked(player, e) || !dblclickable) {
|
|
740
789
|
return;
|
|
741
790
|
}
|
|
@@ -755,7 +804,6 @@ var Shortcut = /*#__PURE__*/function (_Component) {
|
|
|
755
804
|
}]);
|
|
756
805
|
return Shortcut;
|
|
757
806
|
}(_react.Component);
|
|
758
|
-
exports["default"] = Shortcut;
|
|
759
807
|
Shortcut.propTypes = propTypes;
|
|
760
808
|
Shortcut.defaultProps = defaultProps;
|
|
761
809
|
Shortcut.displayName = 'Shortcut';
|