Packagecom.distriqt.extension.mediaplayer
Interfacepublic interface MediaPlayerView extends flash.events.IEventDispatcher



Public Properties
 PropertyDefined By
  duration : Number
[read-only] The duration of the media in seconds.
MediaPlayerView
  position : Number
[read-only] The current playback position of the media in seconds.
MediaPlayerView
Public Methods
 MethodDefined By
  
destroy():Boolean
Removes the player from the screen, stops any playback and destroys the player.
MediaPlayerView
  
load(path:String):Boolean
Once a player has been created you can change the loaded media by using this call, passing in the path to the new video.
MediaPlayerView
  
pause():Boolean
Pauses the playback in the media player.
MediaPlayerView
  
play():Boolean
Starts playback of the loaded media (or schedules it to play when the media is available).
MediaPlayerView
  
resize(x:int, y:int, width:int, height:int, autoScale:Boolean = false):Boolean
Resizes the current media player to the specified size and position
MediaPlayerView
  
seek(time:Number):Boolean
Seeks to the specified time in the media.
MediaPlayerView
  
setFullscreen(fullscreen:Boolean, animated:Boolean = true):Boolean
Makes the media player occupy the entire screen area.
MediaPlayerView
  
setVolume(volume:Number):Boolean
Set the volume of the player Supported iOS 8+ and Android
MediaPlayerView
  
stop():Boolean
Stops the playback in the media player.
MediaPlayerView
Events
 Event Summary Defined By
   Dispatched when the media player enters fullscreen MediaPlayerView
   Dispatched when the media player leaves fullscreen MediaPlayerView
   Dispatched when the user touches the media player.MediaPlayerView
   Dispatched when the playback of the media is complete MediaPlayerView
   A generic error occurred.MediaPlayerView
   Dispatched when the player completed loading from the source MediaPlayerView
   Dispatched when the player commenced loading from the source MediaPlayerView
   Dispatched when the media playback is paused MediaPlayerView
   Dispatched when playback of the media begins MediaPlayerView
   Progress event dispatched when the media is being played in the media player.MediaPlayerView
   Dispatched when the media player has been created and the specified media has been successfully loaded.MediaPlayerView
   Dispatched when a seek within the media is started.MediaPlayerView
   Dispatched when the media playback is stopped MediaPlayerView
Property Detail
durationproperty
duration:Number  [read-only]

The duration of the media in seconds.

Returns 0 if the media hasn't completed loading, if the player hasn't been created, or if there was an error loading the media. Refer to the READY event to determine when a media file has been loaded and the duration is valid.


Implementation
    public function get duration():Number

See also

positionproperty 
position:Number  [read-only]

The current playback position of the media in seconds.

Returns 0 if the media hasn't completed loading, if the player hasn't been created, or if there was an error loading the media. Refer to the READY event to determine when a media file has been loaded and the duration is valid.


Implementation
    public function get position():Number

See also

Method Detail
destroy()method
public function destroy():Boolean

Removes the player from the screen, stops any playback and destroys the player.

After calling this the player will no longer function.

Returns
Boolean — false if no player had been created
load()method 
public function load(path:String):Boolean

Once a player has been created you can change the loaded media by using this call, passing in the path to the new video.

Parameters

path:String — The path to the file to play (this should be the native path to a file)

Returns
Boolean — true if successfully changed and false if the player wasn't yet created.
pause()method 
public function pause():Boolean

Pauses the playback in the media player.

Returns
Boolean
play()method 
public function play():Boolean

Starts playback of the loaded media (or schedules it to play when the media is available).

Returns
Boolean
resize()method 
public function resize(x:int, y:int, width:int, height:int, autoScale:Boolean = false):Boolean

Resizes the current media player to the specified size and position

Parameters

x:int — The x pixel position of the media player
 
y:int — The y pixel position of the media player
 
width:int — The width of the media player
 
height:int — The height of the media player
 
autoScale:Boolean (default = false)

Returns
Boolean — true if the player was successfully resized, false if the player hasn't been created
seek()method 
public function seek(time:Number):Boolean

Seeks to the specified time in the media. The time must be less than the total duration of the media, otherwise nothing is done.

Parameters

time:Number — The time to seek to (seconds)

Returns
Boolean — true if the seek was started successfully, and false if there was an error
setFullscreen()method 
public function setFullscreen(fullscreen:Boolean, animated:Boolean = true):Boolean

Makes the media player occupy the entire screen area.

You can specify if the transition to fullscreen is to be animated by setting the animated parameter to true

Parameters

fullscreen:Boolean — Whether to enter or exit fullscreen display
 
animated:Boolean (default = true) — If true an animation is performed when switching modes

