danger.audio
Class AudioManager

java.lang.Object
  extended by danger.audio.AudioManager


public class AudioManager
extends Object

The AudioManager class is the main factory for creating and playing audio objects.


Field Summary
static int DEBUG_GENERAL
          Debug level selector bits.
static int DEBUG_NONE
          Debug level selector bits.
static int DEBUG_PLAYABLE
          Debug level selector bits.
static int DEBUG_SEQUENCE
          Debug level selector bits.
static int DEBUG_SOUND
          Debug level selector bits.
static int DEBUG_STREAM
          Debug level selector bits.
static int DEBUG_SYSTEM
          Debug level selector bits.
static int EIGHTH_SECOND
          Time constants.
static int ENABLE_RUNTIME_EXCEPTIONS
          Player attribute for load: enable runtime exceptions during and after load
static int HALF_SECOND
          Time constants.
static int LOAD_ASYNCHRONOUSLY
          Player attribute for load: load asynchronously (default is synchronous)
static int MEDIA_ANY
          Media id used to query for any media playing.
static int MEDIA_NONE
          Media id used when no media is playing.
static int NOW
          Time constants.
static int ONE_SECOND
          Time constants.
static int QUARTER_SECOND
          Time constants.
 
Method Summary
static boolean areRuntimeExceptionsEnabled(PlayableAudio player)
          Query whether runtime exception handling is enabled for an object.
static boolean canCreateRecorder()
          If a Recorder can be created with createRecorder(), this will return true, otherwise false
static BufferedStream createBufferedStream()
          Create a new BufferedStream object.
static Recorder createRecorder()
          Create a new sound Recorder object.
static Sequence createSequence()
          Create a new Sequence object.
static Sequence createSequence(boolean autoDelete)
          Deprecated. As of 4.0, replaced by createSequence()
static Sequence createSequence(boolean autoDelete, int type)
          Deprecated. As of 4.0, replaced by createSequence()
static Sound createSound()
          Create a new Sound object.
static Sound createSound(boolean autoDelete)
          Deprecated. As of 4.0, replaced by createSound()
static Sound createSound(boolean autoDelete, int type)
          Deprecated. As of 4.0, replaced by createSound()
static Stream createStream()
          Create a new Stream object.
static Stream createStream(boolean autoDelete)
          Deprecated. As of 4.0, replaced by createStream()
static Stream createStream(boolean autoDelete, int type)
          Deprecated. As of 4.0, replaced by createStream()
static void enableRuntimeExceptions(PlayableAudio player, boolean enable)
          Enable/disable runtime exception handling for an object.
static int findCodecFromMimeType(String mimeType)
          Return Format.Type from passed in mime type String.
static String getCodecMimeType(int fileType)
          Deprecated. As of 4.5, replaced by getMimeType(int)
static int getCurrentAudioRoute()
          Get the current audio route
static int getDebugLevel()
          Get the current debugging level.
static int getFrameSnapshot(short[] left, short[] right)
          If startFrameSnapshot() has been called, and it returned true, then calls to getFrameSnapshot() will return a copy of the last audio buffer sent to the hardware.
static Bitmap getMediaStreamIcon(int id)
          Get the icon for the given media id.
static int getMediaStreamPlayerIDFromName(String name)
          Get the media id from the player name.
static String getMediaStreamPlayerName(int id)
          Get the name of the player from the media id.
static int getMediaStreamVolume(int id)
          Get the volume for the given stream.
static String getMimeType(int fileType)
          Return MIME type from passed in Format.Type.* which can be obtained from getFileType(byte []) Returns a null string if the FileType is not supported.
static int getMixerRate()
          returns sample rate of audio mixer
static int getRecordMonitorLevel()
          Get record monitor level
static int getTime()
          Get current tick in microseconds.
static int getTimePlusEighthSecond()
          Get current time plus a eighth second.
static int getTimePlusHalfSecond()
          Get current time plus a half second.
static int getTimePlusOneSecond()
          Get current time plus a second.
static int getTimePlusQuarterSecond()
          Get current time plus a quarter second.
static boolean includesDebugLevel(int level)
          Returns true if global debug level includes the specified level
