public class AlexaAudioPlayer
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
AlexaAudioPlayer.Callback
A callback to keep track of the state of the MediaPlayer and various AvsItem states
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
TAG |
Modifier and Type | Method and Description |
---|---|
void |
addCallback(AlexaAudioPlayer.Callback callback)
Add a callback to our AlexaAudioPlayer, this is added to our list of callbacks
|
static AlexaAudioPlayer |
getInstance(Context context)
Get a reference to the AlexaAudioPlayer instance, if it's null, we will create a new one
using the supplied context.
|
boolean |
isPlaying()
Check whether our MediaPlayer is currently playing
|
void |
pause()
A helper function to pause the MediaPlayer
|
void |
play()
A helper function to play the MediaPlayer
|
void |
playItem(AvsPlayContentItem item)
A helper function to play an AvsPlayContentItem, this is passed to play() and handled accordingly,
|
void |
playItem(AvsPlayRemoteItem item)
A helper function to play an AvsPlayRemoteItem, this is passed to play() and handled accordingly,
|
void |
playItem(AvsSpeakItem item)
A helper function to play an AvsSpeakItem, this is passed to play() and handled accordingly,
|
void |
release()
A helper function to release the media player and remove it from memory
|
void |
removeCallback(AlexaAudioPlayer.Callback callback)
Remove a callback from our AlexaAudioPlayer, this is removed from our list of callbacks
|
void |
stop()
A helper function to stop the MediaPlayer
|
public static final java.lang.String TAG
public static AlexaAudioPlayer getInstance(Context context)
context
- any context, we will get the application level to store locallypublic void addCallback(AlexaAudioPlayer.Callback callback)
callback
- Callback that listens to changes of player statepublic void removeCallback(AlexaAudioPlayer.Callback callback)
callback
- Callback that listens to changes of player statepublic void playItem(AvsPlayContentItem item)
item
- a speak type itempublic void playItem(AvsSpeakItem item)
item
- a speak type itempublic void playItem(AvsPlayRemoteItem item)
item
- a play type item, usually a urlpublic boolean isPlaying()
public void pause()
public void play()
public void stop()
public void release()