![]() |
Alexa Auto SDK
2.0.0
|
Public Types | |
enum | MutedState { MutedState::MUTED, MutedState::UNMUTED } |
using | MediaState = aace::audio::AudioOutputEngineInterface::MediaState |
using | MediaError = aace::audio::AudioOutputEngineInterface::MediaError |
Public Member Functions | |
virtual bool | prepare (std::shared_ptr< AudioStream > stream, bool repeating)=0 |
virtual bool | prepare (const std::string &url, bool repeating)=0 |
virtual bool | play ()=0 |
virtual bool | stop ()=0 |
virtual bool | pause ()=0 |
virtual bool | resume ()=0 |
virtual int64_t | getPosition ()=0 |
virtual bool | setPosition (int64_t position)=0 |
virtual int64_t | getDuration ()=0 |
virtual bool | volumeChanged (float volume)=0 |
virtual bool | mutedStateChanged (MutedState state)=0 |
void | mediaStateChanged (MediaState state) |
void | mediaError (MediaError error, const std::string &description="") |
Static Public Attributes | |
static const int64_t | TIME_UNKNOWN = -1 |
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 using aace::audio::AudioOutput::MediaState = aace::audio::AudioOutputEngineInterface::MediaState |
Describes the playback state of the platform media player
aace::alexa::MediaPlayerEngineInterface::MediaState
using aace::audio::AudioOutput::MediaError = aace::audio::AudioOutputEngineInterface::MediaError |
Describes an error during a media playback operation
aace::alexa::MediaPlayerEngineInterface::MediaError
|
strong |
|
pure virtual |
Notifies the platform implementation to prepare for playback of an AudioStream
audio source. After returning true
, the Engine will call play()
to initiate audio playback.
[in] | stream | The AudioStream object that provides the platform implementation audio data to play. |
[in] | repeating | true if the platform should loop the audio when playing. |
true
if the platform implementation successfully handled the call, else false
|
pure virtual |
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.
[in] | url | The URL audio source to set in the platform media player |
[in] | repeating | true if the platform should loop the audio when playing. |
true
if the platform implementation successfully handled the call, else false
|
pure virtual |
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
|
pure virtual |
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 immediately if it is already stopped, 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
|
pure virtual |
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
|
pure virtual |
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
|
pure virtual |
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.
|
pure virtual |
Notifies the platform implementation to set the playback position of the current audio source in the platform media player.
[in] | position | The playback position in milliseconds to set in the platform media player |
true
if the platform implementation successfully handled the call, else false
|
pure virtual |
Returns the duration of the current audio source. If the duration is unknown, then TIME_UNKNOWN
should be returned.
TIME_UNKNOWN
.
|
pure virtual |
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
|
pure virtual |
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
void aace::audio::AudioOutput::mediaStateChanged | ( | MediaState | state | ) |
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.
[in] | state | The new playback state of the platform media player |
void aace::audio::AudioOutput::mediaError | ( | MediaError | error, |
const std::string & | description = "" |
||
) |
Notifies the Engine of an error during audio playback
[in] | error | The error encountered by the platform media player during playback |
[in] | description | A description of the error |
|
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