Packageorg.osmf.smpte.tt.timing
Classpublic class TimeCode
InheritanceTimeCode Inheritance Object

Represents a SMPTE 12M standard time code and provides conversion operations to various SMPTE time code formats and rates. Framerates supported by the TimeCode class include, 23.98 IVTC Film Sync, 24fps Film Sync, 25fps PAL, 29.97 drop frame, 29.97 Non drop, and 30fps.



Public Properties
 PropertyDefined By
  duration : Number
[read-only] Gets the absolute time in seconds of the current TimeCode object.
TimeCode
  frameRate : SmpteFrameRate
Gets or sets the current SMPTE framerate for this TimeCode instance.
TimeCode
  framesSegment : int
[read-only] Gets the number of whole frames represented by the current TimeCode structure.
TimeCode
  hoursSegment : int
[read-only] Gets the number of whole hours represented by the current TimeCode structure.
TimeCode
  minutesSegment : int
[read-only] Gets the number of whole minutes represented by the current TimeCode structure.
TimeCode
  secondsSegment : int
[read-only] Gets the number of whole seconds represented by the current TimeCode structure.
TimeCode
  totalDays : Number
[read-only] Gets the value of the current TimeCode structure expressed in whole and fractional days.
TimeCode
  totalFrames : Number
[read-only] Gets the value of the current TimeCode structure expressed in frames.
TimeCode
  totalHours : Number
[read-only] Gets the value of the current TimeCode structure expressed in whole and fractional hours.
TimeCode
  totalMinutes : Number
[read-only] Gets the value of the current TimeCode structure expressed in whole and fractional minutes.
TimeCode
  totalSeconds : Number
[read-only] Gets the value of the current TimeCode structure expressed in whole and fractional seconds.
TimeCode
  totalSecondsPrecision : Number
[read-only] Gets the value of the current TimeCode structure expressed in whole and fractional seconds.
TimeCode
Public Methods
 MethodDefined By
  
TimeCode(... args)
The TimeCode can be created from several different sets of parameters.
TimeCode
  
[static] Converts the specified absolute time to 27 mhz ticks.
TimeCode
  
[static] Converts the provided absolute time to PCRTb.
TimeCode
  
Adds the specified TimeCode to this instance.
TimeCode
  
[static] Compares two TimeCode values and returns an integer that indicates their relationship.
TimeCode
  
compareTo(value:Object):int
Compares this instance to a specified object and returns an indication of their relative values.
TimeCode
  
equals(t2:Object):Boolean
Indicates whether this TimeCode equals another given TimeCode.
TimeCode
  
Equals(t1:TimeCode, t2:TimeCode):Boolean
[static] Returns a value indicating whether two specified instances of TimeCode are equal.
TimeCode
  
equalTo(t2:TimeCode):Boolean
Indicates whether this TimeCode is equal to another given TimeCode.
TimeCode
  
[static] Returns a TimeCode that represents a specified time, where the specification is in units of absolute time.
TimeCode
  
fromDays(value:Number, rate:SmpteFrameRate):TimeCode
[static] Returns a TimeCode that represents a specified number of days, where the specification is accurate to the nearest millisecond.
TimeCode
  
fromFrames(value:Number, rate:SmpteFrameRate):TimeCode
[static] Returns a TimeCode that represents a specified number of frames.
TimeCode
  
fromHours(value:Number, rate:SmpteFrameRate):TimeCode
[static] Returns a TimeCode that represents a specified number of hours, where the specification is accurate to the nearest millisecond.
TimeCode
  
fromMinutes(value:Number, rate:SmpteFrameRate):TimeCode
[static] Returns a TimeCode that represents a specified number of minutes, where the specification is accurate to the nearest millisecond.
TimeCode
  
fromSeconds(value:Number, rate:SmpteFrameRate):TimeCode
[static] Returns a TimeCode that represents a specified number of seconds, where the specification is accurate to the nearest millisecond.
TimeCode
  
fromTicks(ticks:Number, rate:SmpteFrameRate):TimeCode
[static] Returns a TimeCode that represents a specified time, where the specification is in units of ticks.
TimeCode
  
