Packagecv.media
Classpublic class VideoManager
InheritanceVideoManager Inheritance flash.events.EventDispatcher
ImplementsIMediaManager

The VideoManager class is a facade for controlling loading, and playing of video, streaming video and M4A files within Flash. It intelligently handles pausing, mute and loading. Note: Sometimes playhead won't move on videos, this is because there is no metadata describing it's duration. If this occurs, there is no way to calculate how long a video is, so it stops the playhead from moving.

See also

cv.interfaces.IMediaManager


Public Properties
 PropertyDefined by
  autoScale : Boolean
Gets or sets whether the video object will be scaled to the metadata given for video dimensions.
VideoManager
  buffer : int
Gets or sets how long the VideoManager should buffer the video before playing, in seconds.
VideoManager
  currentPercent : uint
[read-only] Gets the current play progress in terms of percent
VideoManager
  isPause : Boolean
[read-only] If VideoManager is currently paused.
VideoManager
  isPlaying : Boolean
[read-only] If VideoManager is currently playing.
VideoManager
  loadCurrent : Number
[read-only] Gets the current load progress in terms of bytes
VideoManager
  loadTotal : Number
[read-only] Gets the total size to be loaded in terms of bytes
VideoManager
  metaData : Object
[read-only] Gets the metadata if available for the currently playing audio file
VideoManager
  objectEncoding : uint
Gets or sets the object encodeing for use with streaming servers.
VideoManager
  streamHost : String
Gets or sets the stream host url for use with streaming media.
VideoManager
  timeCurrent : Number
[read-only] Gets the elapsed play time in milliseconds
VideoManager
  timeLeft : Number
[read-only] Gets the remaining play time in milliseconds
VideoManager
  timeTotal : Number
[read-only] Gets the total play time in milliseconds
VideoManager
  video : Video
Gets or sets the reference to the display video object.
VideoManager
  volume : Number
Gets or sets the current volume, from 0 - 1
VideoManager
Public Methods
 MethodDefined by
  
VideoManager
  
isValid(str:String):Boolean
Validates if the given filetype is compatible to be played with VideoManager.
VideoManager
  
load(s:String):void
Loads a new file to be played.
VideoManager
  
mute(b:Boolean = true):void
Controls the mute of the media
VideoManager
  
pause(b:Boolean = true):void
Controls the pause of the media
VideoManager
  
play(pos:int = 0):void
Plays the media, starting at the given position.
VideoManager
  
seek(n:Number):void
Seeks to time given in the media.
VideoManager
  
seekPercent(n:Number):void
Seeks to the given percent in the media
VideoManager
  
stop(pos:int = 0):void
Stops the media at the specified position.
VideoManager
  
unLoad():void
Stops the media, closes the NetConnetion or NetStream, and resets the metadata.
VideoManager
Events
 EventSummaryDefined by
   Dispatched everytime a cuepoint in encountered VideoManager
   Dispatched when the media file has completed loading VideoManager
   Dispatched as a media file is loaded VideoManager
   Dispatched as a media file begins loading VideoManager
   Dispatched after VideoManager has begun loading the next item, also at the end of an item playing VideoManager
   Dispatched as a media file finishes playing VideoManager
   Dispatched as a media file is playing VideoManager
   Dispatched once as a media file first begins to play VideoManager
   Dispatched as metadata is receieved from the media playing VideoManager
Property detail
autoScaleproperty
autoScale:Boolean  [read-write]

Gets or sets whether the video object will be scaled to the metadata given for video dimensions.

Implementation
    public function get autoScale():Boolean
    public function set autoScale(value:Boolean):void
bufferproperty 
buffer:int  [read-write]

Gets or sets how long the VideoManager should buffer the video before playing, in seconds.

Implementation
    public function get buffer():int
    public function set buffer(value:int):void
currentPercentproperty 
currentPercent:uint  [read-only]

Gets the current play progress in terms of percent

Implementation
    public function get currentPercent():uint
isPauseproperty 
isPause:Boolean  [read-only]

If VideoManager is currently paused.

Implementation
    public function get isPause():Boolean
isPlayingproperty 
isPlaying:Boolean  [read-only]

If VideoManager is currently playing.

Implementation
    public function get isPlaying():Boolean
loadCurrentproperty 
loadCurrent:Number  [read-only]

Gets the current load progress in terms of bytes

Implementation
    public function get loadCurrent():Number
loadTotalproperty 
loadTotal:Number  [read-only]

Gets the total size to be loaded in terms of bytes

Implementation
    public function get loadTotal():Number
metaDataproperty 
metaData:Object  [read-only]

Gets the metadata if available for the currently playing audio file

Implementation
    public function get metaData():Object