static boolean isActive()
          returns true, if audio system is generating audio
static boolean isBuiltIn()
          test to see if audio system is built into rom
static boolean isMediaPlayerRegistered(Listener listener)
          Checks to see if the passed in listener is already registered.
static boolean isMediaStream(int id)
          Get the volume for the given stream.
static boolean isMediaStreamPlaying(int id)
          Returns true if the media stream with this id is playing.
static boolean isNetworkStreamingEnabled()
          See if network audio streaming is enabled.
static boolean isRecording()
          Are we recording?
static Object load(byte[] data)
          Given a byte stream, figure out what kind of audio file it is, if any, and load it.
static PlayableAudio load(byte[] data, int loadAttributes)
          Given a byte stream, figure out what kind of audio file it is, if any, and load it with the given attributes.
static Object load(File file)
          Given a File, figure out what kind of audio file it is, if any, and load it.
static PlayableAudio load(File file, boolean autoDelete)
          Deprecated. As of 4.0, replaced by load(File, int)
static PlayableAudio load(File file, int loadAttributes)
          Given a File, figure out what kind of audio file it is, if any, and load it with the given attributes.
static PlayableAudio load(URL url, int loadAttributes, Event callbackEvent)
          Given a URL, try and load it with the given attributes.
static Object play(byte[] data)
          Given a byte stream, figure out what kind of audio file it is, if any, and play it.
static Object play(File file)
          Given a File, figure out what kind of audio file it is, if any, and play it.
static PlayableAudio play(URL url)
          Given a URL, try to load and play it.
static void playDTMFTone(char toneKey, int signalLengthInMS, int gapBetweenSignalInMS, int volume)
          Play one DTMF tone synchronously.
static void playDTMFToneAsync(char toneKey, int signalLengthInMS, int gapBetweenSignalInMS, int volume)
          Play one DTMF tone asynchronously.
static void playDTMFToneString(String tones, int signalLengthInMS, int gapBetweenSignalInMS, int volume)
          Play DTMF tones synchronously.
static void playDTMFToneStringAsync(String tones, int signalLengthInMS, int gapBetweenSignalInMS, int volume)
          Play DTMF tones asynchronously.
static boolean recognize(File file)
          Given a File, return whether or not the file is recognized as audio.
static void registerForAudioEvents(Listener inListener)
          Register a Listener object to receive audio events.
static int registerMediaPlayer(Listener listener, String name, Bitmap icon)
          Register a media player to be controlled by the sound controls.
static void setDebugLevel(int level)
          Set the global debug level.
static void setMediaStreamVolume(int id, int volume)
          Set the volume for the given stream.
static void start(Object object, int filters)
          Start an audio object.
static boolean startFrameSnapshot()
          Turn on snapshot mode.
static void stop(Object object)
          Stop and destroy an audio object.
static void stopFrameSnapshot()
          Call after finished capturing audio snapshots.
static void testTone(boolean status)
          turn on/off a test tone.
static void testToneFrequency(int frequency)
          When the tone is enabled, play this frequency.
static void unregisterForAudioEvents(Listener inListener)
          Unregister a Listener object to receive audio events
static void unregisterMediaPlayer(int id)
          Unregister a media player.
static void vibrate(int inDuration)
          Turn on vibration for a period of time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENABLE_RUNTIME_EXCEPTIONS

public static final int ENABLE_RUNTIME_EXCEPTIONS
Player attribute for load: enable runtime exceptions during and after load

Since:
4.0
See Also:
Constant Field Values

LOAD_ASYNCHRONOUSLY

public static final int LOAD_ASYNCHRONOUSLY
Player attribute for load: load asynchronously (default is synchronous)

Since:
4.5
See Also:
Constant Field Values

NOW

public static final int NOW
Time constants. Special meaning to get current time.

See Also:
Constant Field Values

ONE_SECOND

public static final int ONE_SECOND
Time constants. One second.

See Also:
Constant Field Values

HALF_SECOND

public static final int HALF_SECOND
Time constants. Half a second.

See Also:
Constant Field Values

QUARTER_SECOND