[static] Returns a TimeCode that represents a specified time, where the specification is in units of 27 Mhz clock ticks.
TimeCode
  
[static] Returns a TimeCode that represents a specified time, where the specification is in units of absolute time.
TimeCode
  
greaterThan(t2:TimeCode):Boolean
Indicates whether this TimeCode is greater than another given TimeCode.
TimeCode
  
Indicates whether this TimeCode is greater than or equal to another given TimeCode.
TimeCode
  
lessThan(t2:TimeCode):Boolean
Indicates whether this TimeCode is less than another given TimeCode.
TimeCode
  
Indicates whether this TimeCode is less than or equal to another given TimeCode.
TimeCode
  
maxValue(frameRate:SmpteFrameRate):Number
[static] Gets the maximum TimeCode value of a known frame rate.
TimeCode
  
Subtracts a specified TimeCode from this TimeCode.
TimeCode
  
notEqualTo(t2:TimeCode):Boolean
Indicates whether this TimeCode is not equal to another given TimeCode.
TimeCode
  
[static] Parses a framerate value as double and converts it to a member of the SmpteFrameRate enumeration.
TimeCode
  
Adds a specified TimeCode to this TimeCode.
TimeCode
  
smpte12MToTicks27Mhz(timeCode:String, rate:SmpteFrameRate):Number
[static] Returns the value of the provided time code string and framerate in 27Mhz ticks.
TimeCode
  
Subtracts the specified TimeCode from this instance.
TimeCode
  
ticks27MhzToAbsoluteTime(ticks27Mhz:Number):Number
[static] Converts the specified absolute time to absolute time.
TimeCode
  
ticks27MhzToPcrTb(ticks27Mhz:Number):Number
[static] Converts from 27Mhz ticks to PCRTb.
TimeCode
  
ticks27MhzToSmpte12M(ticks27Mhz:Number, rate:SmpteFrameRate):String
[static] Returns a SMPTE 12M formatted time code string from a 27Mhz ticks value.
TimeCode
  
ticksPcrTbToAbsoluteTime(ticksPcrTb:Number):Number
[static] Converts the specified absolute time to absolute time.
TimeCode
  
toString():String
Returns the SMPTE 12M string representation of the value of this instance.
TimeCode
  
Returns the SMPTE 12M string representation of the value of this instance.
TimeCode
  
toTicks27Mhz():Number
Returns the value of this instance in 27 Mhz ticks.
TimeCode
  
toTicksPcrTb():Number
Returns the value of this instance in MPEG 2 PCR time base (PcrTb) format.
TimeCode
  
validateSmpte12MTimecode(timeCode:String):Boolean
[static] Validates that the string provided is in the correct format for SMPTE 12M time code.
TimeCode
Public Constants
 ConstantDefined By
  MILLISECONDS_PER_DAY : Number = 86400000
[static] The number of milliseconds in one day
TimeCode
  MILLISECONDS_PER_HOUR : Number = 3600000
[static] The number of milliseconds in one hour
TimeCode
  MILLISECONDS_PER_MINUTE : Number = 60000
[static] The number of milliseconds in one minute
TimeCode
  MILLISECONDS_PER_SECOND : Number = 1000
[static] The number of milliseconds in one second
TimeCode
  MIN_VALUE : Number = 0
[static] The minimum TimeCode value.
TimeCode
  SMPTEREGEXP : RegExp
[static] Regular expression object used for validating timecode.
TimeCode
  TICKS_PER_DAY : Number = 864000000000
[static] The number of ticks in one day
TimeCode
  TICKS_PER_DAY_ABSOLUTE_TIME : Number = 86400
[static] The number of absolute time ticks in 1 day.
TimeCode
  TICKS_PER_HOUR : Number = 36000000000
[static] The number of ticks in one hour
TimeCode
  TICKS_PER_HOUR_ABSOLUTE_TIME : Number = 3600
[static] The number of absolute time ticks in 1 hour.
TimeCode
  TICKS_PER_MILLISECOND : Number = 10000
[static] The number of ticks in one millisecond
TimeCode
  TICKS_PER_MILLISECOND_ABSOLUTE_TIME : Number = 0.001
[static] The number of absolute time ticks in 1 millisecond.
TimeCode
  TICKS_PER_MINUTE : Number = 600000000
[static] The number of ticks in one minute
TimeCode
  TICKS_PER_MINUTE_ABSOLUTE_TIME : Number = 60
[static] The number of absolute time ticks in one minute
TimeCode
  TICKS_PER_SECOND : Number = 10000000
[static] The number of ticks in one second
TimeCode
  TICKS_PER_SECOND_ABSOLUTE_TIME : Number = 1
[static] The number of absolute time ticks in one second
TimeCode
Property Detail
durationproperty
duration:Number  [read-only]

Gets the absolute time in seconds of the current TimeCode object.


Implementation
    public function get duration():Number
frameRateproperty 
frameRate:SmpteFrameRate

Gets or sets the current SMPTE framerate for this TimeCode instance.


Implementation
    public function get frameRate():SmpteFrameRate
    public function set frameRate(value:SmpteFrameRate):void
framesSegmentproperty 
framesSegment:int  [read-only]

Gets the number of whole frames represented by the current TimeCode structure.


Implementation
    public function get framesSegment():int
hoursSegmentproperty 
hoursSegment:int  [read-only]

Gets the number of whole hours represented by the current TimeCode structure.


Implementation
    public function get hoursSegment():int
minutesSegmentproperty 
minutesSegment:int  [read-only]

Gets the number of whole minutes represented by the current TimeCode structure.


Implementation
    public function get minutesSegment():int
secondsSegmentproperty 
secondsSegment:int  [read-only]

Gets the number of whole seconds represented by the current TimeCode structure.


Implementation
    public function get secondsSegment():int
totalDaysproperty 
totalDays:Number  [read-only]

Gets the value of the current TimeCode structure expressed in whole and fractional days.


Implementation
    public function get totalDays():Number
totalFramesproperty 
totalFrames:Number  [read-only]

Gets the value of the current TimeCode structure expressed in frames.


Implementation
    public function get totalFrames():Number
totalHoursproperty 
totalHours:Number  [read-only]

Gets the value of the current TimeCode structure expressed in whole and fractional hours.


Implementation
    public function get totalHours():Number
totalMinutesproperty 
totalMinutes:Number  [read-only]

Gets the value of the current TimeCode structure expressed in whole and fractional minutes.


Implementation
    public function get totalMinutes():Number
totalSecondsproperty 
totalSeconds:Number  [read-only]

Gets the value of the current TimeCode structure expressed in whole and fractional seconds. Not as Precise as the TotalSecondsPrecision.


Implementation
    public function get totalSeconds():Number
totalSecondsPrecisionproperty 
totalSecondsPrecision:Number  [read-only]

Gets the value of the current TimeCode structure expressed in whole and fractional seconds. This is returned as a for greater precision.


Implementation
    public function get totalSecondsPrecision():Number
Constructor Detail
TimeCode()Constructor
public function TimeCode(... args)

The TimeCode can be created from several different sets of parameters.

With 5 or 6 parameters, initializes a new instance of the TimeCode structure to a specified number of days, hours, minutes, and seconds.

Parameters
... args — - Number of days. (optional)
Method Detail
absoluteTimeToTicks27Mhz()method
public static function absoluteTimeToTicks27Mhz(time:AbsoluteTimeHelper):Number

Converts the specified absolute time to 27 mhz ticks.

Parameters

time:AbsoluteTimeHelper — Absolute time to be converted.

Returns
Number
absoluteTimeToTicksPcrTb()method 
public static function absoluteTimeToTicksPcrTb(time:AbsoluteTimeHelper):Number

Converts the provided absolute time to PCRTb.

Parameters

time:AbsoluteTimeHelper — Absolute time to be converted.

Returns
Number
add()method 
public function add(ts:TimeCode):TimeCode

Adds the specified TimeCode to this instance.

Parameters

ts:TimeCode — A TimeCode.

Returns
TimeCode
Compare()method 
public static function Compare(t1:TimeCode, t2:TimeCode):int

Compares two TimeCode values and returns an integer that indicates their relationship.

Parameters

t1:TimeCode — The first TimeCode.
 
t2:TimeCode — The second TimeCode.

Returns
int
compareTo()method 
public function compareTo(value:Object):int

Compares this instance to a specified object and returns an indication of their relative values.

Parameters

value:Object — An object to compare, or null.

Returns
int
equals()method 
public function equals(t2:Object):Boolean

Indicates whether this TimeCode equals another given TimeCode.

Parameters

t2:Object — The TimeCode to compare.

Returns
Boolean
Equals()method 
public static function Equals(t1:TimeCode, t2:TimeCode):Boolean

Returns a value indicating whether two specified instances of TimeCode are equal.

Parameters

t1:TimeCode — The first TimeCode.
 
t2:TimeCode — The second TimeCode.

Returns
Boolean
equalTo()method 
public function equalTo(t2:TimeCode):Boolean

Indicates whether this TimeCode is equal to another given TimeCode.

Parameters

t2:TimeCode — The TimeCode to compare.

Returns
Boolean
fromAbsoluteTime()method 
public static function fromAbsoluteTime(value:Number, rate:SmpteFrameRate):TimeCode

Returns a TimeCode that represents a specified time, where the specification is in units of absolute time.

Parameters

value:Number — The absolute time in 100 nanosecond units.
 
rate:SmpteFrameRate — The SMPTE framerate.

Returns
TimeCode
fromDays()method 
public static function fromDays(value:Number, rate:SmpteFrameRate):TimeCode

Returns a TimeCode that represents a specified number of days, where the specification is accurate to the nearest millisecond.

Parameters

value:Number — A number of days accurate to the nearest millisecond.
 
rate:SmpteFrameRate — The desired SmpteFrameRate framerate for this instance.

Returns
TimeCode
fromFrames()method 
public static function fromFrames(value:Number, rate:SmpteFrameRate):TimeCode

Returns a TimeCode that represents a specified number of frames.

Parameters

value:Number — A number of frames.
 
rate:SmpteFrameRate — The framerate of the Timecode.

Returns
TimeCode
fromHours()method 
public static function fromHours(value:Number, rate:SmpteFrameRate):TimeCode

Returns a TimeCode that represents a specified number of hours, where the specification is accurate to the nearest millisecond.

Parameters

value:Number — A number of hours accurate to the nearest millisecond.
 
rate:SmpteFrameRate — The desired SmpteFrameRate framerate for this instance.

Returns
TimeCode
fromMinutes()method 
public static function fromMinutes(value:Number, rate:SmpteFrameRate):TimeCode

Returns a TimeCode that represents a specified number of minutes, where the specification is accurate to the nearest millisecond.

Parameters

value:Number — A number of minutes accurate to the nearest millisecond.
 
rate:SmpteFrameRate — The desired SmpteFrameRate framerate for this instance.

Returns
TimeCode
fromSeconds()method 
public static function fromSeconds(value:Number, rate:SmpteFrameRate):TimeCode

Returns a TimeCode that represents a specified number of seconds, where the specification is accurate to the nearest millisecond.

Parameters

value:Number — A number of seconds accurate to the nearest millisecond.
 
rate:SmpteFrameRate — The desired SmpteFrameRate framerate for this instance.

Returns
TimeCode
fromTicks()method 
public static function fromTicks(ticks:Number, rate:SmpteFrameRate):TimeCode

Returns a TimeCode that represents a specified time, where the specification is in units of ticks.

Parameters

ticks:Number — A number of ticks that represent a time.
 
rate:SmpteFrameRate — The Smpte framerate.

Returns
TimeCode
fromTicks27Mhz()method 
public static function fromTicks27Mhz(value:Number, rate:SmpteFrameRate):TimeCode

Returns a TimeCode that represents a specified time, where the specification is in units of 27 Mhz clock ticks.

Parameters

value:Number — A number of ticks in 27 Mhz clock format.
 
rate:SmpteFrameRate — A Smpte framerate.

Returns
TimeCode
fromTimeSpan()method 
public static function fromTimeSpan(value:TimeSpan, rate:SmpteFrameRate):TimeCode

