CuePointManager
| Kind of class: | class |
|---|---|
| Inherits from: | none |
| Classpath: | mx.video.CuePointManager |
| File last modified: | Tuesday, 18 December 2007, 16:18:43 |
Event dispatched when a cue point is reached. Event Object has an
info property that contains the info object received by theNetStream.onCuePoint callback for FLV cue points or
the object passed into the AS cue point APIs for AS cue points.
| Event | "cuePoint" |
|---|
Summary
- CuePointManager (owner:FLVPlayback, id:Number)
- DEFAULT_LINEAR_SEARCH_TOLERANCE : Number
- cuePointsReplace : Array
- _owner : FLVPlayback
- _metadataLoaded : Boolean
- _disabledCuePoints : Array
- _disabledCuePointsByNameOnly : Object
- _asCuePointIndex : Number
- _asCuePointTolerance : Number
- _linearSearchTolerance : Number
- _id : Number
- allCuePoints : Array
- asCuePoints : Array
- flvCuePoints : Array
- navCuePoints : Array
- eventCuePoints : Array
- metadataLoaded : Boolean
- read only, has metadata been loaded
- playheadUpdateInterval (aTime:Number) : Number
- id : Number
- cuePointCompare (time:Number, name:String, cuePoint:Object) : Number
- Takes two cue point Objects and returns -1 if first sorts
- deepCopyObject (obj:Object, recurseLevel:Number) : Object
- Used to make copies of cue point objects.
- reset
- addASCuePoint (timeOrCuePoint:Object, name:String, parameters:Object) : Object
- removeASCuePoint (timeNameOrCuePoint:Object) : Object
- setFLVCuePointEnabled (enabled:Boolean, timeNameOrCuePoint:Object) : Number
- removeCuePoints (cuePointArray:Array, cuePoint:Object) : Number
- removes enabled cue points from _disabledCuePoints
- insertCuePoint (insertIndex:Number, cuePointArray:Array, cuePoint:Object) : Array
- inserts cue points into array
- isFLVCuePointEnabled (timeNameOrCuePoint:Object) : Boolean
- dispatchASCuePoints : Void
- resetASCuePointIndex (time:Number) : Void
- When our place in the stream is changed, this is called
- processFLVCuePoints (metadataCuePoints:Array) : Void
- Called by FLVPlayback "metadataReceived" event handler to process flv
- processCuePointsProperty (cuePoints:Array) : Void
- addOrDisable (disable:Boolean, cuePoint:Object) : Void
- Used by processCuePointsProperty
- unescape (origStr:String) : String
- Used by processCuePointsProperty
- getCuePointIndex (cuePointArray:Array, closeIsOK:Boolean, time:Number, name:String, start:Number, len:Number) : Number
- Search for a cue point in an array sorted by time.
- getNextCuePointIndexWithName (name:String, array:Array, index:Number) : Number
- getCuePoint (cuePointArray:Array, closeIsOK:Boolean, timeNameOrCuePoint:Object) : Object
- getNextCuePointWithName (cuePoint:Object) : Object
Constructor
Class properties
cuePointsReplace
DEFAULT_LINEAR_SEARCH_TOLERANCE
Instance properties
_asCuePointIndex
_asCuePointTolerance
_disabledCuePoints
_disabledCuePointsByNameOnly
_id
_linearSearchTolerance
_metadataLoaded
_owner
allCuePoints
asCuePoints
eventCuePoints
flvCuePoints
id
corresponds to _vp and _cpMgr array index in FLVPlayback
metadataLoaded
playheadUpdateInterval
Set by FLVPlayback to update _asCuePointTolerance
Class methods
cuePointCompare
before second, 1 if second sorts before first and 0 if they are
equal. First compares times with millisecond precision. If
they match, compares name if name parameter is not null or undefined.
deepCopyObject
Instance methods
addASCuePoint
Add an ActionScript cue point.
It is legal to add multiple AS cue points with the same
name and time. When removeASCuePoint is called with this
name and time, all will be removed.
point. Must have a name:String and time:Number (in seconds)
property. May have a parameters:Object property that holds
name/value pairs. May have type:String set to "actionscript",
if it is missing or set to something else it will be set
automatically. If the Object does not conform to these
conventions, a
VideoError will be thrown.If Number, then time for new cue point to be added
and name parameter must follow.
is a Number.
timeOrCuePoint parameter is a Number.
- A copy of the cuePoint Object added. The copy has the
following additional properties:array- the array of all AS cue points. Treat
this array as read only as adding, removing or editing objects
within it can cause cue points to malfunction.index- the index into the array for the
returned cuepoint.
- VideoError if parameters are invalid
addOrDisable
dispatchASCuePoints
Called by FLVPlayback on "playheadUpdate" event
to throw "cuePoint" events when appropriate.
getCuePoint
Search for a cue point in the given array at the given time
and/or with given name.
parameters passed in:
- If name is null or undefined, then if the specific time is
not found then the closest time earlier than that is returned.
If there is no cue point earlier than time, the first cue point
is returned. - If time is null, undefined or less than 0 then the first
cue point with the given name is returned. - If time and name are both defined then the closest cue
point, then if the specific time and name is not found then the
closest time earlier than that with that name is returned. If
there is no cue point with that name and with an earlier time,
then the first cue point with that name is returned. If there
is no cue point with that name, null is returned. - If time is null, undefined or less than 0 and name is null
or undefined, a VideoError is thrown.
If closeIsOK is false the behavior is:
- If name is null or undefined and there is a cue point with
exactly that time, it is returned. Otherwise null is
returned. - If time is null, undefined or less than 0 then the first
cue point with the given name is returned. - If time and name are both defined and there is a cue point
with exactly that time and name, it is returned. Otherwise null
is returned. - If time is null, undefined or less than 0 and name is null
or undefined, a VideoError is thrown.
Number, then time for search. If Object, then cuepoint object
containing time and/or name parameters for search.
-
nullif no match was found, otherwise
copy of cuePoint object with additional properties:array- the array that was searched. Treat
this array as read only as adding, removing or editing objects
within it can cause cue points to malfunction.index- the index into the array for the
returned cuepoint.
getCuePointIndex
closeIsOK parameter for search rules.
parameters passed in:
- If name is null or undefined, then if the specific time is
not found then the closest time earlier than that is returned.
If there is no cue point earlier than time, the first cue point
is returned. - If time is null, undefined or less than 0 then the first
cue point with the given name is returned. - If time and name are both defined then the closest cue
point, then if the specific time and name is not found then the
closest time earlier than that with that name is returned. If
there is no cue point with that name and with an earlier time,
then the first cue point with that name is returned. If there
is no cue point with that name, null is returned. - If time is null, undefined or less than 0 and name is null
or undefined, a VideoError is thrown.
If closeIsOK is false the behavior is:
- If name is null or undefined and there is a cue point with
exactly that time, it is returned. Otherwise null is
returned. - If time is null, undefined or less than 0 then the first
cue point with the given name is returned. - If time and name are both defined and there is a cue point
with exactly that time and name, it is returned. Otherwise null
is returned. - If time is null, undefined or less than 0 and name is null
or undefined, a VideoError is thrown.
recursive implementation, defaults to 0 if undefined
implementation, defaults to cuePointArray.length if undefined
- index for cue point in given array or -1 if no match found
- VideoError if time and/or name parameters are bad
getNextCuePointIndexWithName
Given a name, array and index, returns the next cue point in
that array after given index with the same name. Returns null
if no cue point after that one with that name. Throws
VideoError if argument is invalid.
- index for cue point in given array or -1 if no match found
getNextCuePointWithName
Given a cue point object returned from getCuePoint (needs
the index and array properties added to those cue points),
returns the next cue point in that array after that one with
the same name. Returns null if no cue point after that one
with that name. Throws VideoError if argument is invalid.
-
nullif no match was found, otherwise
copy of cuePoint object with additional properties:array- the array that was searched. Treat
this array as read only as adding, removing or editing objects
within it can cause cue points to malfunction.index- the index into the array for the
returned cuepoint.
insertCuePoint
isFLVCuePointEnabled
Returns false if FLV embedded cue point is disabled by
ActionScript. Cue points are disabled via setting thecuePoints property or by callingsetFLVCuePointEnabled().
The return value from this function is only meaningful whenmetadata is true. It always returns false
when it is null.
check; return false only if ALL cue points with this name are
disabled. If number, time of cue point to check. If Object,
then object with name and time properties, check cue point that
matches both name and time.
- false if cue point(s) is found and is disabled, true
either if no such cue point exists or if it is not disabled.
If time given is undefined, null or less than 0 then returns
false only if all cue points with this name are disabled.The return value from this function is only meaningful when
metadatais true. It always returns true when it
is false.
processCuePointsProperty
Process Array passed into FLVPlayback cuePoints property.
Array actually holds name value pairs. Each cue point starts
with 5 pairs: t,time,n,name,t,type,d,disabled,p,numparams.
time is a Number in milliseconds (e.g. 3000 = 3 seconds), name
is a String, type is a Number (0 = event, 1 = navigation, 2 =
actionscript), disabled is a Number (0 for false, 1 for true)
and numparams is a Number. After this, there are numparams
name/value pairs which could be any simple type.
Note that all Strings are escaped with html/xml entities for
ampersand (&), double quote ("), single quote (')
and comma (,), so must be unescaped.
processFLVCuePoints
embedded cue points array.
removeASCuePoint
Remove an ActionScript cue point from the currently
loaded FLV. Only the name and time properties are used
from the cuePoint parameter to find the cue point to be
removed.
If multiple AS cue points match the search criteria, only
one will be removed. To remove all, call this function
repeatedly in a loop with the same parameters until it returnsnull.
remove; remove first cue point with this name. If number, time
of cue point to remove; remove first cue point at this time.
If Object, then object with name and time properties, remove
cue point with both this name and time.
- The cue point that was removed. If there was no
matching cue point thennullis returned.
removeCuePoints
reset
resetASCuePointIndex
to reset our index into actionscript cue point array.
Another method is used when AS cue points are added
are removed.
setFLVCuePointEnabled
Enable or disable one or more FLV cue point. Disabled cue
points are disabled for being dispatched as events and
navigating to them with seekToPrevNavCuePoint(),seekToNextNavCuePoint() andseekToNavCuePoint().
If this API is called just after setting thecontentPath property or if no FLV is loaded, then
the cue point will be enabled or disabled in the FLV to be
loaded. Otherwise, it will be enabled or disabled in the
currently loaded FLV (even if it is called immediately before
setting the contentPath property to load another
FLV).
Changes caused by calls to this function will not be
reflected in results returned fromisFLVCuePointEnabled untilmetadataLoaded is true.
enable/disable. If number, time of cue point to
enable/disable. If Object, then object with name and time
properties, enable/disable cue point that matches both name and
time.
- If
metadataLoadedis true, returns number
of cue points whose enabled state was changed. IfmetadataLoadedis false, always returns -1.