ActionScript® 3.0 Reference for the Adobe® Flash® Platform
Home  |  Show Packages and Classes List |  Packages  |  Classes  |  What's New  |  Index  |  Appendixes
org.osmf.metadata 

CuePoint  - AS3 OSMF

Packageorg.osmf.metadata
Classpublic class CuePoint
InheritanceCuePoint Inheritance TimelineMarker Inheritance Object

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

The CuePoint class represents a cue point in the timeline of a media element.

A cue point is a media time value that has an associated action or piece of information. Typically, cue points are associated with video timelines to represent navigation points or event triggers.

The CuePoint class extends TimelineMarker, and as such can be added to a TimelineMetadata object.

View the examples



Public Properties
 PropertyDefined By
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 Inheritedduration : Number
[read-only] The duration in seconds.
TimelineMarker
  name : String
[read-only] The name of the cue point.
CuePoint
  parameters : Object
[read-only] The parameters of the cue point.
CuePoint
 Inheritedtime : Number
[read-only] The time in seconds.
TimelineMarker
  type : String
[read-only] The type of cue point.
CuePoint
Public Methods
 MethodDefined By
  
CuePoint(type:String, time:Number, name:String, parameters:Object, duration:Number = NaN)
Constructor.
CuePoint
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Public Constants
 ConstantDefined By
  DYNAMIC_CUEPOINTS_NAMESPACE : String = "http://www.osmf.org/timeline/dynamicCuePoints/1.0"
[static] Namespace URL for a TimelineMetadata class that exposes dynamic cue points.
CuePoint
  EMBEDDED_CUEPOINTS_NAMESPACE : String = "http://www.osmf.org/timeline/embeddedCuePoints/1.0"
[static] Namespace URL for a TimelineMetadata class that exposes embedded cue points.
CuePoint
Property Detail

name

property
name:String  [read-only]

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

The name of the cue point.



Implementation
    public function get name():String

parameters

property 
parameters:Object  [read-only]

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

The parameters of the cue point.



Implementation
    public function get parameters():Object

type

property 
type:String  [read-only]

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

The type of cue point. Returns one of the constant values defined in CuePointType.



Implementation
    public function get type():String
Constructor Detail

CuePoint

()Constructor
public function CuePoint(type:String, time:Number, name:String, parameters:Object, duration:Number = NaN)

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

Constructor.

Parameters
type:String — The type of cue point specified by one of the const values in CuePointType.
 
time:Number — The time value of the cue point in seconds.
 
name:String — The name of the cue point.
 
parameters:Object — Custom name/value data for the cue point.
 
duration:Number (default = NaN) — The duration value for the cue point in seconds.
Constant Detail

DYNAMIC_CUEPOINTS_NAMESPACE

Constant
public static const DYNAMIC_CUEPOINTS_NAMESPACE:String = "http://www.osmf.org/timeline/dynamicCuePoints/1.0"

Namespace URL for a TimelineMetadata class that exposes dynamic cue points.

EMBEDDED_CUEPOINTS_NAMESPACE

Constant 
public static const EMBEDDED_CUEPOINTS_NAMESPACE:String = "http://www.osmf.org/timeline/embeddedCuePoints/1.0"

Namespace URL for a TimelineMetadata class that exposes embedded cue points.

CuePointExample.as

package
{
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    
    import org.osmf.elements.VideoElement;
    import org.osmf.events.MediaElementEvent;
    import org.osmf.events.TimelineMetadataEvent;
    import org.osmf.media.MediaPlayerSprite;
    import org.osmf.media.URLResource;
    import org.osmf.metadata.CuePoint;
    import org.osmf.metadata.TimelineMetadata;
    
    public class CuePointExample extends Sprite
    {
        public function CuePointExample()
        {
            super();
            
            stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.align = StageAlign.TOP_LEFT;
            
            var mediaPlayerSprite:MediaPlayerSprite = new MediaPlayerSprite();
            var urlResource:URLResource = new URLResource("rtmp://cp67126.edgefcs.net/ondemand/mp4:mediapm/osmf/content/test/cuepoints/spacealonehd_sounas_640_with_nav.f4v");
            videoElement= new VideoElement();
            videoElement.resource = urlResource;
            videoElement.addEventListener(MediaElementEvent.METADATA_ADD, onMetadataAdd);

            addChild(mediaPlayerSprite);
            mediaPlayerSprite.media = videoElement;    
        }

        private function onMetadataAdd(event:MediaElementEvent):void
        {
            if (event.namespaceURL == CuePoint.DYNAMIC_CUEPOINTS_NAMESPACE)
            {
                var timelineMetadata:TimelineMetadata = videoElement.getMetadata(CuePoint.DYNAMIC_CUEPOINTS_NAMESPACE) as TimelineMetadata;
                timelineMetadata.addEventListener(TimelineMetadataEvent.MARKER_TIME_REACHED, onCuePoint);
            }
        }

        private function onCuePoint(event:TimelineMetadataEvent):void
        {
            var cuePoint:CuePoint = event.marker as CuePoint;
            trace("Cue Point at " + cuePoint.time);
        }

        private var videoElement:VideoElement;
    }
}