Returns a TimeCode that represents a specified time, where the specification is in units of absolute time.

Parameters

value:TimeSpan — The TimeSpan object.
 
rate:SmpteFrameRate — The SMPTE framerate.

Returns
TimeCode
greaterThan()method 
public function greaterThan(t2:TimeCode):Boolean

Indicates whether this TimeCode is greater than another given TimeCode.

Parameters

t2:TimeCode — The TimeCode to compare.

Returns
Boolean
greaterThanOrEqualTo()method 
public function greaterThanOrEqualTo(t2:TimeCode):Boolean

Indicates whether this TimeCode is greater than or equal to another given TimeCode.

Parameters

t2:TimeCode — The TimeCode to compare.

Returns
Boolean
lessThan()method 
public function lessThan(t2:TimeCode):Boolean

Indicates whether this TimeCode is less than another given TimeCode.

Parameters

t2:TimeCode — The TimeCode to compare.

Returns
Boolean
lessThanOrEqualTo()method 
public function lessThanOrEqualTo(t2:TimeCode):Boolean

Indicates whether this TimeCode is less than or equal to another given TimeCode.

Parameters

t2:TimeCode — The TimeCode to compare.

Returns
Boolean
maxValue()method 
public static function maxValue(frameRate:SmpteFrameRate):Number

Gets the maximum TimeCode value of a known frame rate. The Max value for Timecode.

Parameters

frameRate:SmpteFrameRate — The frame rate to get the max value.

Returns
Number — The maximum TimeCode value for the given frame rate.
minus()method 
public function minus(t2:TimeCode):TimeCode

Subtracts a specified TimeCode from this TimeCode.

Parameters

t2:TimeCode — The TimeCode to subtract.

Returns
TimeCode
notEqualTo()method 
public function notEqualTo(t2:TimeCode):Boolean

Indicates whether this TimeCode is not equal to another given TimeCode.

Parameters

t2:TimeCode — The TimeCode to compare.

Returns
Boolean
parseFramerate()method 
public static function parseFramerate(rate:Number):SmpteFrameRate

Parses a framerate value as double and converts it to a member of the SmpteFrameRate enumeration.

Parameters

rate:Number — Double value of the framerate.

Returns
SmpteFrameRate
plus()method 
public function plus(t2:TimeCode):TimeCode

Adds a specified TimeCode to this TimeCode.

Parameters

t2:TimeCode — The TimeCode to add.

Returns
TimeCode
smpte12MToTicks27Mhz()method 
public static function smpte12MToTicks27Mhz(timeCode:String, rate:SmpteFrameRate):Number

Returns the value of the provided time code string and framerate in 27Mhz ticks.

Parameters

timeCode:String — The SMPTE 12M formatted time code string.
 
rate:SmpteFrameRate — The SMPTE framerate.

Returns
Number
subtract()method 
public function subtract(ts:TimeCode):TimeCode

Subtracts the specified TimeCode from this instance.

Parameters

ts:TimeCode — A TimeCode.

Returns
TimeCode
ticks27MhzToAbsoluteTime()method 
public static function ticks27MhzToAbsoluteTime(ticks27Mhz:Number):Number

Converts the specified absolute time to absolute time.

Parameters

ticks27Mhz:Number — Ticks 27Mhz to be converted.

Returns
Number
ticks27MhzToPcrTb()method 
public static function ticks27MhzToPcrTb(ticks27Mhz:Number):Number

Converts from 27Mhz ticks to PCRTb.

Parameters

ticks27Mhz:Number — >The number of 27Mhz ticks to convert from.

Returns
Number
ticks27MhzToSmpte12M()method 
public static function ticks27MhzToSmpte12M(ticks27Mhz:Number, rate:SmpteFrameRate):String

Returns a SMPTE 12M formatted time code string from a 27Mhz ticks value.

Parameters

ticks27Mhz:Number — 27Mhz ticks value.
 
rate:SmpteFrameRate — The SMPTE time code framerate desired.

