![]() If the optional argument is true the result will be in real time. SRT subtitles use real time, not timecode, and timecodes in some framerates do not match real time. Returns a string in the format 'hh:mm:ss,iii.' where 'iii.' are milliseconds rather than frames, the format used for SRT subtitles. Colons are used as a field separator, though the final separator will be a semi-colon for drop-frame. Returns a string in the format 'hh:mm:ss:ff'. Returns true if the Timecode object is being calculated in drop-frame mode (29.97 or 59.94). Useful for interacting programs that use fractions of a second rather than frames (e.g. Returns floating-point seconds, with frames converted to milliseconds and added to seconds. Returns floating-point milliseconds representing the frames field only. The second argument can be any type accepted by the Timecode object constructor. The first argument is the framerate to convert to, and the second argument is an optional start time of the sequence being pulled down, which affects the output. This is useful for, for example, a converting a 23.98 timecode to a 29.97 drop-frame timecode using a 3:2 pulldown. Return a new Timecode object based on the calling object converted to the frame rate passed as an argument, where the conversion would result in frames being added for the new framerate. If an addend or subtrahend has a different framerate than the calling object, the addend will be converted to the calling object's frame rate (see Frame Rate Conversion below). Any of the types available to use in the Timecode constructor above are available to use as arguments to these methods. Timecode, String, Number, Object, or DateĪdds the addend to or subtracts the subtrahend from the calling Timecode, and returns a new Timecode. Setting the hours above 24 will overflow the hours and they will be recalculated starting from 0. For example, calling setMinutes(72) will set the minutes to 12, and increment the hours field by 1. If an argument overflows a field, the next larger field will be incremented accordingly. Calling these methods with a type that cannot be coerced to an integer will throw a TypeError. The Timecode object is returned, allowing these methods to be chained. There are also setters for each individual field. Set( input) sets the timecode objects fields according to its argument, and accepts any of the types the constructor accepts. A JavaScript Object with one or more of the properties hours, minutes, seconds, or frames.The first parameter of the Constructor accepts: All fields default to 0 if the constructor is called with no arguments, and frameRate defaults to 29.97 if that argument is not passed. Though any frame rate should work here, only common broadcast frame rates are tested (23.98, 24, 25, 29.97, 30, 50, 59.94, and 60).Ĭonstructs a Timecode object. Timecode Class API Reference Properties PropertyĪ Number representing the playback speed of the Timecode. The Airbnb guide wasn't chosen for any grand reason, I just like it. eslintrc.json file is included in source control. This module was written according to the Airbnb Javascript Style Guide. I'm happy to write some tests, but please try to include tests for major funcionality you change or add. I try to maintain 100% test coverage, but don't require all pull requests to maintain that number. If you encounter incorrect math being performed and would like to submit a pull request to add a test for it without including a patch to fix the problem, that would be very welcome and I'll do my best to work out the bug. Tests are run using Mocha, and code coverage is tested with Istanbul's command-line interface, nyc.īabel is used to transpile to ES5 and uglify-js is used to minify the source for use in the browser. The result is assigned to laterTC and the original tc object is not mutated. Tc.add() returns a new timecode, starting from the original tc instance and adding a timecode of '00:04:59:28'. Calling toString() joins those fields with a separator. On creation, each field of the timecode string is stored in the properties hours, minutes, seconds, and frames. This constructs a Timecode instance named tc from a string representation ( '01:10:25:13'), with a framerate of 29.97. Const Timecode = require ( 'timecode-boss' ) let tc = new Timecode ( '01:10:25:13', 29.97 ) tc.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |