Package | com.distriqt.extension.mediaplayer |
Interface | public interface MediaPlayerView extends flash.events.IEventDispatcher |
Property | Defined 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 |
Method | Defined 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 |
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 |
duration | property |
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.
public function get duration():Number
See also
position | property |
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.
public function get position():Number
See also
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.
ReturnsBoolean — 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)
|
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.
ReturnsBoolean |
play | () | method |
public function play():Boolean
Starts playback of the loaded media (or schedules it to play when the media is available).
ReturnsBoolean |
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 )
|
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)
|
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
|
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
|
Boolean — true 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.
ReturnsBoolean |
fullscreen:enter | Event |
com.distriqt.extension.mediaplayer.events.MediaPlayerEvent
com.distriqt.extension.mediaplayer.events.MediaPlayerEvent.FULLSCREEN_ENTER
Dispatched when the media player enters fullscreen
fullscreen:exit | Event |
com.distriqt.extension.mediaplayer.events.MediaPlayerEvent
com.distriqt.extension.mediaplayer.events.MediaPlayerEvent.FULLSCREEN_EXIT
Dispatched when the media player leaves fullscreen
mediaplayer:click | Event |
com.distriqt.extension.mediaplayer.events.MediaPlayerEvent
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 |
com.distriqt.extension.mediaplayer.events.MediaPlayerEvent
com.distriqt.extension.mediaplayer.events.MediaPlayerEvent.COMPLETE
Dispatched when the playback of the media is complete
mediaplayer:error | Event |
com.distriqt.extension.mediaplayer.events.MediaErrorEvent
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 |
com.distriqt.extension.mediaplayer.events.MediaPlayerEvent
com.distriqt.extension.mediaplayer.events.MediaPlayerEvent.LOADED
Dispatched when the player completed loading from the source
mediaplayer:loading | Event |
com.distriqt.extension.mediaplayer.events.MediaPlayerEvent
com.distriqt.extension.mediaplayer.events.MediaPlayerEvent.LOADING
Dispatched when the player commenced loading from the source
mediaplayer:paused | Event |
com.distriqt.extension.mediaplayer.events.MediaPlayerEvent
com.distriqt.extension.mediaplayer.events.MediaPlayerEvent.PAUSED
Dispatched when the media playback is paused
mediaplayer:playing | Event |
com.distriqt.extension.mediaplayer.events.MediaPlayerEvent
com.distriqt.extension.mediaplayer.events.MediaPlayerEvent.PLAYING
Dispatched when playback of the media begins
mediaplayer:progress | Event |
com.distriqt.extension.mediaplayer.events.MediaProgressEvent
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 |
com.distriqt.extension.mediaplayer.events.MediaPlayerEvent
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 |
com.distriqt.extension.mediaplayer.events.MediaPlayerEvent
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 |
com.distriqt.extension.mediaplayer.events.MediaPlayerEvent
com.distriqt.extension.mediaplayer.events.MediaPlayerEvent.STOPPED
Dispatched when the media playback is stopped