Titanium.Media.AudioPlayer

Object of Titanium.Media.
Platform Since
Android 0.9
iPhone 0.9
iPad 0.9

Summary

The AudioPlayer object is returned by Titanium.Media.createAudioPlayer and is used for streaming audio to the device and low-level control of the audio playback.

Methods

Name Summary
addEventListener

Adds the specified callback as an event listener for the named event.

fireEvent

Fires a synthesized event to any registered listeners.

getAllowBackground

Gets the value of the allowBackground property. (Android only.)

getBitRate

Gets the value of the bitRate property.

getBufferSize

Gets the value of the bufferSize property. (iPhone, iPad only.)

getIdle

Gets the value of the idle property.

getPaused

Gets the value of the paused property.

getPlaying

Gets the value of the playing property.

getProgress

Gets the value of the progress property.

getState

Gets the value of the state property.

getUrl

Gets the value of the url property.

getWaiting

Gets the value of the waiting property.

pause

pause playback

removeEventListener

Removes the specified callback as an event listener for the named event.

setAllowBackground

Sets the value of the allowBackground property. (Android only.)

setBitRate

Sets the value of the bitRate property.

setBufferSize

Sets the value of the bufferSize property. (iPhone, iPad only.)

setIdle

Sets the value of the idle property.

setPaused

control the playback of the audio

setPlaying

Sets the value of the playing property.

setProgress

Sets the value of the progress property.

setState

Sets the value of the state property.

setUrl

change the url of the audio playback

setWaiting

Sets the value of the waiting property.

start

start playback

stateDescription

convert a state into a textual description suitable for display

stop

stop playback

Properties

Name Type Summary
STATE_BUFFERING Number

current playback is in the buffering from the network state read-only

STATE_INITIALIZED Number

current playback is in the initialization state read-only

STATE_PAUSED Number

current playback is in the paused state read-only

STATE_PLAYING Number

current playback is in the playing state read-only

STATE_STARTING Number

current playback is in the starting playback state read-only

STATE_STOPPED Number

current playback is in the stopped state read-only

STATE_STOPPING Number

current playback is in the stopping state read-only

STATE_WAITING_FOR_DATA Number

current playback is in the waiting for audio data from the network state read-only

STATE_WAITING_FOR_QUEUE Number

current playback is in the waiting for audio data to fill the queue state read-only

allowBackground Boolean

boolean to indicate if audio should continue playing even if Activity is paused (Android only.)

bitRate Number

bit rate of the current playback stream

bufferSize Number

the size of the buffer used for streaming, in bytes (iPhone, iPad only.)

idle Boolean

returns boolean indicating if the playback is idle

paused Boolean

returns boolean indicating if the playback is paused

playing Boolean

returns boolean indicating if the playback is streaming audio

progress Number

returns the current playback progress. Will return zero if sampleRate has not yet been detected

state Number

returns int for the current state of playback

url String

returns the url for the current playback

waiting Boolean

returns boolean indicating if the playback is waiting for audio data from the network

Events

Name Summary
change

fired when the state of the playback changes

progress

fired once per second with the current progress during playback