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

VideoPlayer  - AS3 Flash

Packagefl.video
Classpublic class VideoPlayer
InheritanceVideoPlayer Inheritance Video Inheritance DisplayObject Inheritance EventDispatcher Inheritance Object

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

The VideoPlayer class lets you create a video player with a slightly smaller SWF file than if you used the FLVPlayback component. Unlike the FLVPlayback component, the VideoPlayer class does not let you include a skin or playback controls, and although you cannot find or seek to cue points, the cuePoint events will occur. The FLVPlayback class wraps the VideoPlayer class.

Use the FLVPlayback class in almost all cases because there is no functionality in the VideoPlayer class that cannot be accessed using the FLVPlayback class.

In addition, the FLVPlayback class automatically interfaces with the NCManager class to access streaming FLV files on a video server, such as Flash Media Server. You interact with the NCManager class when you set the contentPath property and when you pass a URL to the play() and load() methods. If you use the VideoPlayer class by itself, however, you must include the following statement in your ActionScript code to make sure the NCManager class is included:

var _forceNCManager:fl.video.NCManager;

The NCManager class implements an interface, INCManager, and it can be replaced with a custom class for managing network communications that implements this interface. If you do that, you also need to include the following statement, replacing NCManager with the name of the class you have provided:

fl.video.VideoPlayer.iNCManagerClass = fl.video.NCManager;

You do not need to add this statement if you are using the default NCManager class.

Note: You also can set iNCManagerClass to replace the default fl.video.NCManager when using the FLVPlayback component.

To handle multiple streams for multiple bandwidths, NCManager supports a subset of SMIL.

View the examples

Related API Elements



Public Properties
 PropertyDefined By
 InheritedaccessibilityProperties : AccessibilityProperties
The current accessibility options for this display object.
DisplayObject
  align : String
Specifies how the video is displayed relative to the registrationX, registrationY, registrationWidth and registrationHeight properties.
VideoPlayer
 Inheritedalpha : Number
Indicates the alpha transparency value of the object specified.
DisplayObject
  autoRewind : Boolean
A Boolean value that, if true, causes the FLV file to rewind to Frame 1 when play stops, either because the player reached the end of the stream or the stop() method was called.
VideoPlayer
 InheritedblendMode : String
A value from the BlendMode class that specifies which blend mode to use.
DisplayObject
 InheritedblendShader : Shader
[write-only] Sets a shader that is used for blending the foreground and background.
DisplayObject
  bufferTime : Number
A number that specifies the number of seconds to buffer in memory before beginning to play a video stream.
VideoPlayer
  bytesLoaded : uint
[read-only] A number that indicates the extent of downloading, in number of bytes, for an HTTP download.
VideoPlayer
  bytesTotal : uint
[read-only] A number that specifies the total number of bytes downloaded for an HTTP download.
VideoPlayer
 InheritedcacheAsBitmap : Boolean
If set to true, Flash runtimes cache an internal bitmap representation of the display object.
DisplayObject
 Inherited    cacheAsBitmapMatrix : Matrix
If non-null, this Matrix object defines how a display object is rendered when cacheAsBitmap is set to true.
DisplayObject
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 Inheriteddeblocking : int
Indicates the type of filter applied to decoded video as part of post-processing.
Video
 Inheritedfilters : Array
An indexed array that contains each filter object currently associated with the display object.
DisplayObject
  height : Number
[override] A number that specifies the height of the VideoPlayer instance (in pixels).
VideoPlayer
  idleTimeout : Number
The amount of time, in milliseconds, before Flash terminates an idle connection to a video server, such as Flash Media Server, because playing paused or stopped.
VideoPlayer
  iNCManagerClass : Object = fl.video.NCManager
[static] To make all VideoPlayer objects use your custom class as the default INCManager implementation, set the iNCManagerClass property to the class object or string name of your custom class.
VideoPlayer
  isLive : Boolean
[read-only] A Boolean value that is true if the video stream is live.
VideoPlayer
  isRTMP : Boolean
[read-only] A Boolean value that is true if the FLV file is streaming from Flash Media Server (FMS) using RTMP.
VideoPlayer
 InheritedloaderInfo : LoaderInfo
[read-only] Returns a LoaderInfo object containing information about loading the file to which this display object belongs.
DisplayObject
 Inheritedmask : DisplayObject
The calling display object is masked by the specified mask object.
DisplayObject
  metadata : Object
[read-only] An object that is a metadata information packet that is received from a call to the NetSteam.onMetaData() callback method, if available.
VideoPlayer
 InheritedmetaData : Object
Obtains the meta data object of the DisplayObject instance if meta data was stored alongside the the instance of this DisplayObject in the SWF file through a PlaceObject4 tag.
DisplayObject
 InheritedmouseX : Number
[read-only] Indicates the x coordinate of the mouse or user input device position, in pixels.
DisplayObject
 InheritedmouseY : Number
[read-only] Indicates the y coordinate of the mouse or user input device position, in pixels.
DisplayObject
 Inheritedname : String
Indicates the instance name of the DisplayObject.
DisplayObject
  ncMgr : INCManager
[read-only] An INCManager object that provides access to an instance of the class implementing INCManager, which is an interface to the NCManager class.
VideoPlayer
  netConnection : NetConnection
[read-only] Allows direct access to the NetConnection instance created by the video player.
VideoPlayer
  netStream : NetStream
[read-only] Allows direct access to the NetStream instance created by the video player.
VideoPlayer
  netStreamClientClass : Object
[static] Registers a custom class for the NetStream's client property.
VideoPlayer
 InheritedopaqueBackground : Object
Specifies whether the display object is opaque with a certain background color.
DisplayObject
 Inheritedparent : DisplayObjectContainer
[read-only] Indicates the DisplayObjectContainer object that contains this display object.
DisplayObject
  playheadTime : Number
A number that is the current playhead time or position, measured in seconds, which can be a fractional value.
VideoPlayer
  playheadUpdateInterval : Number
A number that is the amount of time, in milliseconds, between each playheadUpdate event.
VideoPlayer
  progressInterval : Number
A number that is the amount of time, in milliseconds, between each progress event.
VideoPlayer
  registrationHeight : Number
The height used to align the video content when autoresizing.
VideoPlayer
  registrationWidth : Number
The width used to align the video content when autoresizing.
VideoPlayer
  registrationX : Number
The x coordinate used to align the video content when autoresizing.
VideoPlayer
  registrationY : Number
The y coordinate used to align the video content when autoresizing.
VideoPlayer
 Inheritedroot : DisplayObject
[read-only] For a display object in a loaded SWF file, the root property is the top-most display object in the portion of the display list's tree structure represented by that SWF file.
DisplayObject
 Inheritedrotation : Number
Indicates the rotation of the DisplayObject instance, in degrees, from its original orientation.
DisplayObject
 InheritedrotationX : Number
