View comments | RSS feed

VideoPlayer class

Inheritance MovieClip > VideoPlayer class

ActionScript Class Name mx.video.VideoPlayer

VideoPlayer extends the MovieClip class and wraps a Video object.

The FLVPlayback class wraps the VideoPlayer class and Macromedia strongly encourages you to use the FLVPlayback class in almost all cases. There is no functionality in the VideoPlayer class that cannot be accessed using the FLVPlayback class.

The VideoPlayer class is included here because it allows you to create a video player with a smaller SWF file. The VideoPlayer class does not allow you to include a skin or playback controls, and it has a smaller API. You cannot find or seek to cue points, for example, although cuePoint events will occur.

In addition, the FLVPlayback class automatically interfaces with the NCManager class to access streaming FLV files on a FCS, for example. 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:

_forceNCManager:mx.video.NCManager;

The NCManager class also has an interface class, INCManager, which allows you to replace the NCManager class with a custom class for managing network communications. If you do that, you also need to include the following statement, replacing NCManager with the name of the class you have provided:

mx.video.VideoPlayer.DEFAULT_INCMANAGER = "mx.video.NCManager";

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

NOTE

 

You also can set DEFAULT_INCMANAGER to replace the default mx.video.NCManager with the FLVPlayback component.

To handle multiple streams for multiple bandwidths, NCManager supports a subset of SMIL. For more information, see Using a SMIL file.

This section provides a summary of the VideoPlayer class. You can find detailed documentation of the methods, properties, and events of the VideoPlayer class at www.macromedia.com/go/videoplayer.

Method summary for the VideoPlayer class

The following table lists the methods of the VideoPlayer class:

Method

Description

VideoPlayer.addEventListener()

Creates a listener for a specified event.

VideoPlayer.close()

Closes the video stream and FCS connection.

VideoPlayer.load()

Loads the FLV file but does not begin playing. After resizing (if needed) the FLV file is paused.

VideoPlayer.pause()

Pauses playing the video stream.

VideoPlayer.play()

Begins playing the video stream.

VideoPlayer.removeEventListener()

Removes an event listener.

VideoPlayer.seek()

Seeks to a specified time in the file, given in seconds, with decimal precision up to milliseconds.

VideoPlayer.setScale()

Sets scaleX and scaleY simultaneously.

VideoPlayer.setSize()

Sets width and height simultaneously.

VideoPlayer.stop()

Stops playing the video stream.

Property summary for the VideoPlayer class

The VideoPlayer class has class and instance properties.

Class properties

The following properties occur only for the VideoPlayer class. They are read-only constants that apply to all instances of the VideoPlayer class.

Property

Value

Description

VideoPlayer.BUFFERING

"buffering"

Possible value for the state property. Indicates state entered immediately after play() or load() is called.

VideoPlayer.CONNECTION_ERROR

"connectionError"

Possible value for the state property. Indicates that a connection error occurred.

VideoPlayer.DEFAULT_INCMANAGER

"mx.video.NCManager"

Name of the default (mx.video.NCManager) or custom implementation of the INCManager interface.

VideoPlayer.DISCONNECTED

"disconnected"

Possible value for the state property. Indicates that the FLV file stream is disconnected.

VideoPlayer.LOADING

"loading"

Possible value for the state property. Indicates that the FLV file is loading.

VideoPlayer.PAUSED

"paused"

Possible value for the state property. Indicates that the FLV file is paused.

VideoPlayer.PLAYING

"playing"

Possible value for the state property. Indicates that the FLV file is playing.

VideoPlayer.RESIZING

"resizing"

Possible value for the state property. Indicates that the FLV file is resizing.

VideoPlayer.REWINDING

"rewinding"

Possible value for the state property. Indicates that the FLV file is rewinding.

VideoPlayer.SEEKING

"seeking"

Possible value for the state property. Indicates that the FLV file is seeking.

VideoPlayer.STOPPED

"stopped"

Possible value for the state property. Indicates that the FLV file is stopped.

VideoPlayer.version

x.x.x.xx

A number that is the component's version number.

Instance Properties

The following table lists the instance properties of the VideoPlayer class. This set of properties applies to each instance of a VideoPlayer class.

Property

Description

VideoPlayer.autoRewind

A Boolean value that, if true, causes the FLV file to rewind to the first frame when play stops.

VideoPlayer.autoSize

A Boolean value that, if true, causes the video to automatically size to the source dimensions.

VideoPlayer.bufferTime

A number that specifies the number of seconds to buffer in memory before beginning to play a video stream.

