Package | com.brightcove.api.components |
Class | public class AudioPlayer |
Inheritance | AudioPlayer ![]() ![]() |
Method | Defined By | ||
---|---|---|---|
AudioPlayer(element:Object)
Constructor. | AudioPlayer | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = true):void [override]
Adds a listener for an event. | AudioPlayer | ||
cueMedia(id:Object, property:String = id):Boolean
Cues up an audio track without playing it. | AudioPlayer | ||
![]() | getAlpha():Number
Returns the alpha value of the component. | Component | |
![]() |
Returns the interface for the layout container of the element. | Component | |
Returns the current audio track DTO in the player. | AudioPlayer | ||
![]() | getDefinition():String
Returns the XML (BEML) definition of the component. | Component | |
![]() | getHeight():Number
Returns the pixel height of the component. | Component | |
![]() | getID():String
Returns the ID of the component, as defined in the XML. | Component | |
![]() | getIncludeInLayout():Boolean
Returns whether the component is included in layout calculations and rendering in parent layout box. | Component | |
![]() | getIndex():int
Returns the index of this element in its parent's elements array. | Component | |
getMediaBytesLoaded():Number
For progressively downloaded audio, returns the number of bytes currently loaded for the audio track. | AudioPlayer | ||
getMediaBytesTotal():Number
For progressively downloaded audio, returns the total number of bytes for the current audio track. | AudioPlayer | ||
getMediaDuration(format:Boolean = false):Object
Returns the time duration of the currently playing audio track in seconds. | AudioPlayer | ||
getMediaPosition(format:Boolean = false):Object
Returns the time position of the currently playing audio track in seconds. | AudioPlayer | ||
![]() | getNextSibling():Object
Returns the interface for the layout element that is the next sibling to this element in the parent containers's element array. | Component | |
![]() | getNodeName():String
Returns the node name of the element. | Component | |
![]() | getPreviousSibling():Object
Returns the interface for the layout element that is the previous sibling to this element in the parent containers's element array. | Component | |
getSoundSpectrum(fftMode:Boolean = true, stretchFactor:int = 0):ByteArray
ActionScript API only. | AudioPlayer | ||
![]() | getVisible():Boolean
Returns whether the component is visible. | Component | |
getVolume():Number
Returns the current volume for audio track playback in the player. | AudioPlayer | ||
![]() | getWidth():Number
Returns the pixel width of the component. | Component | |
![]() | getX(global:Boolean = false):Number
Returns the position of the component on the x axis. | Component | |
![]() | getY(global:Boolean = false):Number
Returns the position of the component on the y axis. | Component | |
isMuted():Boolean
Returns whether the audio player currently is muted. | AudioPlayer | ||
isPlaying():Boolean
Returns whether the current audio track is playing. | AudioPlayer | ||
loadMedia(id:Object, property:String = id):Boolean
Plays an audio track in the player. | AudioPlayer | ||
![]() | move(x:Number, y:Number, global:Boolean = false):void
Sets the x,y coordinates of the component. | Component | |
mute(mute:Boolean = true):void
Mutes or unmutes the sound in the player. | AudioPlayer | ||
pause(pause:Boolean = true):void
Pauses or resumes playback of the current audio track. | AudioPlayer | ||
play():void
Starts playback of the current track in the audio player. | AudioPlayer | ||
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void [override]
Removes a listener for an event. | AudioPlayer | ||
seek(time:Number):void
Seeks to a specified time position in the audio track. | AudioPlayer | ||
![]() | setAlpha(alpha:Number):void
Sets the alpha value of the component. | Component | |
![]() | setIncludeInLayout(includeInLayout:Boolean):void
Sets whether the component is included in layout calculations and rendering in parent layout box. | Component | |
![]() | setSize(width:Number, height:Number):void
Sets the pixel dimensions for the wrapped component. | Component | |
![]() | setVisible(visible:Boolean):void
Sets whether the component is visible. | Component | |
setVolume(volume:Number):void
Sets the volume for audio track playback in the player. | AudioPlayer | ||
stop():void
Stops playback of the current audio track, sending its position to the start. | AudioPlayer |
Method | Defined By | ||
---|---|---|---|
wrapEvent(event:Event):void
Wraps the internal player event with a wrapper event class. | AudioPlayer |
Event | Summary | Defined By | ||
---|---|---|---|---|
![]() | Dispatched when a UI element in the player is clicked. | Component | ||
![]() | Dispatched when a UI element in the player is rolled off. | Component | ||
![]() | Dispatched when a UI element in the player is rolled over. | Component | ||
Dispatched when media playback first begins. | AudioPlayer | |||
Dispatched when a buffering window begins for the current media, pausing playback. | AudioPlayer | |||
Dispatched when media finishes a buffering window. | AudioPlayer | |||
Dispatched when new media has been loaded or cued in the player. | AudioPlayer | |||
Dispatched when the current media completes. | AudioPlayer | |||
Dispatched when there is an error in loading the media. | AudioPlayer | |||
Dispatched when media's audio is muted or unmuted. | AudioPlayer | |||
Dispatched when media begins or resumes playback. | AudioPlayer | |||
Dispatched as media is played back. | AudioPlayer | |||
Dispatched when media is sent to a new position. | AudioPlayer | |||
Dispatched when media is paused or stopped. | AudioPlayer | |||
Dispatched when the volume in the player is changed. | AudioPlayer | |||
![]() | Dispatched when a property changes in a bindable component. | Component |
AudioPlayer | () | Constructor |
public function AudioPlayer(element:Object)
Constructor.
Parameterselement:Object — The layout element to wrap and delegate all calls to.
|
addEventListener | () | method |
override public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = true):void
Adds a listener for an event.
Parameters
type:String — AS3 docs.
| |
listener:Function — AS3 docs.
| |
useCapture:Boolean (default = false ) — AS3 docs.
| |
priority:int (default = 0 ) — AS3 docs.
| |
useWeakReference:Boolean (default = true ) — AS3 docs.
|
cueMedia | () | method |
public function cueMedia(id:Object, property:String = id):Boolean
Cues up an audio track without playing it. If the audio track is not already loaded into the player, it will be fetched from the server.
Parameters
id:Object — ID or referenceID of the audio track to be cued.
| |
property:String (default = id ) — the value passed as the first param is an ID or referenceID.
|
Boolean — True if the audio track DTO has already been loaded in the player, false if it needs to be fetched.
|
getCurrentMedia | () | method |
public function getCurrentMedia():AudioTrackDTO
Returns the current audio track DTO in the player.
ReturnsAudioTrackDTO — The current audio track DTO.
|
getMediaBytesLoaded | () | method |
public function getMediaBytesLoaded():Number
For progressively downloaded audio, returns the number of bytes currently loaded for the audio track. This can be used to offer the user feedback about download progress.
ReturnsNumber — The number of bytes downloaded to the client for the current audio track.
|
getMediaBytesTotal | () | method |
public function getMediaBytesTotal():Number
For progressively downloaded audio, returns the total number of bytes for the current audio track. This can be used to offer the user feedback about download progress.
ReturnsNumber — The total number of bytes for the current audio track.
|
getMediaDuration | () | method |
public function getMediaDuration(format:Boolean = false):Object
Returns the time duration of the currently playing audio track in seconds.
Parameters
format:Boolean (default = false ) — to return a formatted time string (12:34), false to return number of seconds.
|
Object — The time duration of the currently playing audio track in seconds, formatted as a string or a number.
|
getMediaPosition | () | method |
public function getMediaPosition(format:Boolean = false):Object
Returns the time position of the currently playing audio track in seconds.
Parameters
format:Boolean (default = false ) — to return a formatted time string (12:34), false to return number of seconds.
|
Object — The time position of the currently playing audio track in seconds, formatted as a string or a number.
|
getSoundSpectrum | () | method |
public function getSoundSpectrum(fftMode:Boolean = true, stretchFactor:int = 0):ByteArray
ActionScript API only. Computes the sound spectrum for the current sounds in the player and returns a ByteArray containing this data.
Parameters
fftMode:Boolean (default = true ) — Boolean value indicating whether a Fourier transformation is performed on the sound data first.
| |
stretchFactor:int (default = 0 ) — resolution of the sound samples.
|
ByteArray — A ByteArray of a fixed length of 512 containing the sound data, 256 for the left channel and and 256 for the right.
|
getVolume | () | method |
public function getVolume():Number
Returns the current volume for audio track playback in the player.
ReturnsNumber — The current volume level of the player.
|
isMuted | () | method |
public function isMuted():Boolean
Returns whether the audio player currently is muted.
ReturnsBoolean — True if the audio track is muted. False otherwise.
|
isPlaying | () | method |
public function isPlaying():Boolean
Returns whether the current audio track is playing.
ReturnsBoolean — True if the audio track is playing. False otherwise.
|
loadMedia | () | method |
public function loadMedia(id:Object, property:String = id):Boolean
Plays an audio track in the player. If the audio track is not already loaded into the player, it will be fetched from the server.
Parameters
id:Object — ID or referenceID of the audio track to be played.
| |
property:String (default = id ) — the value passed as the first param is an ID or referenceID.
|
Boolean — True if the audio track is in the player and playback is begun.
|
mute | () | method |
public function mute(mute:Boolean = true):void
Mutes or unmutes the sound in the player.
Parameters
mute:Boolean (default = true ) — to mute the player, false to unmute.
|
pause | () | method |
public function pause(pause:Boolean = true):void
Pauses or resumes playback of the current audio track.
Parameters
pause:Boolean (default = true ) — a true value will pause the audio track playback.
Passing a false value will resume playback.
|
play | () | method |
public function play():void
Starts playback of the current track in the audio player.
removeEventListener | () | method |
override public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener for an event.
Parameters
type:String — AS3 docs.
| |
listener:Function — AS3 docs.
| |
useCapture:Boolean (default = false ) — AS3 docs.
|
seek | () | method |
public function seek(time:Number):void
Seeks to a specified time position in the audio track.
Parameters
time:Number — time in seconds to seek to.
|
setVolume | () | method |
public function setVolume(volume:Number):void
Sets the volume for audio track playback in the player.
Parameters
volume:Number — number between 0 and 1 to specify volume level.
|
stop | () | method |
public function stop():void
Stops playback of the current audio track, sending its position to the start.
wrapEvent | () | method |
protected function wrapEvent(event:Event):void
Wraps the internal player event with a wrapper event class.
Parameters
event:Event — event.
|
mediaBegin | Event |
com.brightcove.api.events.MediaEvent
com.brightcove.api.events.MediaEvent.BEGIN
Dispatched when media playback first begins. This will only occur on initial playback, not on replay.
The MediaEvent.BEGIN constant defines the value of thetype
property of the event object for a
mediaBegin
event. BEGIN events are dispatched
when media playback first begins. This will only occur on
initial playback, not on replay.
mediaBufferBegin | Event |
com.brightcove.api.events.MediaEvent
com.brightcove.api.events.MediaEvent.BUFFER_BEGIN
Dispatched when a buffering window begins for the current media, pausing playback.
The MediaEvent.BUFFER_BEGIN constant defines the value of thetype
property of the event object for a
mediaBufferBegin
event. BUFFER_BEGIN events
are dispatched when a buffering window begins for the
current media, pausing playback.
mediaBufferComplete | Event |
com.brightcove.api.events.MediaEvent
com.brightcove.api.events.MediaEvent.BUFFER_COMPLETE
Dispatched when media finishes a buffering window.
The MediaEvent.BUFFER_COMPLETE constant defines the value of thetype
property of the event object for a
mediaBufferComplete
event. BUFFER_COMPLETE is
dispatched when media finishes a buffering window.
mediaChange | Event |
com.brightcove.api.events.MediaEvent
com.brightcove.api.events.MediaEvent.CHANGE
Dispatched when new media has been loaded or cued in the player.
The MediaEvent.CHANGE constant defines the value of thetype
property of the event object for a
mediaChange
event. CHANGE is dispatched when
new media has been loaded or cued in the player.
mediaComplete | Event |
com.brightcove.api.events.MediaEvent
com.brightcove.api.events.MediaEvent.COMPLETE
Dispatched when the current media completes. This only occurs on initial playback of media, not on replay.
The MediaEvent.COMPLETE constant defines the value of thetype
property of the event object for a
mediaComplete
event. COMPLETE events are
dispatched when the current media finishes. This only
occurs on initial playback of media, not on replay.
mediaError | Event |
com.brightcove.api.events.MediaEvent
com.brightcove.api.events.MediaEvent.ERROR
Dispatched when there is an error in loading the media.
The MediaEvent.ERROR constant defines the value of thetype
property of the event object for a
mediaError
event. ERROR is dispatched when
there is a problem connecting to or playing the current
media.
mediaMuteChange | Event |
com.brightcove.api.events.MediaEvent
com.brightcove.api.events.MediaEvent.MUTE_CHANGE
Dispatched when media's audio is muted or unmuted.
The MediaEvent.MUTE_CHANGE constant defines the value of thetype
property of the event object for a
mediaMuteChange
event. MUTE_CHANGE is
dispatched when media's audio is muted or unmuted.
mediaPlay | Event |
com.brightcove.api.events.MediaEvent
com.brightcove.api.events.MediaEvent.PLAY
Dispatched when media begins or resumes playback.
The MediaEvent.PLAY constant defines the value of thetype
property of the event object for a
mediaPlay
event. PLAY is dispatched when
media begins or resumes playback.
mediaProgress | Event |
com.brightcove.api.events.MediaEvent
com.brightcove.api.events.MediaEvent.PROGRESS
Dispatched as media is played back.
The MediaEvent.PROGRESS constant defines the value of thetype
property of the event object for a
mediaProgress
event. PROGRESS is dispatched
periodically while media is being played back.
mediaSeek | Event |
com.brightcove.api.events.MediaEvent
com.brightcove.api.events.MediaEvent.SEEK
Dispatched when media is sent to a new position.
The MediaEvent.SEEK constant defines the value of thetype
property of the event object for a
seek
event. SEEK is dispatched when media is
requested to be sent to a new position.
mediaStop | Event |
com.brightcove.api.events.MediaEvent
com.brightcove.api.events.MediaEvent.STOP
Dispatched when media is paused or stopped.
The MediaEvent.STOP constant defines the value of thetype
property of the event object for a
mediaStop
event. STOP events are dispatched
when media is paused or stopped.
mediaVolumeChange | Event |
com.brightcove.api.events.MediaEvent
com.brightcove.api.events.MediaEvent.VOLUME_CHANGE
Dispatched when the volume in the player is changed.
The MediaEvent.VOLUME_CHANGE constant defines the value of thetype
property of the event object for a
mediaVolumeChange
event. VOLUME_CHANGE is
dispatched when the volume in the player is changed.