Indicates the x-axis rotation of the DisplayObject instance, in degrees, from its original orientation relative to the 3D parent container.
DisplayObject
 InheritedrotationY : Number
Indicates the y-axis rotation of the DisplayObject instance, in degrees, from its original orientation relative to the 3D parent container.
DisplayObject
 InheritedrotationZ : Number
Indicates the z-axis rotation of the DisplayObject instance, in degrees, from its original orientation relative to the 3D parent container.
DisplayObject
 Inheritedscale9Grid : Rectangle
The current scaling grid that is in effect.
DisplayObject
  scaleMode : String
Specifies how the video resizes after loading.
VideoPlayer
  scaleX : Number
[override] A number that is the horizontal scale.
VideoPlayer
  scaleY : Number
[override] A number that is the vertical scale.
VideoPlayer
 InheritedscaleZ : Number
Indicates the depth scale (percentage) of an object as applied from the registration point of the object.
DisplayObject
 InheritedscrollRect : Rectangle
The scroll rectangle bounds of the display object.
DisplayObject
 Inheritedsmoothing : Boolean
Specifies whether the video should be smoothed (interpolated) when it is scaled.
Video
  soundTransform : flash.media:SoundTransform
Provides direct access to the NetStream.soundTransform property to expose more sound control.
VideoPlayer
  source : String
[read-only] A string that specifies the URL of the FLV file to stream and how to stream it.
VideoPlayer
 Inheritedstage : Stage
[read-only] The Stage of the display object.
DisplayObject
  state : String
[read-only] A string that specifies the state of the component.
VideoPlayer
  stateResponsive : Boolean
[read-only] A Boolean value that is true if the state is responsive.
VideoPlayer
  totalTime : Number
[read-only] A number that is the total playing time for the video in seconds.
VideoPlayer
 Inheritedtransform : flash.geom:Transform
An object with properties pertaining to a display object's matrix, color transform, and pixel bounds.
DisplayObject
  videoHeight : int
[override] [read-only] The source width of the loaded FLV file.
VideoPlayer
  videoWidth : int
[override] [read-only] The source width of the loaded FLV file.
VideoPlayer
  visible : Boolean
[override] A Boolean value that, if true, makes the VideoPlayer instance visible.
VideoPlayer
  volume : Number
A number in the range of 0 to 1 that indicates the volume control setting.
VideoPlayer
  width : Number
[override] A number that specifies the width of the VideoPlayer instance on the Stage.
VideoPlayer
  x : Number
[override] A number that specifies the horizontal position (in pixels) of the video player.
VideoPlayer
  y : Number
[override] A number that specifies the vertical position (in pixels) of the video player.
VideoPlayer
 Inheritedz : Number
Indicates the z coordinate position along the z-axis of the DisplayObject instance relative to the 3D parent container.
DisplayObject
Public Methods
 MethodDefined By
  
VideoPlayer(width:int = 320, height:int = 240)
Creates a VideoPlayer object with a specified width and height.
VideoPlayer
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
EventDispatcher
 Inherited
Specifies a video stream from a camera to be displayed within the boundaries of the Video object in the application.
Video
 Inherited
Specifies a video stream to be displayed within the boundaries of the Video object in the application.
Video
 Inherited
Clears the image currently displayed in the Video object (not the video stream).
Video
  
Forces the video stream and Flash Media Server connection to close.
VideoPlayer
 Inherited
Dispatches an event into the event flow.
EventDispatcher
 Inherited
getBounds(targetCoordinateSpace:DisplayObject):Rectangle
Returns a rectangle that defines the area of the display object relative to the coordinate system of the targetCoordinateSpace object.
DisplayObject
 Inherited
getRect(targetCoordinateSpace:DisplayObject):Rectangle
Returns a rectangle that defines the boundary of the display object, based on the coordinate system defined by the targetCoordinateSpace parameter, excluding any strokes on shapes.
DisplayObject
 Inherited
Converts the point object from the Stage (global) coordinates to the display object's (local) coordinates.
DisplayObject
 Inherited
Converts a two-dimensional point from the Stage (global) coordinates to a three-dimensional display object's (local) coordinates.
DisplayObject
 Inherited
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
EventDispatcher
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Evaluates the bounding box of the display object to see if it overlaps or intersects with the bounding box of the obj display object.
DisplayObject
 Inherited
hitTestPoint(x:Number, y:Number, shapeFlag:Boolean = false):Boolean
Evaluates the display object to see if it overlaps or intersects with the point specified by the x and y parameters.
DisplayObject
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
  
load(url:String, totalTime:Number = NaN, isLive:Boolean = false, startTime:Number = NaN, duration:Number = NaN):void
Similar to the play() method, but causes the FLV file to load without playing.
VideoPlayer
 Inherited
Converts a three-dimensional point of the three-dimensional display object's (local) coordinates to a two-dimensional point in the Stage (global) coordinates.
DisplayObject
 Inherited
Converts the point object from the display object's (local) coordinates to the Stage (global) coordinates.
DisplayObject
  
Called by INCManager after the connection is complete or failed after a call to the INCManager.connectToURL() method.
VideoPlayer
  
Called by INCManager after the reconnection is complete or has failed after a call to the INCManager.reconnect() method.
VideoPlayer
  
Pauses video playback.
VideoPlayer
  
play(url:String = null, totalTime:Number = NaN, isLive:Boolean = false, startTime:Number = NaN, duration:Number = NaN):void
Causes the video to play.
VideoPlayer
  
Plays the FLV file when enough of it has downloaded.
VideoPlayer
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
EventDispatcher
  
Seeks to a given time in the file, specified in seconds, with a precision of three decimal places (milliseconds).
VideoPlayer
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
  
setScale(scaleX:Number, scaleY:Number):void
Sets the scaleX and scaleY properties simultaneously.
VideoPlayer
  
setSize(width:Number, height:Number):void
Sets the width and height properties simultaneously.
VideoPlayer
  
Stops video playback.
VideoPlayer
 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
 Inherited
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
EventDispatcher
Events
 Event Summary Defined By
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active.EventDispatcher
 InheritedDispatched when a display object is added to the display list.DisplayObject
 InheritedDispatched when a display object is added to the on stage display list, either directly or through the addition of a sub tree in which the display object is contained.DisplayObject
  Dispatched when the playhead is moved to the start of the video player because the autoRewind property is set to true.VideoPlayer
  Dispatched by the VideoPlayer instance when it closes the NetConnection by timing out or through a call to the close() method, or when you call the load() or play() methods or set the source property and cause the RTMP connection to close as a result.VideoPlayer
  Dispatched when playing completes because the player reached the end of the FLV file.VideoPlayer
  Dispatched when a cue point is reached.VideoPlayer
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive.EventDispatcher
  drmAuthenticate eventVideoPlayer
  
    drmError
drmError eventVideoPlayer
  
    drmStatus