Returns
Boolean
setVolume()method 
public function setVolume(volume:Number):Boolean

Set the volume of the player

Supported iOS 8+ and Android

Parameters

volume:Number — The level of the volume in the range 0 - 1

Returns
Booleantrue if successful and false if the player hasn't been created or the operation is not supported
stop()method 
public function stop():Boolean

Stops the playback in the media player.

Returns
Boolean
Event Detail
fullscreen:enter Event
Event Object Type: com.distriqt.extension.mediaplayer.events.MediaPlayerEvent
MediaPlayerEvent.type property = com.distriqt.extension.mediaplayer.events.MediaPlayerEvent.FULLSCREEN_ENTER

Dispatched when the media player enters fullscreen

fullscreen:exit Event  
Event Object Type: com.distriqt.extension.mediaplayer.events.MediaPlayerEvent
MediaPlayerEvent.type property = com.distriqt.extension.mediaplayer.events.MediaPlayerEvent.FULLSCREEN_EXIT

Dispatched when the media player leaves fullscreen

mediaplayer:click Event  
Event Object Type: com.distriqt.extension.mediaplayer.events.MediaPlayerEvent
MediaPlayerEvent.type property = com.distriqt.extension.mediaplayer.events.MediaPlayerEvent.CLICK

Dispatched when the user touches the media player.

Note: iOS when in fullscreen mode will block these events. If you are looking to overlay a video and respond to click events we suggest using resize to size the player to the full screen size instead of using the fullscreen option.

mediaplayer:complete Event  
Event Object Type: com.distriqt.extension.mediaplayer.events.MediaPlayerEvent
MediaPlayerEvent.type property = com.distriqt.extension.mediaplayer.events.MediaPlayerEvent.COMPLETE

Dispatched when the playback of the media is complete

mediaplayer:error Event  
Event Object Type: com.distriqt.extension.mediaplayer.events.MediaErrorEvent
MediaErrorEvent.type property = com.distriqt.extension.mediaplayer.events.MediaErrorEvent.ERROR

A generic error occurred.

The code and description will contain more information about the error.

mediaplayer:loaded Event  
Event Object Type: com.distriqt.extension.mediaplayer.events.MediaPlayerEvent
MediaPlayerEvent.type property = com.distriqt.extension.mediaplayer.events.MediaPlayerEvent.LOADED

Dispatched when the player completed loading from the source
mediaplayer:loading Event  
Event Object Type: com.distriqt.extension.mediaplayer.events.MediaPlayerEvent
MediaPlayerEvent.type property = com.distriqt.extension.mediaplayer.events.MediaPlayerEvent.LOADING

Dispatched when the player commenced loading from the source
mediaplayer:paused Event  
Event Object Type: com.distriqt.extension.mediaplayer.events.MediaPlayerEvent
MediaPlayerEvent.type property = com.distriqt.extension.mediaplayer.events.MediaPlayerEvent.PAUSED

Dispatched when the media playback is paused

mediaplayer:playing Event  
Event Object Type: com.distriqt.extension.mediaplayer.events.MediaPlayerEvent
MediaPlayerEvent.type property = com.distriqt.extension.mediaplayer.events.MediaPlayerEvent.PLAYING

Dispatched when playback of the media begins

mediaplayer:progress Event  
Event Object Type: com.distriqt.extension.mediaplayer.events.MediaProgressEvent
MediaProgressEvent.type property = com.distriqt.extension.mediaplayer.events.MediaProgressEvent.PROGRESS

Progress event dispatched when the media is being played in the media player.

The event contains the current position and the total time of the media being played.

mediaplayer:ready Event  
Event Object Type: com.distriqt.extension.mediaplayer.events.MediaPlayerEvent
MediaPlayerEvent.type property = com.distriqt.extension.mediaplayer.events.MediaPlayerEvent.READY

Dispatched when the media player has been created and the specified media has been successfully loaded.

After this event, the player properties (such as duration) will be valid and you should be able to call play() to immediately start playback.

mediaplayer:seeking Event  
Event Object Type: com.distriqt.extension.mediaplayer.events.MediaPlayerEvent
MediaPlayerEvent.type property = com.distriqt.extension.mediaplayer.events.MediaPlayerEvent.SEEKING

Dispatched when a seek within the media is started.

The details of the event will contain either "forward" or "backward" indicating the direction of the seek being performed.

mediaplayer:stopped Event  
Event Object Type: com.distriqt.extension.mediaplayer.events.MediaPlayerEvent
MediaPlayerEvent.type property = com.distriqt.extension.mediaplayer.events.MediaPlayerEvent.STOPPED

Dispatched when the media playback is stopped