public static final int QUARTER_SECOND
Time constants. Quarter second.

See Also:
Constant Field Values

EIGHTH_SECOND

public static final int EIGHTH_SECOND
Time constants. Eight a second.

See Also:
Constant Field Values

DEBUG_NONE

public static final int DEBUG_NONE
Debug level selector bits.

No debugging.

Used as or'd values for setDebugLevel(int).

Since:
3.0
See Also:
Constant Field Values

DEBUG_GENERAL

public static final int DEBUG_GENERAL
Debug level selector bits.

General-purpose debugging (backwards compat).

Used as or'd values for setDebugLevel(int).

Since:
3.0
See Also:
Constant Field Values

DEBUG_SYSTEM

public static final int DEBUG_SYSTEM
Debug level selector bits.

AudioManager and underlying audio system.

Used as or'd values for setDebugLevel(int).

Since:
3.0
See Also:
Constant Field Values

DEBUG_PLAYABLE

public static final int DEBUG_PLAYABLE
Debug level selector bits.

Functionality common to all Playables.

Used as or'd values for setDebugLevel(int).

Since:
3.0
See Also:
Constant Field Values

DEBUG_SOUND

public static final int DEBUG_SOUND
Debug level selector bits.

Show debugging for Sound.

Used as or'd values for setDebugLevel(int).

Since:
3.0
See Also:
Constant Field Values

DEBUG_STREAM

public static final int DEBUG_STREAM
Debug level selector bits.

Show debugging for Stream.

Used as or'd values for setDebugLevel(int).

Since:
3.0
See Also:
Constant Field Values

DEBUG_SEQUENCE

public static final int DEBUG_SEQUENCE
Debug level selector bits.

Show debugging for Sequence.

Used as or'd values for setDebugLevel(int).

Since:
3.0
See Also:
Constant Field Values

MEDIA_NONE

public static final int MEDIA_NONE
Media id used when no media is playing.

Since:
3.0
See Also:
Constant Field Values

MEDIA_ANY

public static final int MEDIA_ANY
Media id used to query for any media playing.

Since:
3.0
See Also:
Constant Field Values
Method Detail

isActive

public static boolean isActive()
returns true, if audio system is generating audio


isBuiltIn

public static boolean isBuiltIn()
test to see if audio system is built into rom


getMixerRate

public static int getMixerRate()
returns sample rate of audio mixer


setDebugLevel

public static void setDebugLevel(int level)
Set the global debug level. Bitwise OR bits together to get combined debugging information.

For example DEBUG_STREAM | DEBUG_SOUND will show Sound and Stream debugging related information.

Parameters:
level - bits OR'd together to get debugging information.

getDebugLevel

public static int getDebugLevel()
Get the current debugging level.

Returns:
int global debug level bits. 0 is no debugging information.

includesDebugLevel

public static boolean includesDebugLevel(int level)
Returns true if global debug level includes the specified level

Since:
3.0

vibrate

public static void vibrate(int inDuration)
Turn on vibration for a period of time.

Parameters:
inDuration - if > 0 then represents milliseconds, -1 is on, 0 is off.

playDTMFToneStringAsync

public static void playDTMFToneStringAsync(String tones,
                                           int signalLengthInMS,
                                           int gapBetweenSignalInMS,
                                           int volume)
Play DTMF tones asynchronously.

Parameters:
tones - a number string. ie. "4154491947"
signalLengthInMS - length in milliseconds of each tone.
gapBetweenSignalInMS - length in milliseconds of gap between each tone.
volume - 0 to 100 volume of tone.

playDTMFToneAsync

public static void playDTMFToneAsync(char toneKey,
                                     int signalLengthInMS,
                                     int gapBetweenSignalInMS,
                                     int volume)
Play one DTMF tone asynchronously.

Parameters:
toneKey - a number character. ie. '4'
signalLengthInMS - length in milliseconds of each tone.
gapBetweenSignalInMS - length in milliseconds of gap between each tone.
volume - 0 to 100 volume of tone.

playDTMFTone

public static void playDTMFTone(char toneKey,
                                int signalLengthInMS,
                                int gapBetweenSignalInMS,
                                int volume)