drmError eventVideoPlayer
 Inherited[broadcast event] Dispatched when the playhead is entering a new frame.DisplayObject
 Inherited[broadcast event] Dispatched when the playhead is exiting the current frame.DisplayObject
 Inherited[broadcast event] Dispatched after the constructors of frame display objects have run but before frame scripts have run.DisplayObject
  Dispatched when the video player is resized or laid out.VideoPlayer
  Dispatched the first time the FLV file's metadata is reached.VideoPlayer
  Dispatched while the FLV file is playing at the frequency specified by the playheadUpdateInterval property or when rewinding starts.VideoPlayer
  Indicates progress made in number of bytes downloaded.VideoPlayer
  Event dispatched when an FLV file is loaded and ready to display.VideoPlayer
 InheritedDispatched when a display object is about to be removed from the display list.DisplayObject
 InheritedDispatched when a display object is about to be removed from the display list, either directly or through the removal of a sub tree in which the display object is contained.DisplayObject
 Inherited[broadcast event] Dispatched when the display list is about to be updated and rendered.DisplayObject
  Dispatched when the playback state changes.VideoPlayer
Public Constants
 ConstantDefined By
  SHORT_VERSION : String = "2.1"
[static] State variable indicating the short version number of the component.
VideoPlayer
  VERSION : String = "2.1.0.23"
[static] State variable indicating the long version number of the component.
VideoPlayer
Property Detail

align

property
align:String

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Specifies how the video is displayed relative to the registrationX, registrationY, registrationWidth and registrationHeight properties. The align property does this autolayout when the scaleMode property is set to VideoScaleMode.MAINTAIN_ASPECT_RATIO or VideoScaleMode.NO_SCALE. Changing this property after an FLV file is loaded causes an automatic layout to start immediately. Values come from the VideoAlign class.

The default value is VideoAlign.CENTER.



Implementation
    public function get align():String
    public function set align(value:String):void

Related API Elements

autoRewind

property 
autoRewind:Boolean

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

A Boolean value that, if true, causes the FLV file to rewind to Frame 1 when play stops, either because the player reached the end of the stream or the stop() method was called. This property is meaningless for live streams.

The default value is false.



Implementation
    public function get autoRewind():Boolean
    public function set autoRewind(value:Boolean):void

bufferTime

property 
bufferTime:Number

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

A number that specifies the number of seconds to buffer in memory before beginning to play a video stream. For FLV files streaming over RTMP, which are not downloaded and buffer only in memory, it can be important to increase this setting from the default value of 0.1. For a progressively downloaded FLV file over HTTP, there is little benefit to increasing this value although it could improve viewing a high-quality video on an older, slower computer.

For prerecorded (not live) video, do not set the bufferTime property to 0; use the default buffer time or increase the buffer time.

This property does not specify the amount of the FLV file to download before starting playback.



Implementation
    public function get bufferTime():Number
    public function set bufferTime(value:Number):void

Related API Elements

bytesLoaded

property 
bytesLoaded:uint  [read-only]

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

A number that indicates the extent of downloading, in number of bytes, for an HTTP download. Returns 0 when there is no stream, when the stream is from Flash Media Server (FMS), or if the information is not yet available. The returned value is useful only for an HTTP download.



Implementation
    public function get bytesLoaded():uint

bytesTotal

property 
bytesTotal:uint  [read-only]

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

A number that specifies the total number of bytes downloaded for an HTTP download. Returns -1 when there is no stream, when the stream is from Flash Media Server (FMS), or if the information is not yet available. The returned value is useful only for an HTTP download.



Implementation
    public function get bytesTotal():uint

height

property 
height:Number[override]

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

A number that specifies the height of the VideoPlayer instance (in pixels).

Note: Do not confuse this property with the flash.media.Video.height property which is similar to the fl.video.VideoPlayer.videoHeight property.



Implementation
    override public function get height():Number
    override public function set height(value:Number):void

Related API Elements

idleTimeout

property 
idleTimeout:Number

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

The amount of time, in milliseconds, before Flash terminates an idle connection to a video server, such as Flash Media Server, because playing paused or stopped. This property has no effect on an FLV file downloading over HTTP.

If this property is set when a video stream is already idle, it restarts the timeout period with the new value.



Implementation
    public function get idleTimeout():Number
    public function set idleTimeout(value:Number):void

iNCManagerClass

property 
public static var iNCManagerClass:Object = fl.video.NCManager

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

To make all VideoPlayer objects use your custom class as the default INCManager implementation, set the iNCManagerClass property to the class object or string name of your custom class. The FLVPlayback class includes the definition of the custom class; the video player does not.

The default value is "fl.video.NCManager" as a string.

isLive

property 
isLive:Boolean  [read-only]

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

A Boolean value that is true if the video stream is live. This property is effective only when streaming from a video server, such as Flash Media Server or other Flash Video Streaming Service. The value of this property is ignored for an HTTP download.

Set the isLive property to false when sending a prerecorded video stream to the video player and to true when sending real-time data such as a live broadcast. For better performance when you set the isLive property to false, do not set the bufferTime property to 0.



Implementation
    public function get isLive():Boolean

Related API Elements

isRTMP

property 
isRTMP:Boolean  [read-only]

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

A Boolean value that is true if the FLV file is streaming from Flash Media Server (FMS) using RTMP. Its value is false for any other FLV file source.



Implementation
    public function get isRTMP():Boolean

Related API Elements

metadata

property 
metadata:Object  [read-only]

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

An object that is a metadata information packet that is received from a call to the NetSteam.onMetaData() callback method, if available. Ready when the metadataReceived event is dispatched.

If the FLV file is encoded with the Flash 8 encoder, the metadata property contains the following information. Older FLV files contain only the height, width, and duration values.

ParameterDescription
canSeekToEndA Boolean value that is true if the FLV file is encoded with a keyframe on the last frame that allows seeking to the end of a progressive download movie clip. It is false if the FLV file is not encoded with a keyframe on the last frame.
cuePointsAn array of objects, one for each cue point embedded in the FLV file. Value is undefined if the FLV file does not contain any cue points. Each object has the following properties:
  • type—A string that specifies the type of cue point as either "navigation" or "event".
  • name—A string that is the name of the cue point.
  • time—A number that is the time of the cue point in seconds with a precision of three decimal places (milliseconds).
  • parameters—An optional object that has name-value pairs that are designated by the user when creating the cue points.
audiocodecidA number that indicates the audio codec (code/decode technique) that was used.
audiodelay A number that represents time 0 in the source file from which the FLV file was encoded.

Video content is delayed for the short period of time that is required to synchronize the audio. For example, if the audiodelay value is .038, the video that started at time 0 in the source file starts at time .038 in the FLV file.

Note that the FLVPlayback and VideoPlayer classes compensate for this delay in their time settings. This means that you can continue to use the time settings that you used in your the source file.