Returns
String
ticksPcrTbToAbsoluteTime()method 
public static function ticksPcrTbToAbsoluteTime(ticksPcrTb:Number):Number

Converts the specified absolute time to absolute time.

Parameters

ticksPcrTb:Number — Ticks PCRTb to be converted.

Returns
Number
toString()method 
public function toString():String

Returns the SMPTE 12M string representation of the value of this instance.

Returns
String — A string that represents the value of this instance. The return value is of the form: hh:mm:ss:ff for non-drop frame and hh:mm:ss;ff for drop frame code with "hh" hours, ranging from 0 to 23, "mm" minutes ranging from 0 to 59, "ss" seconds ranging from 0 to 59, and "ff" based on the chosen framerate to be used by the time code instance.
toStringAtFramerate()method 
public function toStringAtFramerate(rate:SmpteFrameRate = null):String

Returns the SMPTE 12M string representation of the value of this instance.

Parameters

rate:SmpteFrameRate (default = null)

Returns
String
toTicks27Mhz()method 
public function toTicks27Mhz():Number

Returns the value of this instance in 27 Mhz ticks.

Returns
Number
toTicksPcrTb()method 
public function toTicksPcrTb():Number

Returns the value of this instance in MPEG 2 PCR time base (PcrTb) format.

Returns
Number
validateSmpte12MTimecode()method 
public static function validateSmpte12MTimecode(timeCode:String):Boolean

Validates that the string provided is in the correct format for SMPTE 12M time code.

Parameters

timeCode:String — String that is the time code.

Returns
Boolean
Constant Detail
MILLISECONDS_PER_DAYConstant
public static const MILLISECONDS_PER_DAY:Number = 86400000

The number of milliseconds in one day

MILLISECONDS_PER_HOURConstant 
public static const MILLISECONDS_PER_HOUR:Number = 3600000

The number of milliseconds in one hour

MILLISECONDS_PER_MINUTEConstant 
public static const MILLISECONDS_PER_MINUTE:Number = 60000

The number of milliseconds in one minute

MILLISECONDS_PER_SECONDConstant 
public static const MILLISECONDS_PER_SECOND:Number = 1000

The number of milliseconds in one second

MIN_VALUEConstant 
public static const MIN_VALUE:Number = 0

The minimum TimeCode value. This field is read-only.

SMPTEREGEXPConstant 
public static const SMPTEREGEXP:RegExp

Regular expression object used for validating timecode.

TICKS_PER_DAYConstant 
public static const TICKS_PER_DAY:Number = 864000000000

The number of ticks in one day

TICKS_PER_DAY_ABSOLUTE_TIMEConstant 
public static const TICKS_PER_DAY_ABSOLUTE_TIME:Number = 86400

The number of absolute time ticks in 1 day.

TICKS_PER_HOURConstant 
public static const TICKS_PER_HOUR:Number = 36000000000

The number of ticks in one hour

TICKS_PER_HOUR_ABSOLUTE_TIMEConstant 
public static const TICKS_PER_HOUR_ABSOLUTE_TIME:Number = 3600

The number of absolute time ticks in 1 hour.

TICKS_PER_MILLISECONDConstant 
public static const TICKS_PER_MILLISECOND:Number = 10000

The number of ticks in one millisecond

TICKS_PER_MILLISECOND_ABSOLUTE_TIMEConstant 
public static const TICKS_PER_MILLISECOND_ABSOLUTE_TIME:Number = 0.001

The number of absolute time ticks in 1 millisecond. This field is constant.

TICKS_PER_MINUTEConstant 
public static const TICKS_PER_MINUTE:Number = 600000000

The number of ticks in one minute

TICKS_PER_MINUTE_ABSOLUTE_TIMEConstant 
public static const TICKS_PER_MINUTE_ABSOLUTE_TIME:Number = 60

The number of absolute time ticks in one minute

TICKS_PER_SECONDConstant 
public static const TICKS_PER_SECOND:Number = 10000000

The number of ticks in one second

TICKS_PER_SECOND_ABSOLUTE_TIMEConstant 
public static const TICKS_PER_SECOND_ABSOLUTE_TIME:Number = 1

The number of absolute time ticks in one second