VideoLoad
| Kind of class: | public class |
|---|---|
| Package: | org.casalib.load |
| Inherits from: | LoadItem < BaseLoadItem < Process < RemovableEventDispatcher < EventDispatcher |
| Version: | 12/01/08 |
| Author: | Aaron Clinger |
| Classpath: | org.casalib.load.VideoLoad |
| File last modified: | Monday, 01 December 2008, 11:16:36 |
Provides an easy and standardized way to load video files. VideoLoad also includes buffer progress information in the progress event.
Example:
-
package { import flash.display.MovieClip; import org.casalib.events.VideoLoadEvent; import org.casalib.load.VideoLoad; public class MyExample extends MovieClip { protected var _videoLoad:VideoLoad; public function MyExample() { super(); this._videoLoad = new VideoLoad("test.flv"); this._videoLoad.pauseStart = true; this._videoLoad.addEventListener(VideoLoadEvent.PROGRESS, this._onProgress); this._videoLoad.addEventListener(VideoLoadEvent.BUFFERED, this._onBuffered); this._videoLoad.start(); this.addChild(this._videoLoad.video); } protected function _onProgress(e:VideoLoadEvent):void { trace(e.millisecondsUntilBuffered + " milliseconds until buffered"); trace(e.buffer.percentage + "% buffered"); trace(e.progress.percentage + "% loaded"); } protected function _onBuffered(e:VideoLoadEvent):void { e.target.netStream.resume(); } } }
Events broadcasted to listeners:
- AsyncErrorEvent with type:
ASYNC_ERROR- Dispatched when an exception is thrown asynchronously. - SecurityErrorEvent with type:
SECURITY_ERROR- Dispatched if load is outside the security sandbox. - VideoInfoEvent with type:
CUE_POINT- Dispatched when a video cue point is reached. - VideoInfoEvent with type:
META_DATA- Dispatched when video meta data is received. - VideoLoadEvent with type:
PROGRESS- Dispatched as video is received during the download process. - VideoLoadEvent with type:
BUFFERED- Dispatched when video is buffered. - NetStatusEvent with type:
NET_STATUS- Dispatched when a NetStream object has reporting its status.
Summary
Constructor
- VideoLoad (request:*)
- Creates a new VideoLoad.
Class properties
Class properties inherited from Process
Instance properties
- duration : Number
- The duration/length of the video.
- pauseStart : Boolean
- Indicates to pause video at start true, or to let the video automatically play false; defaults to false.
- video : Video
- A Video class with attached NetStream.
- connection : NetConnection
- The NetConnection class used by the VideoLoad class.
- netStream : NetStream
- The NetStream class used by the VideoLoad class.
- millisecondsUntilBuffered : int
- The time remaining in milliseconds until the video has completely buffered.
- buffer : Percent
- The percent the video has buffered.
- buffered : Boolean
Instance properties inherited from LoadItem
Instance properties inherited from BaseLoadItem
Instance properties inherited from Process
Instance properties inherited from RemovableEventDispatcher
Instance methods
- destroy : void
Instance methods inherited from LoadItem
Instance methods inherited from BaseLoadItem
Instance methods inherited from RemovableEventDispatcher
Constructor
VideoLoad
public function VideoLoad (
request:*)
Creates a new VideoLoad.
Parameters:
request:
A
String or an URLRequest reference to the video you wish to load.Instance properties
buffer
The percent the video has buffered.
Usage note:
- VideoLoad will report
0percent until two seconds of load time has elapsed.
buffered
public buffered:Boolean
(read)
connection
public connection:NetConnection
(read)
The NetConnection class used by the VideoLoad class.
duration
public duration:Number
(read,write)
The duration/length of the video.
Usage note:
- Setting this value will override the length (provided by the video metadata) that is used to calculate buffer.
millisecondsUntilBuffered
public millisecondsUntilBuffered:int
(read)
The time remaining in milliseconds until the video has completely buffered.
Usage note:
- VideoLoad will report
-1milliseconds until two seconds of load time has elapsed.
netStream
public netStream:NetStream
(read)
The NetStream class used by the VideoLoad class.
pauseStart
public pauseStart:Boolean
(read,write)
Indicates to pause video at start
true, or to let the video automatically play false; defaults to false. video
public video:Video
(read)
A Video class with attached NetStream.
Instance methods
destroy
override public function destroy (
) : void
Usage note:
-
destroydoes not close the internal NetStream object. To completely destroy a VideoLoad you have to close the NetStream object:
this._videoLoad.netStream.close(); this._videoLoad.destroy();
Overrides: