![]() |
Alexa Auto SDK
2.0.0
|
Classes | |
enum | MediaError |
enum | MediaState |
enum | MutedState |
Public Member Functions | |
boolean | prepare (AudioStream stream, boolean repeating) |
boolean | prepare (String url, boolean repeating) |
boolean | play () |
boolean | stop () |
boolean | pause () |
boolean | resume () |
long | getPosition () |
boolean | setPosition (long position) |
long | getDuration () |
boolean | volumeChanged (float volume) |
boolean | mutedStateChanged (MutedState state) |
Static Public Attributes | |
static final long | TIME_UNKNOWN = -1 |
Protected Member Functions | |
final void | mediaError (MediaError type, String error) |
final void | mediaStateChanged (MediaState state) |
AudioOutput should be extended to play audio data provided by the Engine.
After returning true
from a playback-controlling method invocation from the Engine (i.e. play()
, pause()
, stop()
, resume()
), it is required that platform implementation notify the Engine of a playback state change by calling one of mediaStateChanged()
with the new MediaState
or mediaError()
with the MediaError
. The Engine expects no call to mediaStateChanged()
in response to an invocation for which the platform returned false
.
The platform implementation may call mediaError()
or mediaStateChanged()
with MediaState.BUFFERING
at any time during a playback operation to notify the Engine of an error or buffer underrun, respectvely. When the media player resumes playback after a buffer underrun, the platform implementation should call mediaStateChanged()
with MediaState.PLAYING
.
AudioOutput
platform implementation should be able to support the audio formats recommended by AVS for a familiar Alexa experience: https://developer.amazon.com/docs/alexa-voice-service/recommended-media-support.html boolean com.amazon.aace.audio.AudioOutput.prepare | ( | AudioStream | stream, |
boolean | repeating | ||
) |
Notifies the platform implementation to prepare for playback of an audio stream source. Audio data will be available to stream from the Engine via read()
. After returning true
, the Engine will call play()
to initiate audio playback.
stream | The audio stream to prepare |
repeating | true if the audio should repeat |
true
if the platform implementation successfully handled the call, else false
boolean com.amazon.aace.audio.AudioOutput.prepare | ( | String | url, |
boolean | repeating | ||
) |
Notifies the platform implementation to prepare for playback of a URL audio source. After returning true
, the Engine will call play()
to initiate audio playback.
url | The URL audio source to prepare |
repeating | true if the audio should repeat |
true
if the platform implementation successfully handled the call, else false
boolean com.amazon.aace.audio.AudioOutput.play | ( | ) |
Notifies the platform implementation to start playback of the current audio source. After returning true
, the platform implementation must call mediaStateChanged()
with MediaState.PLAYING
when the media player begins playing the audio or mediaError()
if an error occurs.
true
if the platform implementation successfully handled the call, else false
boolean com.amazon.aace.audio.AudioOutput.stop | ( | ) |
Notifies the platform implementation to stop playback of the current audio source. After returning true
, the platform implementation must call mediaStateChanged()
with MediaState.STOPPED
when the media player stops playing the audio or mediaError()
if an error occurs.
A subsequent call to play()
will be preceded by calls to prepare()
and setPosition()
.
true
if the platform implementation successfully handled the call, else false
boolean com.amazon.aace.audio.AudioOutput.pause | ( | ) |
Notifies the platform implementation to pause playback of the current audio source. After returning true
, the platform implementation must call mediaStateChanged()
with MediaState.STOPPED
when the media player pauses the audio or mediaError()
if an error occurs. A subsequent call to resume()
will not be preceded by calls to prepare()
and setPosition()
.
true
if the platform implementation successfully handled the call, else false
boolean com.amazon.aace.audio.AudioOutput.resume | ( | ) |
Notifies the platform implementation to resume playback of the current audio source. After returning true
, the platform implementation must call mediaStateChanged()
with MediaState.PLAYING
when the media player resumes the audio or mediaError()
if an error occurs.
true
if the platform implementation successfully handled the call, else false
long com.amazon.aace.audio.AudioOutput.getPosition | ( | ) |
Returns the current playback position of the platform media player. If the audio source is not playing, the most recent position played should be returned.
TIME_UNKNOWN
if the current media position is unknown or invalid. boolean com.amazon.aace.audio.AudioOutput.setPosition | ( | long | position | ) |
Notifies the platform implementation to set the playback position of the current audio source in the platform media player
position | The playback position in milliseconds to set in the platform media player |
true
if the platform implementation successfully handled the call, else false
long com.amazon.aace.audio.AudioOutput.getDuration | ( | ) |
Returns the duration of the current audio source. If the duration is unknown, then TIME_UNKNOWN
should be returned.
TIME_UNKNOWN
. boolean com.amazon.aace.audio.AudioOutput.volumeChanged | ( | float | volume | ) |
Notifies the platform implementation to set the volume of the output channel. The volume
value should be scaled to fit the needs of the platform.
[in] | volume | The volume to set on the output channel. volume is in the range [0,1]. |
true
if the platform implementation successfully handled the call, else false
boolean com.amazon.aace.audio.AudioOutput.mutedStateChanged | ( | MutedState | state | ) |
Notifies the platform implementation to apply a muted state has changed for the output channel
[in] | state | The muted state to apply to the output channel. MutedState::MUTED when the output channel be muted, MutedState::UNMUTED when unmuted |
true
if the platform implementation successfully handled the call, else false
|
protected |
Notifies the Engine of an error during audio playback
error | The error encountered by the platform media player during playback |
description | A description of the error |
|
protected |
Notifies the Engine of an audio playback state change in the platform implementation. Must be called when the platform media player transitions between stopped and playing states.
state | The new playback state of the platform media player |
|
static |
Used when audio time is unknown or indeterminate.
Alexa Auto SDK 2.0.0 - Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0