@desynova-digital/player 3.13.11 → 3.13.13
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/package.json +1 -1
- package/utils/index.js +16 -13
package/package.json
CHANGED
package/utils/index.js
CHANGED
|
@@ -43,19 +43,22 @@ function secondsToTime() {
|
|
|
43
43
|
var seconds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
44
44
|
var frameRate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 25;
|
|
45
45
|
var initialTimecodeInSeconds = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
46
|
+
if (seconds > -1) {
|
|
47
|
+
var totalFrames = Math.round((seconds + (initialTimecodeInSeconds || 0)) * frameRate);
|
|
48
|
+
|
|
49
|
+
// Calculate new timecode
|
|
50
|
+
var newFrames = totalFrames;
|
|
51
|
+
var newSeconds = Math.floor(newFrames / frameRate);
|
|
52
|
+
var remainderFrames = newFrames % frameRate;
|
|
53
|
+
var newFF = remainderFrames.toString().padStart(2, '0');
|
|
54
|
+
var newSS = newSeconds % 60;
|
|
55
|
+
var newMM = Math.floor(newSeconds / 60) % 60;
|
|
56
|
+
var newHH = Math.floor(newSeconds / 3600);
|
|
57
|
+
|
|
58
|
+
// Format and return the new timecode
|
|
59
|
+
return "".concat(newHH.toString().padStart(2, '0'), ":").concat(newMM.toString().padStart(2, '0'), ":").concat(newSS.toString().padStart(2, '0'), ":").concat(newFF);
|
|
60
|
+
}
|
|
61
|
+
return '00:00:00:00';
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
// export function secondsToTime(_seconds = 0, frameRate, initialTime) {
|