@desynova-digital/player 3.13.22 → 3.13.24
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.
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
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); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports["default"] = void 0;
|
|
7
8
|
var _propTypes = require("prop-types");
|
|
8
|
-
var _react =
|
|
9
|
-
var
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _components = require("@desynova-digital/components");
|
|
10
11
|
var _utils = require("../../utils");
|
|
11
|
-
var
|
|
12
|
-
function
|
|
13
|
-
function
|
|
12
|
+
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); }
|
|
13
|
+
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; }
|
|
14
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
15
|
+
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."); }
|
|
16
|
+
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); }
|
|
17
|
+
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; }
|
|
18
|
+
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; } }
|
|
19
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
20
|
var propTypes = {
|
|
15
21
|
player: _propTypes.PropTypes.instanceOf(Object),
|
|
16
22
|
initialTime: _propTypes.PropTypes.number,
|
|
@@ -19,13 +25,48 @@ var propTypes = {
|
|
|
19
25
|
var defaultProps = {
|
|
20
26
|
player: {}
|
|
21
27
|
};
|
|
22
|
-
var VideoCurrentTime = _styledComponents["default"].div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-family: SFUIText-Regular;\n font-size: 12px;\n letter-spacing: -0.6px;\n color: #ffffff;\n min-width: 65px;\n text-align: left;\n"])));
|
|
23
28
|
function CurrentTimeDisplay(_ref) {
|
|
24
29
|
var player = _ref.player,
|
|
25
30
|
initialTime = _ref.initialTime,
|
|
26
|
-
frameRate = _ref.frameRate
|
|
31
|
+
frameRate = _ref.frameRate,
|
|
32
|
+
actions = _ref.actions;
|
|
27
33
|
var formattedTime = (0, _utils.secondsToTime)(player.currentTime, frameRate, initialTime);
|
|
28
|
-
|
|
34
|
+
var _useState = (0, _react.useState)(formattedTime),
|
|
35
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
36
|
+
inputValue = _useState2[0],
|
|
37
|
+
setInputValue = _useState2[1];
|
|
38
|
+
var elementRef = (0, _react.useRef)(null);
|
|
39
|
+
var handleKeyPress = function handleKeyPress(event) {
|
|
40
|
+
if (event.key === 'Enter') {
|
|
41
|
+
if (elementRef.current && elementRef.current.checkValidity()) {
|
|
42
|
+
if (isNaN(initialTime)) {
|
|
43
|
+
initialTime = 0;
|
|
44
|
+
}
|
|
45
|
+
var seekSecondsTime = (0, _utils.timeToSeconds)(event.target.value, frameRate) - initialTime;
|
|
46
|
+
actions.seek(seekSecondsTime);
|
|
47
|
+
document.activeElement.blur();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
var onInputFocus = function onInputFocus() {
|
|
52
|
+
actions.pause();
|
|
53
|
+
actions.handleVideoRewind(false);
|
|
54
|
+
};
|
|
55
|
+
(0, _react.useEffect)(function () {
|
|
56
|
+
setInputValue(formattedTime);
|
|
57
|
+
}, [player.currentTime]);
|
|
58
|
+
return /*#__PURE__*/_react["default"].createElement(_components.TimeCodeInput, {
|
|
59
|
+
width: "72px",
|
|
60
|
+
elementRef: elementRef,
|
|
61
|
+
inputValue: inputValue,
|
|
62
|
+
onKeyDown: function onKeyDown(e) {
|
|
63
|
+
return handleKeyPress(e);
|
|
64
|
+
},
|
|
65
|
+
onFocus: onInputFocus,
|
|
66
|
+
frameRate: frameRate,
|
|
67
|
+
initialTime: initialTime || 0,
|
|
68
|
+
playerDuration: player.duration || 0
|
|
69
|
+
});
|
|
29
70
|
}
|
|
30
71
|
CurrentTimeDisplay.propTypes = propTypes;
|
|
31
72
|
CurrentTimeDisplay.defaultProps = defaultProps;
|