UNPKG

790 BJavaScriptView Raw
1"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;/**
2 * Helperf unction
3 * @param {*} tc
4 * @param {*} fps
5 */var timecodeToFrames=function(tc,fps){// TODO make 29.97 fps drop-frame aware - works for 25 only.
6var s=tc.split(":"),frames=parseInt(s[3]);return frames+=parseInt(s[2])*fps,frames+=parseInt(s[1])*(60*fps),frames+=parseInt(s[0])*(60*(60*fps)),frames},timecodeToSecondsHelper=function(tc,framePerSeconds){var fps=25;framePerSeconds!==void 0&&(fps=framePerSeconds);var frames=timecodeToFrames(tc,fps);return+(+(frames/fps)).toFixed(2)},_default=timecodeToSecondsHelper;/**
7 * Convert broadcast timecodes to seconds
8 * @param {*} tc - `hh:mm:ss:ff`
9 * @param {*} framePerSeconds - defaults to 25 if not provided
10 */exports.default=_default;
\No newline at end of file