TimeCode class representing the TimeCodeType in VidiCore

For more info, see the Time Codes section of VidiCore API Docs

Hierarchy

  • TimeCode

Time

  • Get TimeCode as a text representation

    Remarks

    Default format: samples@denominator(:numerator if > 1) constant has precedence over fraction if both are true

    Returns

    Text representation of TimeCode

    Parameters

    • Optional options: {
          constant?: boolean;
          fraction?: boolean;
          includeTimeBaseForSeconds?: boolean;
      }

      Options for how to format text

      • Optional constant?: boolean
      • Optional fraction?: boolean
      • Optional includeTimeBaseForSeconds?: boolean

    Returns string

Types

dropFrame?: boolean
frameSeparator?: string
samples: number = 0
timeBase: TimeBase = ...
  • Return this TimeCode added with the supplied timeCodeType If time bases differ, it will retain the time base of this TimeCode instance If supplied time code has a more granular time base - it will round down exceeding samples (hasn't reached that sample yet)

    Note: This might make you "lose" frames depending on granularity of time bases, e.g. "51@50".add("25@25") => "101@50" while "25@25".add("51@50") => "50@25" (not "101@50")

    Returns

    A new TimeCode instance with the addition applied

    Parameters

    • timeCode: TimeCode

      A TimeCode instance you want to add with

    Returns TimeCode

  • Creates a new TimeCode instance with specified timeBase and samples adjusted to that.

    If it conforms to a less granular time base - it will floor samples (hasn't reached that sample yet)

    • e.g. "51@50".conformTo("PAL") => "25@PAL" (not "26@PAL")

    Returns

    A new TimeCode instance with the conformTo timeBase applied

    Parameters

    Returns TimeCode

  • Return this TimeCode subtracted with the supplied timeCodeType If time bases differ, it will retain the time base of the instance time code If supplied time code has a more granular time base - it will round down exceeding samples (hasn't reached that sample yet)

    Note: This might make you "lose" frames depending on granularity of time bases, e.g. "101@50".subtract("25@25") => "51@50" while "50@25".subtract("51@50") => "25@25" (not "49@50")

    Returns

    A new TimeCode instance with the subtraction applied

    Parameters

    • timeCode: TimeCode

      A TimeCode instance you want to subtract with

    Returns TimeCode

  • Get TimeCode in a duration representation The time unit char keys for the format string are:

    • "h" for hour
    • "m" for minute
    • "s" for seconds
    • "S" for milliseconds Any other char will be kept in the duration output string.

    Add consecutive chars for zero padding.

    By default it:

    • uses colon delimiter (e.g. for format "hhmmss")
    • shows "m:ss" or "h:mm:ss" if format is undefined

    Returns

    Duration representation of the TimeCode

    Parameters

    • Optional options: {
          format?: string;
      }

      Options for how to display duration

      • Optional format?: string

    Returns string

  • Deprecated

    Use toObject instead

    Returns

    TimeCode as { samples, timeBase }

    Returns {
        samples: number;
        timeBase: RationalType;
    }

  • Get TimeCode as a VidiCore TimeCodeType object

    Returns

    TimeCode as { samples, timeBase }

    Returns {
        samples: number;
        timeBase: RationalType;
    }

  • Get TimeCode in a seconds representation

    Returns

    Total seconds for the time code

    Returns number

  • Get TimeCode in a smpte representation

    Returns

    Smpte representation of the TimeCode

    Returns string

  • Get TimeCode in a time object representation "milliseconds" is rounded down, if you want another representation use "partialSeconds"

    Returns

    Time for the time code

    Returns {
        hours: number;
        milliseconds: number;
        minutes: number;
        partialSeconds: number;
        seconds: number;
    }

    • hours: number
    • milliseconds: number
    • minutes: number
    • partialSeconds: number
    • seconds: number
  • Get TimeCode in a units object representation

    Returns

    Units (time and frames) for the time code

    Returns {
        frames: number;
        hours: number;
        minutes: number;
        seconds: number;
    }

    • frames: number
    • hours: number
    • minutes: number
    • seconds: number