Packagecv.interfaces
Interfacepublic interface IMediaPlayer extends flash.events.IEventDispatcher
ImplementorsImagePlayer, NetStreamPlayer, RTMPPlayer, SoundPlayer, TempoLite

Implement the IMediaPlayer interface to create a custom media player. A media player handles audio or video playback.



Public Properties
 PropertyDefined by
  autoStart : Boolean
Whether media will play automatically once loaded.
IMediaPlayer
  currentPercent : uint
[read-only] Gets the play progress percentage of the currently playing media file.
IMediaPlayer
  loadCurrent : uint
[read-only] Gets the number of bytes currently loaded.
IMediaPlayer
  loadTotal : uint
[read-only] Gets the total number of bytes for a given file being loaded.
IMediaPlayer
  metaData : Object
[read-only] Gets the meta data object of the current file if available.
IMediaPlayer
  paused : Boolean
[read-only] Gets the pause status of the media player.
IMediaPlayer
  status : String
[read-only] Gets the loading status of the media player.
IMediaPlayer
  timeCurrent : Number
[read-only] Gets the elapsed play time of the current file.
IMediaPlayer
  timeLeft : Number
[read-only] Gets the remaining play time of the current file.
IMediaPlayer
  timeTotal : Number
[read-only] Gets the total play time of the current file.
IMediaPlayer
  volume : Number
Gets or sets the volume of the media player.
IMediaPlayer
Public Methods
 MethodDefined by
  
isValid(ext:String, url:String):Boolean
Validates if the given filetype is compatible to be played with media player.
IMediaPlayer
  
load(item:*):void
Loads a new file to be played.
IMediaPlayer
  
pause(b:Boolean = true):void
Controls the pause of the audio
IMediaPlayer
  
play(pos:int = 0):void
Plays the media file, starting at the given position.
IMediaPlayer
  
seek(time:*):void
Seeks to time given in the media file.
IMediaPlayer
  
seekPercent(n:Number):void
Seeks to the given percent in the media file.
IMediaPlayer
  
stop():void
Stops the media file at the specified position.
IMediaPlayer
  
unload():void
Stops the media, closes out any connections, and resets the metadata.
IMediaPlayer
Property detail
autoStartproperty
autoStart:Boolean  [read-write]

Whether media will play automatically once loaded.

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

Gets the play progress percentage of the currently playing media file.

Implementation
    public function get currentPercent():uint
loadCurrentproperty 
loadCurrent:uint  [read-only]

Gets the number of bytes currently loaded.

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

Gets the total number of bytes for a given file being loaded.

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

Gets the meta data object of the current file if available.

Implementation
    public function get metaData():Object
pausedproperty 
paused:Boolean  [read-only]

Gets the pause status of the media player.

Implementation
    public function get paused():Boolean
statusproperty 
status:String  [read-only]

Gets the loading status of the media player.

Implementation
    public function get status():String
timeCurrentproperty 
timeCurrent:Number  [read-only]

Gets the elapsed play time of the current file.

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

Gets the remaining play time of the current file.

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

Gets the total play time of the current file.

Implementation
    public function get timeTotal():Number
volumeproperty 
volume:Number  [read-write]

Gets or sets the volume of the media player.

Implementation
    public function get volume():Number
    public function set volume(value:Number):void
Method detail
isValid()method
public function isValid(ext:String, url:String):Boolean

Validates if the given filetype is compatible to be played with media player.

Parameters
ext:String — The file extension to be validated
 
url:String — The full file url if the extension is not enough

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

Loads a new file to be played.

Parameters
item:* — The url of the file to be loaded

See also

cv.events.LoadEvent.LOAD_START
pause()method 
public function pause(b:Boolean = true):void

Controls the pause of the audio

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

Plays the media file, starting at the given position.

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

Seeks to time given in the media file.

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

Seeks to the given percent in the media file.

Parameters
n:Number — Percent to seek to
stop()method 
public function stop():void

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

unload()method 
public function unload():void

Stops the media, closes out any connections, and resets the metadata.