@desynova-digital/player 3.13.25 → 3.13.26
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.
|
@@ -7,8 +7,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports["default"] = void 0;
|
|
8
8
|
var _propTypes = require("prop-types");
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
10
11
|
var _components = require("@desynova-digital/components");
|
|
11
12
|
var _utils = require("../../utils");
|
|
13
|
+
var _templateObject;
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
15
|
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
16
|
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
17
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -17,6 +20,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
17
20
|
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
21
|
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
22
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
23
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
20
24
|
var propTypes = {
|
|
21
25
|
player: _propTypes.PropTypes.instanceOf(Object),
|
|
22
26
|
initialTime: _propTypes.PropTypes.number,
|
|
@@ -25,6 +29,7 @@ var propTypes = {
|
|
|
25
29
|
var defaultProps = {
|
|
26
30
|
player: {}
|
|
27
31
|
};
|
|
32
|
+
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"])));
|
|
28
33
|
function CurrentTimeDisplay(_ref) {
|
|
29
34
|
var player = _ref.player,
|
|
30
35
|
initialTime = _ref.initialTime,
|
|
@@ -56,7 +61,7 @@ function CurrentTimeDisplay(_ref) {
|
|
|
56
61
|
(0, _react.useEffect)(function () {
|
|
57
62
|
setInputValue(formattedTime);
|
|
58
63
|
}, [player.currentTime]);
|
|
59
|
-
return /*#__PURE__*/_react["default"].createElement(_components.TimeCodeInput, {
|
|
64
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, _components.TimeCodeInput ? /*#__PURE__*/_react["default"].createElement(_components.TimeCodeInput, {
|
|
60
65
|
width: "72px",
|
|
61
66
|
elementRef: elementRef,
|
|
62
67
|
inputValue: inputValue,
|
|
@@ -67,7 +72,7 @@ function CurrentTimeDisplay(_ref) {
|
|
|
67
72
|
frameRate: frameRate,
|
|
68
73
|
initialTime: initialTime || 0,
|
|
69
74
|
playerDuration: player.duration || 0
|
|
70
|
-
});
|
|
75
|
+
}) : /*#__PURE__*/_react["default"].createElement(VideoCurrentTime, null, formattedTime));
|
|
71
76
|
}
|
|
72
77
|
CurrentTimeDisplay.propTypes = propTypes;
|
|
73
78
|
CurrentTimeDisplay.defaultProps = defaultProps;
|
package/package.json
CHANGED
package/utils/index.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.deprecatedWarning = deprecatedWarning;
|
|
7
7
|
exports.formatTime = formatTime;
|
|
8
|
+
exports.handleAdjustingVideoAsPerFrame = handleAdjustingVideoAsPerFrame;
|
|
8
9
|
exports.isVideoChild = isVideoChild;
|
|
9
10
|
exports.mediaProperties = void 0;
|
|
10
11
|
exports.mergeAndSortChildren = mergeAndSortChildren;
|
|
@@ -44,13 +45,16 @@ function secondsToTime() {
|
|
|
44
45
|
var frameRate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 25;
|
|
45
46
|
var initialTimecodeInSeconds = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
46
47
|
if (seconds > -1) {
|
|
47
|
-
|
|
48
|
+
// Calculate total frames
|
|
49
|
+
var totalFrames = Math.round((seconds + initialTimecodeInSeconds) * frameRate);
|
|
48
50
|
|
|
49
51
|
// Calculate new timecode
|
|
50
|
-
var
|
|
51
|
-
var
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
var newSeconds = Math.floor(totalFrames / frameRate);
|
|
53
|
+
var remainderFrames = totalFrames % frameRate;
|
|
54
|
+
|
|
55
|
+
// Calculate fractional frames within the range [0, 1)
|
|
56
|
+
var fractionalFrames = remainderFrames / frameRate;
|
|
57
|
+
var newFF = Math.floor(fractionalFrames * frameRate).toString().padStart(2, '0');
|
|
54
58
|
var newSS = newSeconds % 60;
|
|
55
59
|
var newMM = Math.floor(newSeconds / 60) % 60;
|
|
56
60
|
var newHH = Math.floor(newSeconds / 3600);
|
|
@@ -220,4 +224,19 @@ function throttle(callback, limit) {
|
|
|
220
224
|
}
|
|
221
225
|
};
|
|
222
226
|
}
|
|
223
|
-
var mediaProperties = exports.mediaProperties = ['error', 'src', 'srcObject', 'currentSrc', 'crossOrigin', 'networkState', 'preload', 'buffered', 'readyState', 'seeking', 'currentTime', 'duration', 'paused', 'defaultPlaybackRate', 'playbackRate', 'played', 'seekable', 'ended', 'autoplay', 'loop', 'mediaGroup', 'controller', 'controls', 'volume', 'muted', 'defaultMuted', 'audioTracks', 'videoTracks', 'textTracks', 'width', 'height', 'videoWidth', 'videoHeight', 'poster'];
|
|
227
|
+
var mediaProperties = exports.mediaProperties = ['error', 'src', 'srcObject', 'currentSrc', 'crossOrigin', 'networkState', 'preload', 'buffered', 'readyState', 'seeking', 'currentTime', 'duration', 'paused', 'defaultPlaybackRate', 'playbackRate', 'played', 'seekable', 'ended', 'autoplay', 'loop', 'mediaGroup', 'controller', 'controls', 'volume', 'muted', 'defaultMuted', 'audioTracks', 'videoTracks', 'textTracks', 'width', 'height', 'videoWidth', 'videoHeight', 'poster'];
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
*
|
|
231
|
+
* @param {Number} currentTime current time of video
|
|
232
|
+
* @returns adjusting the current time to the nearest frame
|
|
233
|
+
*/
|
|
234
|
+
function handleAdjustingVideoAsPerFrame(currentTime) {
|
|
235
|
+
var frameRate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 25;
|
|
236
|
+
var frameDuration = 1 / frameRate;
|
|
237
|
+
var milliSeconds = currentTime - Math.floor(currentTime);
|
|
238
|
+
var frameNumber = Math.round(milliSeconds / frameDuration);
|
|
239
|
+
var updatedMilliseconds = frameNumber * frameDuration;
|
|
240
|
+
var adjustedTimeInSeconds = Math.trunc(currentTime) + updatedMilliseconds;
|
|
241
|
+
return adjustedTimeInSeconds;
|
|
242
|
+
}
|