Play one DTMF tone synchronously.

Parameters:
toneKey - a number character. ie. '4'
signalLengthInMS - length in milliseconds of each tone.
gapBetweenSignalInMS - length in milliseconds of gap between each tone.
volume - 0 to 100 volume of tone.

playDTMFToneString

public static void playDTMFToneString(String tones,
                                      int signalLengthInMS,
                                      int gapBetweenSignalInMS,
                                      int volume)
Play DTMF tones synchronously.

Parameters:
tones - a number string. ie. "4154491947"
signalLengthInMS - length in milliseconds of each tone.
gapBetweenSignalInMS - length in milliseconds of gap between each tone.
volume - 0 to 100 volume of tone.

testToneFrequency

public static void testToneFrequency(int frequency)
When the tone is enabled, play this frequency. Only 1000 hz and 3000 hz are supported at the moment


testTone

public static void testTone(boolean status)
turn on/off a test tone. Takes over all audio


canCreateRecorder

public static boolean canCreateRecorder()
If a Recorder can be created with createRecorder(), this will return true, otherwise false


isRecording

public static boolean isRecording()
Are we recording?


getRecordMonitorLevel

public static int getRecordMonitorLevel()
Get record monitor level


createRecorder

public static Recorder createRecorder()
                               throws AudioException
Create a new sound Recorder object. Will throw an exception if not available.

Throws:
AudioException

createSequence

public static Sequence createSequence(boolean autoDelete,
                                      int type)
                               throws AudioException
Deprecated. As of 4.0, replaced by createSequence()

Create a new Sequence object. Will throw an exception if audio not available. autoDelete : true to garbage collect when the object has finished playing false to keep loaded. Do Sequence.destroy() prior to releasing last reference. type : UNKNOWN_SEQUENCE, UNKNOWN_SOUND, META these are used to mark the sequence so that when calling stopAll() you can specify the type of sound to stop.

Throws:
AudioException

createSequence

public static Sequence createSequence(boolean autoDelete)
                               throws AudioException
Deprecated. As of 4.0, replaced by createSequence()

Create a new Sequence object. Will throw an exception if audio not available. autoDelete : true to garbage collect when the object has finished playing false to keep loaded. Do Sequence.destroy() prior to releasing last reference.

Throws:
AudioException

createSequence

public static Sequence createSequence()
                               throws AudioException
Create a new Sequence object. Will throw an exception if audio not available.

Throws:
AudioException

createSound

public static Sound createSound(boolean autoDelete,
                                int type)
                         throws AudioException
Deprecated. As of 4.0, replaced by createSound()

Create a new Sound object. Will throw an exception if audio not available. autoDelete : true to garbage collect when the object has finished playing, false to keep loaded. Do Sound.destroy() prior to releasing last reference. type : UNKNOWN_SEQUENCE, UNKNOWN_SOUND, META these are used to mark the sound so that when calling stopAll() you can specify the type of sound to stop.

Throws:
AudioException

createSound

public static Sound createSound(boolean autoDelete)
                         throws AudioException
Deprecated. As of 4.0, replaced by createSound()

Create a new Sound object. Will throw an exception if audio not available. autoDelete : true to garbage collect when the object has finished playing, false to keep loaded. Do Sound.destroy() prior to releasing last reference. If you do not, you'll create a memory leak.

Throws:
AudioException

createSound

public static Sound createSound()
                         throws AudioException
Create a new Sound object. Will throw an exception if audio not available.

Throws:
AudioException

createStream

public static Stream createStream(boolean autoDelete,
                                  int type)
                           throws AudioException
Deprecated. As of 4.0, replaced by createStream()

Create a new Stream object. Will throw an exception if audio not available. autoDelete : true to garbage collect when the object has finished playing, false to keep loaded. Do Stream.destroy() prior to releasing last reference. type : UNKNOWN_SEQUENCE, UNKNOWN_SOUND, META these are used to mark the stream so that when calling stopAll() you can specify the type of sound to stop.

Throws:
AudioException

createStream

