VideoLoad

Kind of class:public class
Package:org.casalib.load
Inherits from:LoadItem < Process < RemovableEventDispatcher < EventDispatcher
Version:09/06/09
Author:Aaron Clinger
Classpath:org.casalib.load.VideoLoad
File last modified:Sunday, 06 September 2009, 08:46:20
Provides an easy and standardized way to load video files. VideoLoad also includes buffer progress information in the progress event.
Example:
  • package {
        import org.casalib.display.CasaMovieClip;
        import org.casalib.events.VideoLoadEvent;
        import org.casalib.load.VideoLoad;
    
    
        public class MyExample extends CasaMovieClip {
            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.
  • VideoLoadEvent with type: PROGRESS - Dispatched as video is received during the download process.
  • VideoLoadEvent with type: BUFFERED - Dispatched when video is buffered.
  • 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.
  • NetStatusEvent with type: NET_STATUS - Dispatched when a NetStream object has reporting its status.

Summary


Constructor
  • VideoLoad (request:*, completeWhenBuffered:Boolean = false)
    • 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.
  • netConnection : 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
    • Determines if the requested video has buffered true, or hasn't finished buffering false.
  • metaData : Object
    • The meta data information embedded in the video being loaded.

Constructor

VideoLoad

public function VideoLoad (
request:*, completeWhenBuffered:Boolean = false)

Creates a new VideoLoad.
Parameters:
request :
A String or an URLRequest reference to the video you wish to load.
completeWhenBuffered:
If the load should be considered complete when buffered true, or when the video has completely loaded false; defaults to false.

Instance properties

buffer

public buffer:Percent
(read)

The percent the video has buffered.
Usage note:
  • VideoLoad will report 0 percent until two seconds of load time has elapsed.

buffered

public buffered:Boolean
(read)

Determines if the requested video has buffered true, or hasn't finished buffering false.

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.

metaData

public metaData:Object
(read)

The meta data information embedded in the video being loaded.

millisecondsUntilBuffered

public millisecondsUntilBuffered:int
(read)

The time remaining in milliseconds until the video has completely buffered.
Usage note:
  • VideoLoad will report -1 milliseconds until two seconds of load time has elapsed.

netConnection

public netConnection:NetConnection
(read)

The NetConnection class used by the VideoLoad class.

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:
  • destroy does 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: