Flash CS3 Documentation |
|||
| ActionScript 2.0 Components Language Reference > FLVPlayback Component > VideoPlayer class | |||
Inheritance MovieClip > VideoPlayer class
ActionScript Class Name mx.video.VideoPlayer
VideoPlayer extends the MovieClip class and wraps a Video object.
|
NOTE |
|
The ViceoPlayer class is supported only if you are working in a document that specifies ActionScript 2.0 in its Publish Settings. |
The FLVPlayback class wraps the VideoPlayer class and Adobe 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 FMS, 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.adobe.com/go/videoplayer.
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 FMS 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 |
VideoPlayer.setSize()
|
Sets |
VideoPlayer.stop()
|
Stops playing the video stream. |
The VideoPlayer class has class and instance 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
|
|
Possible value for the |
VideoPlayer.CONNECTION_ERROR
|
|
Possible value for the |
VideoPlayer.DEFAULT_INCMANAGER
|
|
Name of the default (mx.video.NCManager) or custom implementation of the INCManager interface. |
VideoPlayer.DISCONNECTED
|
|
Possible value for the |
VideoPlayer.LOADING
|
|
Possible value for the |
VideoPlayer.PAUSED
|
|
Possible value for the |
VideoPlayer.PLAYING
|
|
Possible value for the |
VideoPlayer.RESIZING
|
|
Possible value for the |
VideoPlayer.REWINDING
|
|
Possible value for the |
VideoPlayer.SEEKING
|
|
Possible value for the |
VideoPlayer.STOPPED
|
|
Possible value for the |
VideoPlayer.version
|
x.x.x.xx |
A number that is the component's version number. |
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 |
VideoPlayer.autoSize
|
A Boolean value that, if |
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 FMS connection (because playing is paused or stopped) is terminated. |
VideoPlayer.isLive
|
A Boolean value that is |
VideoPlayer.isRTMP
|
A Boolean value that is |
VideoPlayer.maintainAspectRatio
|
A Boolean value that, if |
VideoPlayer.metadata
|
An object that is a metadata information packet that is received from a call to the |
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 |
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 |
VideoPlayer.stateResponsive
|
A Boolean value that is |
VideoPlayer.totalTime
|
A number that is the total playing time for the video. |
VideoPlayer.transform
|
An object that provides direct access to the |
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 |
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. |
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 |
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 |
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 |
VideoPlayer.stateChange
|
Dispatched when the playback state changes. |
Flash CS3