Packagecom.distriqt.extension.mediaplayer
Classpublic final class MediaPlayer
InheritanceMediaPlayer Inheritance com.distriqt.extension.mediaplayer._MediaPlayerLegacy

This class represents the MediaPlayer extension. This extension requires AIR 4.0 +



Public Properties
 PropertyDefined By
  implementation : String
[read-only] The implementation currently in use.
MediaPlayer
  isOtherAudioPlaying : Boolean
[read-only] A Boolean value that indicates whether another app is playing audio.
MediaPlayer
  isSupported : Boolean
[static] [read-only] Whether the current device supports the extensions functionality
MediaPlayer
  nativeVersion : String
[read-only] The native version string of the native extension.
MediaPlayer
  remoteCommandCenter : RemoteCommandCenter
[read-only] Access to the remote command center functionality
MediaPlayer
  service : MediaPlayer
[static] [read-only] The singleton instance of the MediaPlayer class.
MediaPlayer
  soundPool : SoundPool
[read-only] Access the sound pool to playback sound effects
MediaPlayer
  systemControl : SystemControl
[read-only]
MediaPlayer
  utils : MediaUtils
[read-only] Access to the media utilies
MediaPlayer
  version : String
[read-only] The version of this extension.
MediaPlayer
Public Methods
 MethodDefined By
  
Constructor You should not call this directly, but instead use the singleton access
MediaPlayer
  
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
[override]
MediaPlayer
  
Create an instance of an AudioPlayer using the specified options.
MediaPlayer
  
Create an instance of a MediaPlayerView using the specified options.
MediaPlayer
  
dispose():void
Disposes the extension and releases any allocated resources.
MediaPlayer
  
init(key:String):void
Deprecated: You no longer need to use an application key
[static] Initialises the extension class for use with the provided key.
MediaPlayer
  
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
[override]
MediaPlayer
Public Constants
 ConstantDefined By
  CONTROLS_BASIC : String = controls:basic
Deprecated: Please Use MediaPlayerOptions.CONTROLS_BASIC
[static] Basic controls are displayed.
MediaPlayer
  CONTROLS_EMBEDDED : String = controls:embedded
[static] Controls for an embedded view are displayed.
MediaPlayer
  CONTROLS_FULLSCREEN : String = controls:fullscreen
[static] Controls for fullscreen playback are displayed.
MediaPlayer
  CONTROLS_NONE : String = controls:none
Deprecated: Please Use MediaPlayerOptions.CONTROLS_NONE
[static] No controls are displayed.
MediaPlayer
  EXT_CONTEXT_ID : String = com.distriqt.MediaPlayer
[static]
MediaPlayer
  VERSION : String = 5.0.0
[static]
MediaPlayer
Property Detail
implementationproperty
implementation:String  [read-only]

The implementation currently in use. This should be one of the following depending on the platform in use and the functionality supported by this extension:


Implementation
    public function get implementation():String
isOtherAudioPlayingproperty 
isOtherAudioPlaying:Boolean  [read-only]

A Boolean value that indicates whether another app is playing audio. Useful to check if another service is playing music in the background.


Implementation
    public function get isOtherAudioPlaying():Boolean
isSupportedproperty 
isSupported:Boolean  [read-only]

Whether the current device supports the extensions functionality


Implementation
    public static function get isSupported():Boolean
nativeVersionproperty 
nativeVersion:String  [read-only]

The native version string of the native extension.


Implementation
    public function get nativeVersion():String
remoteCommandCenterproperty 
remoteCommandCenter:RemoteCommandCenter  [read-only]

Access to the remote command center functionality


Implementation
    public function get remoteCommandCenter():RemoteCommandCenter
serviceproperty 
service:MediaPlayer  [read-only]

The singleton instance of the MediaPlayer class.


Implementation
    public static function get service():MediaPlayer

Throws
Error — If there was a problem creating or accessing the extension, or if the developer key is invalid
soundPoolproperty 
soundPool:SoundPool  [read-only]

Access the sound pool to playback sound effects


Implementation
    public function get soundPool():SoundPool
systemControlproperty 
systemControl:SystemControl  [read-only]


Implementation
    public function get systemControl():SystemControl
utilsproperty 
utils:MediaUtils  [read-only]

Access to the media utilies


Implementation
    public function get utils():MediaUtils
versionproperty 
version:String  [read-only]

The version of this extension.

This should be of the format, MAJOR.MINOR.BUILD


Implementation
    public function get version():String
Constructor Detail
MediaPlayer()Constructor
public function MediaPlayer()

Constructor You should not call this directly, but instead use the singleton access

Method Detail
addEventListener()method
override public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void

Parameters

type:String
 
listener:Function
 
useCapture:Boolean (default = false)
 
priority:int (default = 0)
 
useWeakReference:Boolean (default = false)

createAudioPlayer()method 
public function createAudioPlayer(options:AudioPlayerOptions = null):AudioPlayer

Create an instance of an AudioPlayer using the specified options. The player can be used to load and playback audio files.

Parameters

options:AudioPlayerOptions (default = null) — Options for the audio player or null to use the default options

Returns
AudioPlayer — An AudioPlayer instance for audio playback
createPlayerView()method 
public function createPlayerView(options:MediaPlayerOptions = null):MediaPlayerView

Create an instance of a MediaPlayerView using the specified options. The player can be used to show video files in a view.

Parameters

options:MediaPlayerOptions (default = null) — Options for the media player view or null to use the default options

Returns
MediaPlayerView — A MediaPlayerView view instance for video playback
dispose()method 
public function dispose():void

Disposes the extension and releases any allocated resources. Once this function has been called, a call to init is neccesary again before any of the extensions functionality will work.

init()method 
public static function init(key:String):void
Deprecated: You no longer need to use an application key

Initialises the extension class for use with the provided key.

Parameters

key:String


Throws
Error — If there was a problem creating or accessing the extension, or if the key is invalid
removeEventListener()method 
override public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void

Parameters

type:String
 
listener:Function
 
useCapture:Boolean (default = false)

Constant Detail
CONTROLS_BASICConstant
public static const CONTROLS_BASIC:String = controls:basic
Deprecated: Please Use MediaPlayerOptions.CONTROLS_BASIC

Basic controls are displayed. The controls include a start/pause button and a scrubber bar.

Android only: on iOS this displays the same as CONTROLS_EMBEDDED

See also

CONTROLS_EMBEDDEDConstant 
public static const CONTROLS_EMBEDDED:String = controls:embedded
Deprecated: Please Use MediaPlayerOptions.CONTROLS_EMBEDDED

Controls for an embedded view are displayed. The controls include a start/pause button, a scrubber bar, and a button for toggling between fullscreen and embedded display modes.

CONTROLS_FULLSCREENConstant 
public static const CONTROLS_FULLSCREEN:String = controls:fullscreen
Deprecated: Please Use MediaPlayerOptions.CONTROLS_FULLSCREEN

Controls for fullscreen playback are displayed. The controls include a start/pause button, a scrubber bar, forward and reverse seeking buttons, a button for toggling between fullscreen and embedded display modes, a button for toggling the aspect fill mode, and a Done button. Tapping the done button pauses the video and exits fullscreen mode.

CONTROLS_NONEConstant 
public static const CONTROLS_NONE:String = controls:none
Deprecated: Please Use MediaPlayerOptions.CONTROLS_NONE

No controls are displayed.

EXT_CONTEXT_IDConstant 
public static const EXT_CONTEXT_ID:String = com.distriqt.MediaPlayer

VERSIONConstant 
public static const VERSION:String = 5.0.0