@bbc/react-transcript-editor
Version:
A React component to make transcribing audio and video easier and faster.
10 lines • 790 B
JavaScript
;Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;/**
* Helperf unction
* @param {*} tc
* @param {*} fps
*/var timecodeToFrames=function(tc,fps){// TODO make 29.97 fps drop-frame aware - works for 25 only.
var 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;/**
* Convert broadcast timecodes to seconds
* @param {*} tc - `hh:mm:ss:ff`
* @param {*} framePerSeconds - defaults to 25 if not provided
*/exports.default=_default;