VideoPlayer.bytesLoaded

A number that indicates the extent of downloading in number of bytes for an HTTP download. Read-only.

VideoPlayer.bytesTotal

A number that specifies the total number of bytes downloaded for an HTTP download. Read-only.

VideoPlayer.connected

A Boolean value that indicates whether the FLV file stream is connected. Read-only.

VideoPlayer.height

A number that specifies the height of the video in pixels.

VideoPlayer.idleTimeout

The amount of time, in milliseconds, before an idle FCS connection (because playing is paused or stopped) is terminated.

VideoPlayer.isLive

A Boolean value that is true if the video stream is live. Not applicable to HTTP download.

VideoPlayer.isRTMP

A Boolean value that is true if the FLV file is streaming from FCS. Read-only.

VideoPlayer.maintainAspectRatio

A Boolean value that, if true, maintains the video aspect ratio.

VideoPlayer.metadata

An object that is a metadata information packet that is received from a call to the onMetaData() callback function, if available. Read-only.

VideoPlayer.ncMgr

An INCManager object that provides access to an instance of the class implementing INCManager.

VideoPlayer.playheadTime

A number that is the current playhead time or position, measured in seconds, which can be a fractional value.

VideoPlayer.playheadUpdateInterval

A number that is the amount of time, in milliseconds, between each playheadUpdate event.

VideoPlayer.progressInterval

A number that is the amount of time, in milliseconds, between each progress event.

VideoPlayer.scaleX

A number that specifies the horizontal scale.

VideoPlayer.scaleY

A number that specifies the vertical scale.

VideoPlayer.state

A string that specifies the state of the component. Set with the load(), play(), stop(), pause() and seek() methods. Read-only.

VideoPlayer.stateResponsive

A Boolean value that is true if the state is responsive (that is, if controls can be enabled in the current state). Read-only.

VideoPlayer.totalTime

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

VideoPlayer.transform

An object that provides direct access to the Sound.setTransform() and Sound.getTransform() methods to provide more sound control.

VideoPlayer.url

A string that specifies the URL of the loaded (or loading) stream.

VideoPlayer.videoHeight

A number that specifies the height of the FLV file.

VideoPlayer.videoWidth

A number that specifies the width of the FLV file.

VideoPlayer.visible

A Boolean value that, if true, makes the FLV file visible.

VideoPlayer.volume

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

VideoPlayer.width

A number (percentage) that specifies how far a user can move the volume bar handle before an update occurs.

VideoPlayer.x

A number that specifies the horizontal dimension in pixels of the video player.

VideoPlayer.y

A number that specifies the vertical dimension in pixels of the video player.

Event summary for the VideoPlayer class

The following table lists the events of the VideoPlayer class:

Event

Description

VideoPlayer.close

Dispatched when the video stream is closed, whether through timeout or a call to the close() method.

VideoPlayer.complete

Dispatched when playing completes by reaching the end of the FLV file.

VideoPlayer.cuePoint

Dispatched when a cue point is reached.

VideoPlayer.metadataReceived

Dispatched the first time the FLV file metadata is reached.

VideoPlayer.playheadUpdate

Dispatched every .25 seconds while the FLV file is playing.

VideoPlayer.progress

Dispatched every .25 seconds, starting when the load() method is called and ending when all bytes are loaded or there is a network error.

VideoPlayer.ready

Dispatched when the FLV file is loaded and ready to display.

VideoPlayer.resize

Dispatched when the video is resized.

VideoPlayer.rewind

Dispatched when the location of the playhead is moved backward by a call to seek() or when the automatic rewind operation completes.

VideoPlayer.stateChange

Dispatched when the playback state changes.


Version 8

Comments


The Rambling Man said on Jan 25, 2006 at 12:33 PM :
Some of the instance properties in here don't seem correct -- for example, shouldn't VideoPlayer.width be described as "A number that specifies the width of the video in pixels."? The descriptions for VideoPlayer.x and .y are also suspect...
ScottyDawg said on Sep 30, 2006 at 11:09 PM :
The link referenced here (www.macromedia.com/go/videoplayer) links to the generic documentation site, not the "detailed documentation of the methods, properties, and events of the VideoPlayer class."
No screen name said on Dec 22, 2006 at 6:52 AM :
Yes, the description for VideoPlayer._x , and VideoPlayer._y are definitely wrong. They should be "A number that indicates the objects x/y position on the stage."
smartj said on Jul 3, 2007 at 7:18 PM :
There is no url property for FlvPLayback objects. It is undefined in Flash8. Why is it here?

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/8/main/00003645.html