public static Stream createStream(boolean autoDelete)
                           throws AudioException
Deprecated. As of 4.0, replaced by createStream()

Create a new Stream object. Will throw an exception if audio not available. autoDelete : true to garbage collect when the object has finished playing, false to keep loaded. Do Stream.destroy() prior to releasing last reference. If you do not, you'll create a memory leak.

Throws:
AudioException

createStream

public static Stream createStream()
                           throws AudioException
Create a new Stream object. Will throw an exception if audio not available.

Throws:
AudioException

createBufferedStream

public static BufferedStream createBufferedStream()
                                           throws AudioException
Create a new BufferedStream object. Will throw an exception if audio not available.

Throws:
AudioException
Since:
4.5

enableRuntimeExceptions

public static void enableRuntimeExceptions(PlayableAudio player,
                                           boolean enable)
Enable/disable runtime exception handling for an object.

Since:
4.0

areRuntimeExceptionsEnabled

public static boolean areRuntimeExceptionsEnabled(PlayableAudio player)
Query whether runtime exception handling is enabled for an object.

Since:
4.0

registerForAudioEvents

public static void registerForAudioEvents(Listener inListener)
Register a Listener object to receive audio events. See EventType.EVENT_AUDIO. Multiple calls for the same listener will be ignored.

Parameters:
inListener - Listener to send events to.
Throws:
RuntimeException - if inListener is null

unregisterForAudioEvents

public static void unregisterForAudioEvents(Listener inListener)
Unregister a Listener object to receive audio events

Parameters:
inListener - Listener to remove
Throws:
RuntimeException - if inListener is null
IllegalArgumentException - if inListener is not currently registered

getCurrentAudioRoute

public static int getCurrentAudioRoute()
Get the current audio route


getCodecMimeType

public static String getCodecMimeType(int fileType)
Deprecated. As of 4.5, replaced by getMimeType(int)

Return MIME type from passed in Format.Type.* which can be obtained from getFileType(byte [])


getMimeType

public static String getMimeType(int fileType)
Return MIME type from passed in Format.Type.* which can be obtained from getFileType(byte []) Returns a null string if the FileType is not supported. NOTE: Return value may be changed in a future release from a null string to "application/unknown".

Since:
4.5

findCodecFromMimeType

public static int findCodecFromMimeType(String mimeType)
Return Format.Type from passed in mime type String. Returns Format.Type.UNKNOWN if mime is unrecognized.

Since:
4.0

startFrameSnapshot

public static boolean startFrameSnapshot()
Turn on snapshot mode. When called, if returns true, the every time you call getFrameSnapshot() you'll get a peek into the audio output bufffer. Call stopFrameSnapshot() to turn off mode.

NOTE: This is not frame accurate. This is used for display only.

Returns:
boolean true if started.

getFrameSnapshot

public static int getFrameSnapshot(short[] left,
                                   short[] right)
If startFrameSnapshot() has been called, and it returned true, then calls to getFrameSnapshot() will return a copy of the last audio buffer sent to the hardware.

Returns:
int number of frames captured.

stopFrameSnapshot

public static void stopFrameSnapshot()
Call after finished capturing audio snapshots.


getTime

public static int getTime()
Get current tick in microseconds.

One thousand microseconds equal 1 millisecond.

One thousand milliseconds equal 1 second.

Sixty seconds equal 1 minute.

Returns:
int audio tick in microseconds.

getTimePlusQuarterSecond

public static int getTimePlusQuarterSecond()
Get current time plus a quarter second.


getTimePlusHalfSecond

public static int getTimePlusHalfSecond()
Get current time plus a half second.


getTimePlusOneSecond

public static int getTimePlusOneSecond()
Get current time plus a second.


getTimePlusEighthSecond

public static int getTimePlusEighthSecond()
Get current time plus a eighth second.


load

public static Object load(byte[] data)
Given a byte stream, figure out what kind of audio file it is, if any, and load it. Currently Format.isTypeStreamable returns true for AMR and mp3. Returns an Object that is either a Sound, Stream or a Sequence, or NULL if invalid data. Use instanceof {Sound, Stream, Sequence} to figure out what type of object returned. If the media has loop points they will remain intact. Use Sequence.setLoops(0) or Sound.setSampleLoopPoints(0, 0) to clear the loop points.