audiodatarateA number that is the kilobytes per second of audio.
videocodecidA number that is the codec version that was used to encode the video.
framerateA number that is the frame rate of the FLV file.
videodatarateA number that is the video data rate of the FLV file.
heightA number that is the height of the FLV file.
widthA number that is the width of the FLV file.
durationA number that specifies the duration of the FLV file in seconds.


Implementation
    public function get metadata():Object

Related API Elements

ncMgr

property 
ncMgr:INCManager  [read-only]

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

An INCManager object that provides access to an instance of the class implementing INCManager, which is an interface to the NCManager class.

You can use this property to implement a custom INCManager that requires custom initialization.



Implementation
    public function get ncMgr():INCManager

Related API Elements

netConnection

property 
netConnection:NetConnection  [read-only]

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Allows direct access to the NetConnection instance created by the video player.



Implementation
    public function get netConnection():NetConnection

netStream

property 
netStream:NetStream  [read-only]

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Allows direct access to the NetStream instance created by the video player.



Implementation
    public function get netStream():NetStream

netStreamClientClass

property 
public static var netStreamClientClass:Object

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.115.0, AIR 1.0

Registers a custom class for the NetStream's client property. By default, fl.video.VideoPlayerClient is used; this class handles the onMetaData() and onCuePoint() messages. To add custom handling for other messages, such as onImageData() and onTextData(), you can create your own class and set this property to the class.

The constructor for the class must take a VideoPlayer instance as its only parameter, and it must have a Boolean ready property. This property should be false while the Client is still waiting for any data messages expected at the beginning of the file. If the VideoPlayer does its resize autorewind before these messages are received, they may never be received. By default, fl.video.VideoPlayerClient will return true from the ready property as soon as onMetaData() is called.

You can set the property to the class object itself (as in the example below) or the string name of the class:

        import fl.video.
        VideoPlayer.netStreamClientClass = MyCustomClient;
        

Note that setting it to the string name of the class is not enough by itself to force the class to be compiled into the SWF. The default value is the class object fl.video.VideoPlayerClient, not the string name.

It is strongly recommended that any custom implementation should subclass fl.video.VideoPlayer. To do otherwise risks breaking the metadata and cue point handling built into the VideoPlayer and the FLVPlayback component.

The default value is fl.video.VideoPlayerClient.


Throws
VideoError — If this property is set to an invalid value, VideoError.NETSTREAM_CLIENT_CLASS_UNSET will be thrown.

playheadTime

property 
playheadTime:Number

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

A number that is the current playhead time or position, measured in seconds, which can be a fractional value. Setting this property triggers a seek and has all the restrictions of a seek.

When the playhead time changes, which includes once every .25 seconds while the FLV file plays, the component dispatches the playheadUpdate event.

