Alexa Auto SDK  4.3
Public Types | Public Member Functions | Static Public Attributes | List of all members
aace::alexa::AudioPlayer Class Reference

Public Types

using PlayerActivity = aace::alexa::PlayerActivity
 

Public Member Functions

virtual void playerActivityChanged (PlayerActivity state)
 
int64_t getPlayerPosition ()
 
int64_t getPlayerDuration ()
 
void setAsForegroundActivity ()
 

Static Public Attributes

static const int64_t TIME_UNKNOWN = -1
 

Detailed Description

AudioPlayer should be extended to handle audio output from the Engine.

The AudioPlayer MediaPlayer and Speaker will receive directives from the Engine to handle audio playback.

Note
Audio playback control operations such as on-platform button presses must be routed through the PlaybackController.
See also
AudioChannel
PlaybackController
TemplateRuntime::renderPlayerInfo()
Deprecated:
This platform interface is deprecated. Use the Alexa Auto Services Bridge (AASB) message broker to publish and subscribe to AASB messages instead.
See also
aace::core::MessageBroker

Member Typedef Documentation

◆ PlayerActivity

Alias the common PlayerActivity namespace.

Member Function Documentation

◆ playerActivityChanged()

virtual void aace::alexa::AudioPlayer::playerActivityChanged ( PlayerActivity  state)
inlinevirtual

Notifies the platform implementation of a change in audio playback state

Parameters
[in]stateThe new playback state

◆ getPlayerPosition()

int64_t aace::alexa::AudioPlayer::getPlayerPosition ( )

Returns the current playback position of the audio player. If the audio source is not playing, the most recent position played will be returned.

Returns
The audio player's playback position in milliseconds, or TIME_UNKNOWN if the current media position is unknown or invalid.

◆ getPlayerDuration()

int64_t aace::alexa::AudioPlayer::getPlayerDuration ( )

Returns the playback duration of the audio player.

Returns
The audio player's playback duration in milliseconds, or TIME_UNKNOWN if the current media duration is unknown or invalid.

◆ setAsForegroundActivity()

void aace::alexa::AudioPlayer::setAsForegroundActivity ( )

Sets the Alexa AudioPlayer interface as the foreground player the user sees on screen. This function is useful for scenarios in which the user played an AudioPlayer media source, then played a different Alexa-aware ExternalMediaPlayer media source, such as a deep-linked media app or a local media source, and then manually returned visual activity to the Alexa AudioPlayer GUI. Calling this function ensures the next VUI command or GUI interaction with the playback control buttons acts on the AudioPlayer source rather than the more recently played ExternalMediaPlayer source.

Note
The AudioPlayer had to be previously playing at least once during this Engine cycle in order for this function to make Alexa act on AudioPlayer.

Member Data Documentation

◆ TIME_UNKNOWN

const int64_t aace::alexa::AudioPlayer::TIME_UNKNOWN = -1
static

Used when audio time is unknown or indeterminate.


Alexa Auto SDK 4.3 - Copyright 2017-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0