load

public static Object load(File file)
Given a File, figure out what kind of audio file it is, if any, and load it. Currently Format.isTypeFileStreamable returns true for WAV, AIFF, AMR and mp3. Returns an Object that is either a Sound, Stream or a Sequence, or NULL if invalid data. Use instanceof {Sound,Stream,Sequence} to figure out what type of object returned. If the media has loop points they will remain intact. Use Sequence.setLoopCount(0) to disable the loop.


recognize

public static boolean recognize(File file)
Given a File, return whether or not the file is recognized as audio.


load

public static PlayableAudio load(File file,
                                 boolean autoDelete)
Deprecated. As of 4.0, replaced by load(File, int)

Given a File, figure out what kind of audio file it is, if any, and load it, with the ability to determine whether it is auto-deleted or not. Object is returned as PlayableAudio.


load

public static PlayableAudio load(File file,
                                 int loadAttributes)
                          throws PlayableMediaException
Given a File, figure out what kind of audio file it is, if any, and load it with the given attributes. This method will throw exceptions only if loadAttributes includes AudioManager.ENABLE_RUNTIME_EXCEPTIONS. Object is returned as PlayableAudio. Use instanceof {Sound,Stream,Sequence} to figure out what type of object was returned. This should only be necessary for Sequences. If the media has loop points they will remain intact. Use PlayableAudio.setLoopCount(0) to disable the loop.

Throws:
PlayableMediaException
Since:
4.0

load

public static PlayableAudio load(byte[] data,
                                 int loadAttributes)
                          throws PlayableMediaException
Given a byte stream, figure out what kind of audio file it is, if any, and load it with the given attributes. This method will throw exceptions only if loadAttributes includes AudioManager.ENABLE_RUNTIME_EXCEPTIONS. Currently Format.isTypeStreamable returns true for AMR and mp3. Object is returned as PlayableAudio. Use instanceof {Sound,Stream,Sequence} to figure out what type of object was returned. This should only be necessary for Sequences. If the media has loop points they will remain intact. Use PlayableAudio.setLoopCount(0) to disable the loop.

Throws:
PlayableMediaException
Since:
4.0

load

public static PlayableAudio load(URL url,
                                 int loadAttributes,
                                 Event callbackEvent)
                          throws URIException,
                                 IOException,
                                 HttpException,
                                 PlayableMediaException
Given a URL, try and load it with the given attributes. Throws exceptions only if loadAttributes includes ENABLE_RUNTIME_EXCEPTIONS. Loads synchronously unless loadAttributes includes LOAD_ASYNCHRONOUSLY. Will currently only load streamable audio objects BufferedStream. If loaded asynchronously, the Playable returned will not be ready to play until the callbackEvent is called with BufferedStream.Status.WHAT_LOADED, or PlayableMedia.isLoaded() returns true.

Parameters:
url - the URL to load.
loadAttributes - values may be or'd ENABLE_RUNTIME_EXCEPTIONS LOAD_ASYNCHRONOUSLY.
callbackEvent - sets the BufferedStream's statusCallbackEvent BufferedStream.setStatusCallbackEvent(danger.app.Event) - may be null.
Returns:
a PlayableAudio object (currently only BufferedStream is returned) or null.
Throws:
URIException
IOException
HttpException
PlayableMediaException
Since:
4.5

play

public static Object play(byte[] data)
Given a byte stream, figure out what kind of audio file it is, if any, and play it. Currently Format.isTypeStreamable returns true for AMR and mp3. Returns an Object that is either a Sound or a Sequence, or NULL if invalid data. Use instanceof {Sound, Stream, Sequence} to figure out what type of object returned. If the media has loop points they will remain intact. Use Sequence.setLoops(0) or Sound.setSampleLoopPoints(0, 0) to clear the loop points.


play