For several reasons, the playheadTime property might not have the expected value immediately after calling one of the seek methods or setting playheadTime to cause seeking. First, for a progressive download, you can seek only to a keyframe, so a seek takes you to the time of the first keyframe after the specified time. (When streaming, a seek always goes to the precise specified time even if the source FLV file doesn't have a keyframe there.) Second, seeking is asynchronous, so if you call a seek method or set the playheadTime property, playheadTime does not update immediately. To obtain the time after the seek is complete, listen for the seek event, which does not fire until the playheadTime property has updated.



Implementation
    public function get playheadTime():Number
    public function set playheadTime(value:Number):void

Related API Elements

playheadUpdateInterval

property 
playheadUpdateInterval:Number

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

A number that is the amount of time, in milliseconds, between each playheadUpdate event. Setting this property while the FLV file is playing restarts the timer.

Because ActionScript cue points start on playhead updates, lowering the value of the playheadUpdateInterval property can increase the accuracy of ActionScript cue points.

Because the playhead update interval is set by a call to the global setInterval() method, the update cannot fire more frequently than the SWF file frame rate, as with any interval that is set this way. So, as an example, for the default frame rate of 12 frames per second, the lowest effective interval that you can create is approximately 83 milliseconds, or one second (1000 milliseconds) divided by 12.

The default value is 250.



Implementation
    public function get playheadUpdateInterval():Number
    public function set playheadUpdateInterval(value:Number):void

Related API Elements

progressInterval

property 
progressInterval:Number

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

A number that is the amount of time, in milliseconds, between each progress event. If you set this property while the video stream is playing, the timer restarts.



Implementation
    public function get progressInterval():Number
    public function set progressInterval(value:Number):void

registrationHeight

property 
registrationHeight:Number

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

The height used to align the video content when autoresizing. Do not confuse the registrationHeight property with the height property. The height property reflects the actual height of the video content.

Example 1, load an 80x80 FLV file with the following settings:

  • registrationX = 100
  • registrationY = 100
  • registrationWidth = 60
  • registrationHeight = 40
  • align = VideoAlign.CENTER
  • scaleMode = VideoScaleMode.NO_SCALE
Then, after automatic resizing, you get the following:
  • x = 90
  • y = 80
  • width = 80
  • height = 80

Example 2, load the same scenario as example 1 but with the following settings:

  • scaleMode = VideoScaleMode.MAINTAIN_ASPECT_RATIO
You get the following:
  • x = 110
  • y = 100
  • width = 40
  • height = 80

Example 3, load the same scenario as example 2 but with the following settings:

  • scaleMode = VideoScaleMode.EXACT_FIT
You get all the same values as the registration values:
  • x = 100
  • y = 100
  • width = 60
  • height = 40

Setting the registrationHeight property is equivalent to setting the height property and vice versa. Setting any other property or calling any method that alters the height, such as scaleX, setSize, and setScale, setting keeps height and registrationHeight in sync.



Implementation
    public function get registrationHeight():Number
    public function set registrationHeight(value:Number):void

Related API Elements

registrationWidth

property 
registrationWidth:Number

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

The width used to align the video content when autoresizing. Do not confuse the registrationWidth property with the width property. The width property reflects the actual width of the video content.

Example 1, load an 80x80 FLV file with the following settings:

  • registrationX = 100
  • registrationY = 100
  • registrationWidth = 60
  • registrationHeight = 40
  • align = VideoAlign.CENTER
  • scaleMode = VideoScaleMode.NO_SCALE
Then, after automatic resizing, you get the following:
  • x = 90
  • y = 80
  • width = 80
  • height = 80

Example 2, load the same scenario as example 1 but with the following settings:

  • scaleMode = VideoScaleMode.MAINTAIN_ASPECT_RATIO
You get the following:
  • x = 110
  • y = 100
  • width = 40
  • height = 80

Example 3, load the same scenario as example 2 but with the following settings:

  • scaleMode = VideoScaleMode.EXACT_FIT
You get all the same values as the registration values:
  • x = 100
  • y = 100
  • width = 60
  • height = 40

Setting the registrationWidth property is equivalent to setting the width property and vice versa. Setting any other property or calling any method that alters the width, such as scaleX, setSize, and setScale, also keeps width and registrationWidth in sync.



Implementation
    public function get registrationWidth():Number
    public function set registrationWidth(value:Number):void

Related API Elements

registrationX

property 
registrationX:Number

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

The x coordinate used to align the video content when autoresizing. Do not confuse with the x property, which reflects the actual location of the video content.

Example 1, load an 80x80 FLV file with the following settings:

  • registrationX = 100
  • registrationY = 100
  • registrationWidth = 60
  • registrationHeight = 40
  • align = VideoAlign.CENTER
  • scaleMode = VideoScaleMode.NO_SCALE
Then, after automatic resizing, you get the following:
  • x = 90
  • y = 80
  • width = 80
  • height = 80

Example 2, load the same scenario as example 1 but with the following settings:

  • scaleMode = VideoScaleMode.MAINTAIN_ASPECT_RATIO
You get the following:
  • x = 110
  • y = 100
  • width = 40
  • height = 80

Example 3, load the same scenario as example 2 but with the following settings:

  • scaleMode = VideoScaleMode.EXACT_FIT
You get all the same values as the registration values:
  • x = 100
  • y = 100
  • width = 60
  • height = 40

When either the x or registrationX property is set, the second property is changed to maintain its offset from the first. For example, if x = 10 and registrationX = 20, setting x = 110 also sets registrationX = 120.



Implementation
    public function get registrationX():Number
    public function set registrationX(value:Number):void

Related API Elements

registrationY

property 
registrationY:Number

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

The y coordinate used to align the video content when autoresizing. Do not confuse with the y property, which reflects the actual location of the video content.

Example 1, load an 80x80 FLV file with the following settings:

  • registrationX = 100
  • registrationY = 100
  • registrationWidth = 60
  • registrationHeight = 40
  • align = VideoAlign.CENTER
  • scaleMode = VideoScaleMode.NO_SCALE
Then, after automatic resizing, you get the following:
  • x = 90
  • y = 80
  • width = 80
  • height = 80

Example 2, load the same scenario as example 1 but with the following settings:

  • scaleMode = VideoScaleMode.MAINTAIN_ASPECT_RATIO
You get the following:
  • x = 110
  • y = 100
  • width = 40
  • height = 80

Example 3, load the same scenario as example 2 but with the following settings:

  • scaleMode = VideoScaleMode.EXACT_FIT
You get all the same values as the registration values:
  • x = 100
  • y = 100
  • width = 60
  • height = 40

When either the y or registrationY property is set, the second property is changed to maintain its offset from the first. For example, if y = 10 and registrationY = 20, setting y = 110 also sets registrationY = 120.



Implementation
    public function get registrationY():Number
    public function set registrationY(value:Number):void

Related API Elements

scaleMode

property 
scaleMode:String

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Specifies how the video resizes after loading. If set to VideoScaleMode.MAINTAIN_ASPECT_RATIO, maintains the video aspect ratio within the rectangle defined by registrationX, registrationY, registrationWidth and registrationHeight. If set to VideoScaleMode.NO_SCALE, causes the video to size automatically to the dimensions of the source FLV file. If set to VideoScaleMode.EXACT_FIT, causes the dimensions of the source FLV file to be ignored and the video is stretched to fit the rectangle defined by registrationX, registrationY, registrationWidth and registrationHeight. If this is set after an FLV file has been loaded an automatic layout will start immediately. Values come from VideoScaleMode.

The default value is VideoScaleMode.MAINTAIN_ASPECT_RATIO.



Implementation
    public function get scaleMode():String
    public function set scaleMode(value:String):void

Related API Elements

scaleX

property 
scaleX:Number[override]

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

A number that is the horizontal scale.

The default value is 1.



Implementation
    override public function get scaleX():Number
    override public function set scaleX(value:Number):void

Related API Elements

scaleY

property 
scaleY:Number[override]

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

A number that is the vertical scale.

The default value is 1.



Implementation
    override public function get scaleY():Number
    override public function set scaleY(value:Number):void

Related API Elements

soundTransform

property 
soundTransform:flash.media:SoundTransform

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Provides direct access to the NetStream.soundTransform property to expose more sound control. Set the property to change the settings; use the getter accessor method of the property to retrieve the current settings.



Implementation
    public function get soundTransform():flash.media:SoundTransform
    public function set soundTransform(value:flash.media:SoundTransform):void

Related API Elements

source

property 
source:String  [read-only]

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

A string that specifies the URL of the FLV file to stream and how to stream it. The URL can be an HTTP URL to an FLV file, an RTMP URL to a stream, or an HTTP URL to an XML file.

If you set this property through the Component inspector or the Property inspector, the FLV file begins loading and playing at the next enterFrame event. The delay provides time to set the isLive, autoPlay, and cuePoints properties, among others, which affect loading. It also allows ActionScript that is placed on the first frame to affect the FLVPlayback component before it starts playing.

If you set this property through ActionScript, it immediately calls the VideoPlayer.load() method when the autoPlay property is set to false. Alternatively, it calls the VideoPlayer.play() method when the autoPlay property is set to true. The autoPlay, totalTime, and isLive properties affect how the new FLV file is loaded, so if you set these properties, you must set them before setting the source property.

Set the autoPlay property to false to prevent the new FLV file from playing automatically.



Implementation
    public function get source():String

Related API Elements

state

property 
state:String  [read-only]

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

A string that specifies the state of the component. This property is set by the load(), play(), stop(), pause(), and seek() methods.

The possible values for the state property are: buffering, connectionError, disconnected, loading, paused, playing, rewinding, seeking, and stopped. You can use the FLVPlayback class properties to test for these states.



Implementation
    public function get state():String

Related API Elements

stateResponsive

property 
stateResponsive:Boolean  [read-only]

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

A Boolean value that is true if the state is responsive. If the state is unresponsive, calls to the play(), load(), stop(), pause(), and seek() methods are queued and executed later, when the state changes to a responsive one. Because these calls are queued and executed later, it is usually not necessary to track the value of the stateResponsive property. The responsive states are: stopped, playing, paused, and buffering.



Implementation
    public function get stateResponsive():Boolean

Related API Elements

totalTime

property 
totalTime:Number  [read-only]

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

A number that is the total playing time for the video in seconds.

When streaming from Flash Media Server (FMS) and using the default NCManager, this value is determined automatically by server-side application programming interfaces (APIs), and that value overrides anything set through this property or gathered from metadata. The property is ready for reading when the stopped or playing state is reached after setting the source property. This property is meaningless for live streams from an FMS.

With an HTTP download, the value is determined automatically if the FLV file has metadata embedded; otherwise, set it explicitly, or it will be NaN. If you set it explicitly, the metadata value in the stream is ignored.

When you set this property, the value takes effect for the next FLV file that is loaded by setting source. It has no effect on an FLV file that has already loaded. Also, this property does not return the new value passed in until an FLV file is loaded.

Playback still works if this property is never set (either explicitly or automatically), but it can cause problems with seek controls.

Unless set explicitly, the value will be NaN until it is set to a valid value from metadata.



Implementation
    public function get totalTime():Number

Related API Elements

videoHeight

property 
videoHeight:int  [read-only] [override]

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

The source width of the loaded FLV file. This property returns -1 if no information is available yet.



Implementation
    override public function get videoHeight():int

Related API Elements

videoWidth

property 
videoWidth:int  [read-only] [override]

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

The source width of the loaded FLV file. This property returns -1 if no information is available yet.



Implementation
    override public function get videoWidth():int

Related API Elements

visible

property 
visible:Boolean[override]

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

A Boolean value that, if true, makes the VideoPlayer instance visible. If false, it makes the instance invisible.

The default value is true.



Implementation
    override public function get visible():Boolean
    override public function set visible(value:Boolean):void

volume

property 
volume:Number

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

A number in the range of 0 to 1 that indicates the volume control setting.

The default value is 1.



Implementation
    public function get volume():Number
    public function set volume(value:Number):void

Related API Elements

width

property 
width:Number[override]

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

A number that specifies the width of the VideoPlayer instance on the Stage.

Note: The flash.media.Video.width property is similar to the fl.video.VideoPlayer.videoWidth property.



Implementation
    override public function get width():Number
    override public function set width(value:Number):void

Related API Elements

x

property 
x:Number[override]

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

A number that specifies the horizontal position (in pixels) of the video player.

Setting the x property also affects the registrationX property. When either the x or registrationX property is set, the second property is changed to maintain its offset from the first. For example, if x = 10 and registrationX = 20, setting x = 110 also sets registrationX = 120.



Implementation
    override public function get x():Number
    override public function set x(value:Number):void

Related API Elements

y

property 
y:Number[override]

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

A number that specifies the vertical position (in pixels) of the video player.

Setting the y property also affects the registrationY property. When either the y or registrationY property is set, the second property is changed to maintain its offset from the first. For example, if y = 10 and registrationY = 20, setting y = 110 also sets registrationY = 120.



Implementation
    override public function get y():Number
    override public function set y(value:Number):void

Related API Elements

Constructor Detail

VideoPlayer

()Constructor
public function VideoPlayer(width:int = 320, height:int = 240)

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Creates a VideoPlayer object with a specified width and height.

Parameters
width:int (default = 320) — The width of the video player in pixels.
 
height:int (default = 240) — The height of the video player in pixels.

Related API Elements

Method Detail

close

()method
public function close():void

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Forces the video stream and Flash Media Server connection to close. This method triggers the close event. You usually do not need to call this method directly, because the idle timeout functionality takes care of closing the stream.

Related API Elements

load

()method 
public function load(url:String, totalTime:Number = NaN, isLive:Boolean = false, startTime:Number = NaN, duration:Number = NaN):void

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Similar to the play() method, but causes the FLV file to load without playing. Autoresizing occurs if appropriate, and the first frame of the FLV file is shown. After initial loading and autolayout, the state is VideoState.PAUSED.

This method takes the same parameters as the play() method, but you cannot call the load() method without a URL. If you do, an error is thrown. If the video player is in an unresponsive state, the load() method queues the request.

Parameters

url:String — A URL string for the FLV file that you want to load. If no value is passed for URL, an error is thrown with the message null URL sent to VideoPlayer.load.
 
totalTime:Number (default = NaN) — The length of an FLV file. Pass in 0, null, or undefined to automatically detect length from metadata, server, or XML.
 
isLive:Boolean (default = false) — The value is true if you stream a live feed from Flash Media Server (FMS).
 
startTime:Number (default = NaN) — Time, in seconds, to be treadted as time 0 in the given media. Play will start from there, the playheadTime will consider startTime to be time 0 and it will not be possible to seek to before this time (seeking to 0 would seek to the given startTime). This parameter is ignored if isLive is true.
 
duration:Number (default = NaN) — Time, in seconds, to be used as the duration of the media. Only used if startTime <= 0. With startTime, this parameter defines a segment of the media which is treated as the entire media by the VideoPlayer. When the video plays duration seconds, playback will stop and a complete event will be dispatched. Attempts to seek beyond the duration will fail. When totalTime property is retreived, it will return the specified duration. This differs from the totalTime parameter to this method because that parameter is used to specify the actual duration of the media, which is most useful when the media does not have metadata with this information; if the totalTime is less than the actual media duration, this does not stop the playback. But with this duration parameter, playback WILL stop. This parameter is ignored if isLive is true.

Related API Elements

ncConnected

()method 
public function ncConnected():void

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Called by INCManager after the connection is complete or failed after a call to the INCManager.connectToURL() method. If the connection failed, set the INCManager.netConnection property to null or undefined before calling.

Related API Elements

ncReconnected

()method 
public function ncReconnected():void

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Called by INCManager after the reconnection is complete or has failed after a call to the INCManager.reconnect() method. If the connection fails, set the INCManager.netconnection property to null before you call it.

Related API Elements

pause

()method 
public function pause():void

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Pauses video playback. If video is paused or stopped, has no effect. To start playback again, call play(). Takes no parameters.

If player is in an unresponsive state, the pause() method queues the request.

Throws an exception if called when no stream is connected. Use the stateChange event and connected property to determine when it is safe to call this method.

If the player is in a stopped state, a call to the pause() method has no effect and the player remains in a stopped state.

Related API Elements

play

()method 
public function play(url:String = null, totalTime:Number = NaN, isLive:Boolean = false, startTime:Number = NaN, duration:Number = NaN):void

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Causes the video to play. Can be called while the video is paused or stopped, or while the video is already playing. Call this method with no arguments to play an already loaded video or pass in a URL to load a new stream.

If the player is in an unresponsive state, queues the request.

Throws an exception if called with no arguments at a time when no stream is connected. Use the stateChange event and the connected property to determine when it is safe to call this method.

Parameters

url:String (default = null) — Pass in a URL string if you want to load and play a new FLV file. If you have already loaded an FLV file and want to continue playing it, pass in null.
 
totalTime:Number (default = NaN) — Pass in the length of the FLV file. Pass in 0 or NaN to automatically detect the length from metadata, server, or XML. If the INCManager.streamLength property is not 0, null, or undefined when the ncConnected property is called, that value takes precedence over this one.
 
isLive:Boolean (default = false) — Pass in true if streaming a live feed from Flash Media Server (FMS).
 
startTime:Number (default = NaN) — Time, in seconds, to be treadted as time 0 in the given media. Play will start from there, the playheadTime will consider startTime to be time 0 and it will not be possible to seek to before this time (seeking to 0 would seek to the given startTime). This parameter is ignored if isLive is true.
 
duration:Number (default = NaN) — Time, in seconds, to be used as the duration of the media. Only used if startTime <= 0. With startTime, this parameter defines a segment of the media which is treated as the entire media by the VideoPlayer. When the video plays duration seconds, playback will stop and a complete event will be dispatched. Attempts to seek beyond the duration will fail. When totalTime property is retreived, it will return the specified duration. This differs from the totalTime parameter to this method because that parameter is used to specify the actual duration of the media, which is most useful when the media does not have metadata with this information; if the totalTime is less than the actual media duration, this does not stop the playback. But with this duration parameter, playback WILL stop. This parameter is ignored if isLive is true.

Related API Elements

playWhenEnoughDownloaded

()method 
public function playWhenEnoughDownloaded():void

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Plays the FLV file when enough of it has downloaded. If the FLV file has downloaded or you are streaming from Flash Media Server (FMS), then calling the playWhenEnoughDownloaded() method is identical to the play() method with no parameters. Calling this method does not pause playback, so in many cases, you may want to call the pause() method before you call this method.

seek

()method 
public function seek(time:Number):void

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Seeks to a given time in the file, specified in seconds, with a precision of three decimal places (milliseconds). If a video is playing, the video continues to play from that point. If a video is paused, the video seeks to that point and remains paused. If a video is stopped, the video seeks to that point and enters the paused state. Has no effect with live streams.

The playheadTime property might not have the expected value immediately after you call one of the seek methods or set playheadTime to cause seeking. For a progressive download, you can seek only to a keyframe; therefore, a seek takes you to the time of the first keyframe after the specified time.

Note: When streaming, a seek always goes to the precise specified time even if the source FLV file doesn't have a keyframe there.

Seeking is asynchronous, so if you call a seek method or set the playheadTime property, playheadTime does not update immediately. To obtain the time after the seek is complete, listen for the seek event, which does not start until the playheadTime property is updated.

Throws an exception if called when no stream is connected. Use the stateChange event and the connected property to determine when it is safe to call this method.

Parameters

time:Number — A number that specifies the time, in seconds, at which to place the playhead.

Throws
VideoError — If time is < 0 or NaN.

Related API Elements

setScale

()method 
public function setScale(scaleX:Number, scaleY:Number):void

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Sets the scaleX and scaleY properties simultaneously. Setting the scaleX or scaleY individually triggers two autolayout events whereas calling the setScale() method causes only one autolayout event.

If the scaleMode property is VideoScaleMode.MAINTAIN_ASPECT_RATIO or VideoScaleMode.NO_SCALE, calling this method causes an immediate autolayout event.

Parameters

scaleX:Number — A number that represents the horizontal scale.
 
scaleY:Number — A number that represents the vertical scale.

Related API Elements

setSize

()method 
public function setSize(width:Number, height:Number):void

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Sets the width and height properties simultaneously. Setting the width or height individually triggers two autolayout events whereas calling the setSize() method causes only one autolayout event.

If the scaleMode property is VideoScaleMode.MAINTAIN_ASPECT_RATIO or VideoScaleMode.NO_SCALE then calling this method triggers an immediate autolayout event.

Parameters

width:Number — The width of the video player.
 
height:Number — The height of the video player.

Related API Elements

stop

()method 
public function stop():void

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Stops video playback. If autoRewind is set to true, rewinds to first frame. If video is already stopped, has no effect. To start playback again, call play(). Takes no parameters.

If player is in an unresponsive state, queues the request.

Throws an exception if called when no stream is connected. Use the stateChange event and connected property to determine when it is safe to call this method.

Related API Elements

Event Detail

autoRewound

Event
Event Object Type: fl.video.VideoEvent
property VideoEvent.type = fl.video.VideoEvent.AUTO_REWOUND

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Dispatched when the playhead is moved to the start of the video player because the autoRewind property is set to true.

The autoRewound event is of type VideoEvent and has the constant VideoEvent.AUTO_REWOUND.

Defines the value of the type property of an autoRewound event object.

This event has the following properties:

PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
stateA string identifying the constant from the VideoState class that describes the playback state of the component.
playheadTimeA number that is the current playhead time or position.
vpThe index of the VideoPlayer object.

Related API Elements

close

Event  
Event Object Type: fl.video.VideoEvent
property VideoEvent.type = fl.video.VideoEvent.CLOSE

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Dispatched by the VideoPlayer instance when it closes the NetConnection by timing out or through a call to the close() method, or when you call the load() or play() methods or set the source property and cause the RTMP connection to close as a result. The FLVPlayback instance dispatches this event only when streaming from Flash Media Server (FMS) or other Flash Video Streaming Service (FVSS).

The close event is of type VideoEvent and has the constant VideoEvent.CLOSE.

Defines the value of the type property of a close event object.

This event has the following properties:

PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
stateA string identifying the constant from the VideoState class that describes the playback state of the component.
playheadTimeA number that is the current playhead time or position.
vpThe index of the VideoPlayer object.

Related API Elements

complete

Event  
Event Object Type: fl.video.VideoEvent
property VideoEvent.type = fl.video.VideoEvent.COMPLETE

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Dispatched when playing completes because the player reached the end of the FLV file. The component does not dispatch the event if you call the stop() or pause() methods or click the corresponding controls.

When the application uses progressive download, it does not set the totalTime property explicitly, and it downloads an FLV file that does not specify the duration in the metadata. The video player sets the totalTime property to an approximate total value before it dispatches this event.

The video player also dispatches the stateChange and stopped events.

The complete event is of type VideoEvent and has the constant VideoEvent.COMPLETE.

Defines the value of the type property of a complete event object.

This event has the following properties:

PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
stateA string identifying the constant from the VideoState class that describes the playback state of the component.
playheadTimeA number that is the current playhead time or position.
vpThe index of the VideoPlayer object.

Related API Elements

cuePoint

Event  
Event Object Type: fl.video.MetadataEvent
property MetadataEvent.type = fl.video.MetadataEvent.CUE_POINT

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Dispatched when a cue point is reached. The event object has an info property that contains the info object received by the NetStream.onCuePoint event callback for FLV file cue points. For ActionScript cue points, it contains the object that was passed into the ActionScript cue point methods or properties.

The cuePoint event is of type MetadataEvent and has the constant MetadataEvent.CUE_POINT.

Defines the value of the type property of a cuePoint event object.

This event has the following properties:

PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
infoThe object with properties describing the cue point.
vpThe index of the VideoPlayer object.

Related API Elements

    

drmAuthenticate

Event  
Event Object Type: flash.events.DRMAuthenticateEvent

Product Version: Flash CS3
Runtime Versions: AIR 1.0

drmAuthenticate event

    

drmError

Event  
Event Object Type: flash.events.DRMErrorEvent

Product Version: Flash CS3
Runtime Versions: AIR 1.0

drmError event

    

drmStatus

Event  
Event Object Type: flash.events.DRMStatusEvent

Product Version: Flash CS3
Runtime Versions: AIR 1.0

drmError event

layout

Event  
Event Object Type: fl.video.LayoutEvent
property LayoutEvent.type = fl.video.LayoutEvent.LAYOUT

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Dispatched when the video player is resized or laid out. Here are two layout scenarios:

  • If the video player is laid out by either using the autoLayout event or calling the setScale() or setSize() methods or changing the width, height, scaleX, and scaleY properties.
  • If there are two video players of different sizes and the visibleVideoPlayerIndex property is switched from one video player to another.

The layout event is of type LayoutEvent and has the constant LayoutEvent.LAYOUT.

Defines the value of the type property of a layout event object.

This event has the following properties:

PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
oldBoundsThe values of the x, y, width, and height properties of the target before the layout event occurs.
oldRegistrationBoundsThe values of the registrationX, registrationY, registrationWidth, and registrationHeight properties of the target before the layout event occurs.

Related API Elements

metadataReceived

Event  
Event Object Type: fl.video.MetadataEvent
property MetadataEvent.type = fl.video.MetadataEvent.METADATA_RECEIVED

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Dispatched the first time the FLV file's metadata is reached. The event object has an info property that contains the info object received by the NetStream.onMetaData event callback.

The metadataReceived event is of type MetadataEvent and has the constant MetadataEvent.METADATA_RECEIVED.

Defines the value of the type property of a metadataReceived event object.

This event has the following properties:

PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
infoThe object with properties describing the FLV file.
vpThe index of the VideoPlayer object.

Related API Elements

playheadUpdate

Event  
Event Object Type: fl.video.VideoEvent
property VideoEvent.type = fl.video.VideoEvent.PLAYHEAD_UPDATE

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Dispatched while the FLV file is playing at the frequency specified by the playheadUpdateInterval property or when rewinding starts. The component does not dispatch this event when the video player is paused or stopped unless a seek occurs.

The playheadUpdate event is of type VideoEvent and has the constant VideoEvent.PLAYHEAD_UPDATE.

Defines the value of the type property of a playheadUpdate event object.

This event has the following properties:

PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
stateA string identifying the constant from the VideoState class that describes the playback state of the component.
playheadTimeA number that is the current playhead time or position.
vpThe index of the VideoPlayer object.

Related API Elements

progress

Event  
Event Object Type: fl.video.VideoProgressEvent
property VideoProgressEvent.type = fl.video.VideoProgressEvent.PROGRESS

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Indicates progress made in number of bytes downloaded. Dispatched at the frequency specified by the progressInterval property, starting when the load begins and ending when all bytes are loaded or there is a network error. The default is every 0.25 seconds starting when load is called and ending when all bytes are loaded or if there is a network error. Use this event to check bytes loaded or number of bytes in the buffer.

Dispatched only for a progressive HTTP download. Indicates progress in number of downloaded bytes. The event object has the bytesLoaded and bytesTotal properties, which are the same as the FLVPlayback properties of the same names.

The progress event is of type VideoProgressEvent and has the constant VideoProgressEvent.PROGRESS.

Defines the value of the type property of a progress event object.

This event has the following properties:

PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
bytesLoadedThe number of items or bytes loaded at the time the listener processes the event.
bytesTotalThe total number of items or bytes that will be loaded if the loading process succeeds.
vpThe index of the VideoPlayer object.

Related API Elements

ready

Event  
Event Object Type: fl.video.VideoEvent
property VideoEvent.type = fl.video.VideoEvent.READY

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Event dispatched when an FLV file is loaded and ready to display. It starts the first time you enter a responsive state after you load a new FLV file with the play() or load() method. It starts only once for each FLV file that is loaded.

The ready event is of type VideoEvent and has the constant VideoEvent.READY.

Defines the value of the type property of a ready event object.

This event has the following properties:

PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
stateA string identifying the constant from the VideoState class that describes the playback state of the component.
playheadTimeA number that is the current playhead time or position.
vpThe index of the VideoPlayer object.

Related API Elements

stateChange

Event  
Event Object Type: fl.video.VideoEvent
property VideoEvent.type = fl.video.VideoEvent.STATE_CHANGE

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Dispatched when the playback state changes. When an autoRewind call is completed the stateChange event is dispatched with the rewinding state. The stateChange event does not start until rewinding has completed.

This event can be used to track when playback enters or leaves unresponsive states such as in the middle of connecting, resizing, or rewinding. The play(), pause(), stop() and seek() methods queue the requests to be executed when the player enters a responsive state.

The stateChange event is of type VideoEvent and has the constant VideoEvent.STATE_CHANGE.

Defines the value of the type property of a stateChange event object.

This event has the following properties:

PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
stateA string identifying the constant from the VideoState class that describes the playback state of the component.
playheadTimeA number that is the current playhead time or position.
vpThe index of the VideoPlayer object.

Related API Elements

Constant Detail

SHORT_VERSION

Constant
public static const SHORT_VERSION:String = "2.1"

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

State variable indicating the short version number of the component. The version number is useful when you have a FLA file and need to know the component version. To determine the component version, type the following code trace into the FLA file:

FLVPlayback.SHORT_VERSION

The SHORT_VERSION variable includes only the major and minor version numbers, for example, 2.0. The VERSION variable includes the major and minor version numbers as well as the revision and build numbers, for example, 2.0.0.11.

Related API Elements

VERSION

Constant 
public static const VERSION:String = "2.1.0.23"

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

State variable indicating the long version number of the component. The version number is useful when you have a FLA file and need to know the component version. To determine the component version, type the following code trace into the FLA file:

FLVPlayback.VERSION

The VERSION variable includes the major and minor version numbers as well as the revision and build numbers, for example, 2.0.0.11. The SHORT_VERSION variable includes only the major and minor version numbers, for example, 2.0.

Related API Elements

VideoPlayerExample.as

This example dynamically creates two VideoPlayer instances and applies a blur filter to one instance.

To run the example, follow these steps:

  1. Add the FLVPlayback component in the library.
  2. Replace testVideoPath with an absolute or relative path to an FLV file.
  3. Save this code as VideoPlayerExample.as in the same directory as your FLA file.
  4. Set the Document class in the FLA file to VideoPlayerExample.
package
{
    import fl.video.VideoPlayer;
    import flash.display.Sprite;
    import flash.filters.BlurFilter;

    public class VideoPlayerExample extends Sprite 
    {
        private var videoPath:String = "http://www.helpexamples.com/flash/video/sheep.flv"
        private var player:VideoPlayer;
        private var blurryPlayer:VideoPlayer;
        
        public function VideoPlayerExample() {
            player = new VideoPlayer();
            player.play(videoPath);
            player.setScale(0.75, 0.75);
            addChild(player);
            
            blurryPlayer = new VideoPlayer();
            blurryPlayer.play(videoPath);
            blurryPlayer.setScale(0.75,0.75);
            blurryPlayer.filters = [ new BlurFilter(8, 8, 1) ];
            blurryPlayer.x = 250;
            addChild(blurryPlayer);            
        }
    }
}