objectEncodingproperty 
objectEncoding:uint  [read-write]

Gets or sets the object encodeing for use with streaming servers.

Implementation
    public function get objectEncoding():uint
    public function set objectEncoding(value:uint):void
streamHostproperty 
streamHost:String  [read-write]

Gets or sets the stream host url for use with streaming media.

Implementation
    public function get streamHost():String
    public function set streamHost(value:String):void
timeCurrentproperty 
timeCurrent:Number  [read-only]

Gets the elapsed play time in milliseconds

Implementation
    public function get timeCurrent():Number
timeLeftproperty 
timeLeft:Number  [read-only]

Gets the remaining play time in milliseconds

Implementation
    public function get timeLeft():Number
timeTotalproperty 
timeTotal:Number  [read-only]

Gets the total play time in milliseconds

Implementation
    public function get timeTotal():Number
videoproperty 
video:Video  [read-write]

Gets or sets the reference to the display video object.

Implementation
    public function get video():Video
    public function set video(value:Video):void
volumeproperty 
volume:Number  [read-write]

Gets or sets the current volume, from 0 - 1

Implementation
    public function get volume():Number
    public function set volume(value:Number):void
Constructor detail
VideoManager()constructor
public function VideoManager()
Method detail
isValid()method
public function isValid(str:String):Boolean

Validates if the given filetype is compatible to be played with VideoManager. The acceptable file types are :

Parameters
str:String — The file extension to be validated

Returns
Boolean — Boolean of whether the extension was valid or not.
load()method 
public function load(s:String):void

Loads a new file to be played.

Parameters
s:String — The url of the file to be loaded
mute()method 
public function mute(b:Boolean = true):void

Controls the mute of the media

Parameters
b:Boolean (default = true) — Whether to mute or not
pause()method 
public function pause(b:Boolean = true):void

Controls the pause of the media

Parameters
b:Boolean (default = true) — Whether to pause or not
play()method 
public function play(pos:int = 0):void

Plays the media, starting at the given position.

Parameters
pos:int (default = 0) — Position to play from
seek()method 
public function seek(n:Number):void

Seeks to time given in the media.

Parameters
n:Number — Seconds into the media to seek to
seekPercent()method 
public function seekPercent(n:Number):void

Seeks to the given percent in the media

Parameters
n:Number — Percent to seek to
stop()method 
public function stop(pos:int = 0):void

Stops the media at the specified position. Sets the position given as the pause position.

Parameters
pos:int (default = 0) — Position to stop at
unLoad()method 
public function unLoad():void

Stops the media, closes the NetConnetion or NetStream, and resets the metadata.

Event detail
cuePointevent 
Event object type: cv.events.CuePointEvent
CuePointEvent.type property = cv.events.CuePointEvent.CUE_POINT

Dispatched everytime a cuepoint in encountered

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

This event has the following properties:

PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
cuePointThe cue point object.
currentTargetThe object that is actively processing the event object with an event listener.
targetThe object that dispatched the event. The target is not always the object listening for the event. Use the currentTarget property to access the object that is listening for the event.
loadCompleteevent  
Event object type: flash.events.Event

Dispatched when the media file has completed loading

loadProgressevent  
Event object type: flash.events.ProgressEvent

Dispatched as a media file is loaded

loadStartevent  
Event object type: cv.LoadEvent

Dispatched as a media file begins loading

nextevent  
Event object type: flash.events.Event

Dispatched after VideoManager has begun loading the next item, also at the end of an item playing

playCompleteevent  
Event object type: flash.events.Event

Dispatched as a media file finishes playing

playProgressevent  
Event object type: cv.events.PlayProgressEvent
PlayProgressEvent.type property = cv.events.PlayProgressEvent.PLAY_PROGRESS

Dispatched as a media file is playing

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

This event has the following properties:

PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
percentThe percentage of progress for the media playing.
elapsedThe elapsed time of the media playing.
remainThe remaining time of the media playing.
totalThe total time of the media playing.
currentTargetThe object that is actively processing the event object with an event listener.
targetThe object that dispatched the event. The target is not always the object listening for the event. Use the currentTarget property to access the object that is listening for the event.
playStartevent  
Event object type: flash.events.Event

Dispatched once as a media file first begins to play

videoMetadataevent  
Event object type: cv.events.MetaDataEvent
MetaDataEvent.type property = cv.events.MetaDataEvent.VIDEO_METADATA

Dispatched as metadata is receieved from the media playing

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

This event has the following properties:

PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
dataThe metadata object.
currentTargetThe object that is actively processing the event object with an event listener.
targetThe object that dispatched the event. The target is not always the object listening for the event. Use the currentTarget property to access the object that is listening for the event.