public static Object play(File file)
Given a File, figure out what kind of audio file it is, if any, and play it. Currently Format.isTypeFileStreamable returns true for WAV, AIFF, AMR and mp3. Returns an Object that is either a Sound or a Sequence, or NULL if invalid data. Use instanceof {Sound, Stream, Sequence} to figure out what type of object returned. If the media has loop points they will remain intact. Use Sequence.setLoops(0) or Sound.setSampleLoopPoints(0, 0) to clear the loop points.


play

public static PlayableAudio play(URL url)
Given a URL, try to load and play it. Note this is a synchronous play, because the load is synchronous, so it may take some time, up to one minute, to start playing.

Parameters:
url - the URL to load
Returns:
an Object that is a BufferedStream if successful, null if failure
Since:
4.5

start

public static void start(Object object,
                         int filters)
Start an audio object.

Parameters:
object - an object returned from play(byte[]) or load(byte[]).
filters - one or combined bits of ToneFilter.

stop

public static void stop(Object object)
Stop and destroy an audio object. This calls PlayableMedia.destroy() on the audio object. Since it calls destroy, you cannot make any additional calls on the object, and it should be nulled immediately upon return from this method.

Parameters:
object - an object returned from play(byte[]) or load(byte[]).

isNetworkStreamingEnabled

public static boolean isNetworkStreamingEnabled()
See if network audio streaming is enabled. This feature may be disabled, and may require an additional purchase to enable.

Returns:
true if enabled, or false otherwise.
Since:
4.5

registerMediaPlayer

public static int registerMediaPlayer(Listener listener,
                                      String name,
                                      Bitmap icon)
Register a media player to be controlled by the sound controls. If your media stream is currently playing, and the user clicks the sound control buttons, your listener will receive an EventType.EVENT_AUDIO_MEDIA_VOLUME_CHANGE_REQUESTED event. The what field of the event contains the media id. The data field of the event contains the new volume value. If a media player with this name is already registered, the listener or name parameter is null, or the media player cannot be created, an RuntimeException is thrown. If the media player cannot be created, and you have registered another media player, you can unregister that one and then register your new one.

Parameters:
listener - non-null; The target listener.
icon - null-ok; The icon to use in the sound controls.
Returns:
A unique id for the registered media player.
Since:
3.0

unregisterMediaPlayer

public static void unregisterMediaPlayer(int id)
Unregister a media player. If the media player ID is not valid, is not currently registered, or is currently playing, an RuntimeException is thrown. After unregistering, the media player ID is no longer valid.

Parameters:
id - The id of the media player.
Since:
4.0

setMediaStreamVolume

public static void setMediaStreamVolume(int id,
                                        int volume)
Set the volume for the given stream.

Parameters:
id - The id of the media stream
Since:
3.0

getMediaStreamVolume

public static int getMediaStreamVolume(int id)
Get the volume for the given stream.

Parameters:
id - The id of the media stream
Since:
3.0

isMediaStreamPlaying

public static boolean isMediaStreamPlaying(int id)
Returns true if the media stream with this id is playing.

Parameters:
id - The id of a media stream - Use MEDIA_ANY to see if any media streams are playing.
Returns:
true if this media stream is playing, or false otherwise.
Since:
3.0

getMediaStreamIcon

public static Bitmap getMediaStreamIcon(int id)
Get the icon for the given media id.

Parameters:
id - The id of a media stream.
Returns:
null-ok; The icon registered for the given media id.
Since:
3.0

getMediaStreamPlayerName

public static String getMediaStreamPlayerName(int id)
Get the name of the player from the media id.

Parameters:
id - The id of a media stream.
Returns:
The name of the currently playing media player.
Since:
3.0

getMediaStreamPlayerIDFromName

public static int getMediaStreamPlayerIDFromName(String name)
Get the media id from the player name.

Parameters:
name - the media player name
Returns:
the media stream id
Since:
3.0

isMediaStream

public static boolean isMediaStream(int id)
Get the volume for the given stream.

Parameters:
id - The id of the media stream
Since:
3.0

isMediaPlayerRegistered

public static boolean isMediaPlayerRegistered(Listener listener)
Checks to see if the passed in listener is already registered.

Parameters:
listener - active Listener.
Returns:
true if already registered, false if not.