Alexa Auto SDK  4.3
Classes | Public Types | Public Member Functions | List of all members
aace::alexa::ExternalMediaAdapter Class Referenceabstract

Classes

class  AuthorizedPlayerInfo
 
class  ExternalMediaAdapterState
 
class  PlaybackState
 
class  SessionState
 

Public Types

enum  PlayControlType {
  PlayControlType::PAUSE,
  PlayControlType::RESUME,
  PlayControlType::STOP,
  PlayControlType::NEXT,
  PlayControlType::PREVIOUS,
  PlayControlType::START_OVER,
  PlayControlType::FAST_FORWARD,
  PlayControlType::REWIND,
  PlayControlType::ENABLE_REPEAT_ONE,
  PlayControlType::ENABLE_REPEAT,
  PlayControlType::DISABLE_REPEAT,
  PlayControlType::ENABLE_SHUFFLE,
  PlayControlType::DISABLE_SHUFFLE,
  PlayControlType::FAVORITE,
  PlayControlType::UNFAVORITE
}
 
enum  SupportedPlaybackOperation {
  SupportedPlaybackOperation::PLAY,
  SupportedPlaybackOperation::PAUSE,
  SupportedPlaybackOperation::STOP,
  SupportedPlaybackOperation::NEXT,
  SupportedPlaybackOperation::PREVIOUS,
  SupportedPlaybackOperation::START_OVER,
  SupportedPlaybackOperation::FAST_FORWARD,
  SupportedPlaybackOperation::REWIND,
  SupportedPlaybackOperation::ENABLE_REPEAT,
  SupportedPlaybackOperation::ENABLE_REPEAT_ONE,
  SupportedPlaybackOperation::DISABLE_REPEAT,
  SupportedPlaybackOperation::ENABLE_SHUFFLE,
  SupportedPlaybackOperation::DISABLE_SHUFFLE,
  SupportedPlaybackOperation::FAVORITE,
  SupportedPlaybackOperation::UNFAVORITE,
  SupportedPlaybackOperation::SEEK,
  SupportedPlaybackOperation::ADJUST_SEEK
}
 
enum  Favorites {
  Favorites::FAVORITED,
  Favorites::UNFAVORITED,
  Favorites::NOT_RATED
}
 
enum  MediaType {
  MediaType::TRACK,
  MediaType::PODCAST,
  MediaType::STATION,
  MediaType::AD,
  MediaType::SAMPLE,
  MediaType::OTHER
}
 
enum  Navigation {
  Navigation::DEFAULT,
  Navigation::NONE,
  Navigation::FOREGROUND
}
 

Public Member Functions

virtual bool login (const std::string &localPlayerId, const std::string &accessToken, const std::string &userName, bool forceLogin, std::chrono::milliseconds tokenRefreshInterval)=0
 
virtual bool logout (const std::string &localPlayerId)=0
 
virtual bool play (const std::string &localPlayerId, const std::string &playContextToken, int64_t index, std::chrono::milliseconds offset, bool preload, Navigation navigation)=0
 
virtual bool play (const std::string &localPlayerId, const std::string &playContextToken, int64_t index, std::chrono::milliseconds offset, bool preload, Navigation navigation, const std::string &playbackSessionId, const std::string &skillToken)
 
virtual bool playControl (const std::string &localPlayerId, PlayControlType controlType)=0
 
virtual bool seek (const std::string &localPlayerId, std::chrono::milliseconds offset)=0
 
virtual bool adjustSeek (const std::string &localPlayerId, std::chrono::milliseconds deltaOffset)=0
 
virtual bool authorize (const std::vector< AuthorizedPlayerInfo > &authorizedPlayers)=0
 
virtual std::chrono::milliseconds getOffset (const std::string &localPlayerId)
 
virtual bool getState (const std::string &localPlayerId, ExternalMediaAdapterState &state)=0
 
virtual bool volumeChanged (float volume)=0
 
virtual bool mutedStateChanged (MutedState state)=0
 
void reportDiscoveredPlayers (const std::vector< DiscoveredPlayerInfo > &discoveredPlayers)
 
void requestToken (const std::string &localPlayerId)
 
void loginComplete (const std::string &localPlayerId)
 
void logoutComplete (const std::string &localPlayerId)
 
void playerEvent (const std::string &localPlayerId, const std::string &eventName)
 
void playerError (const std::string &localPlayerId, const std::string &errorName, long code, const std::string &description, bool fatal)
 
void setFocus (const std::string &localPlayerId)
 

Detailed Description

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 Enumeration Documentation

◆ PlayControlType

Describes the playback control type

Enumerator
PAUSE 

pause playback

RESUME 

resume playback

STOP 

stop the player

NEXT 

next song

PREVIOUS 

previous playback

START_OVER 

start playback over

FAST_FORWARD 

fast forward external media described time

REWIND 

rewind external media described time

ENABLE_REPEAT_ONE 

enable repeat current song

ENABLE_REPEAT 

enable playlist looping

DISABLE_REPEAT 

disable playlist looping

ENABLE_SHUFFLE 

enable playlist shuffling

DISABLE_SHUFFLE 

disable playlist shuffling

FAVORITE 

favorite song

UNFAVORITE 

unfavorite song

◆ SupportedPlaybackOperation

Supported playback control types reportable by the external media player app

Enumerator
PLAY 

Play is supported (voice only)

PAUSE 

Pause is supported

STOP 

Stop is supported

NEXT 

Next is supported

PREVIOUS 

Previous is supported

START_OVER 

Start Over is supported

FAST_FORWARD 

Fast Forward is supported

REWIND 

Rewind is supported

ENABLE_REPEAT 

Enable Repeat is supported

ENABLE_REPEAT_ONE 

Enable Repeat One is supported

DISABLE_REPEAT 

Disable Repeat is supported

ENABLE_SHUFFLE 

Enable Shuffle is supported

DISABLE_SHUFFLE 

Disable Shuffle is supported

FAVORITE 

Favorite is supported

UNFAVORITE 

Unfavorite is supported

SEEK 

Seek is supported

ADJUST_SEEK 

Adjust Seek is supported

◆ Favorites

Favorites song status

Enumerator
FAVORITED 

song is favorited

UNFAVORITED 

song is unfavorited

NOT_RATED 

song is not rated

◆ MediaType

Type of the current media source

Enumerator
TRACK 

A single song source

PODCAST 

A podcast source

STATION 

A station source

AD 

An advertisement source

SAMPLE 

A sample source

OTHER 

A miscellaneous source

◆ Navigation

Type of navigation when external media player app is first invoked via AVS

Enumerator
DEFAULT 

Source dependant behavior

NONE 

No navigation should occur

FOREGROUND 

External app should take foreground

Member Function Documentation

◆ login()

virtual bool aace::alexa::ExternalMediaAdapter::login ( const std::string &  localPlayerId,
const std::string &  accessToken,
const std::string &  userName,
bool  forceLogin,
std::chrono::milliseconds  tokenRefreshInterval 
)
pure virtual

Directive called after a discovered player initiates the loginComplete event.

Parameters
[in]localPlayerIdThe opaque token that uniquely identifies the local external player app
[in]accessTokenThe handshake token between AVS, and the external media player app session
[in]userNameThe username provided by the external media player app, if available
[in]forceLoginTrue if no handshake is needed, and login is simply assumed
[in]tokenRefreshIntervalrefresh interval of the accessToken, if available
Returns
true if the platform implementation successfully handled the call, else false

◆ logout()

virtual bool aace::alexa::ExternalMediaAdapter::logout ( const std::string &  localPlayerId)
pure virtual

Directive called after a discovered player initiates the logoutComplete event.

Parameters
[in]localPlayerIdThe opaque token that uniquely identifies the local external player app
Returns
true if the platform implementation successfully handled the call, else false

◆ play() [1/2]

virtual bool aace::alexa::ExternalMediaAdapter::play ( const std::string &  localPlayerId,
const std::string &  playContextToken,
int64_t  index,
std::chrono::milliseconds  offset,
bool  preload,
Navigation  navigation 
)
pure virtual

Called when the user first calls play for the external media via voice control.

Parameters
[in]localPlayerIdThe opaque token that uniquely identifies the local external player app
[in]playContextTokenTrack/playlist/album/artist/station/podcast context identifier
[in]indexIf the playback context is an indexable container like a playlist, the index of the media item in the container
[in]offsetOffset position within media item, in milliseconds
[in]preloadWhether the media item should preload or not
[in]navigationThe app transition behavior
Returns
true if the platform implementation successfully handled the call, else false

◆ play() [2/2]

bool aace::alexa::ExternalMediaAdapter::play ( const std::string &  localPlayerId,
const std::string &  playContextToken,
int64_t  index,
std::chrono::milliseconds  offset,
bool  preload,
Navigation  navigation,
const std::string &  playbackSessionId,
const std::string &  skillToken 
)
virtual

Extra parameters for credentials

◆ playControl()

virtual bool aace::alexa::ExternalMediaAdapter::playControl ( const std::string &  localPlayerId,
PlayControlType  controlType 
)
pure virtual

Occurs during playback control via voice interaction

Parameters
[in]localPlayerIdThe opaque token that uniquely identifies the local external player app
[in]playControlTypePlayback control type being invoked
Returns
true if the platform implementation successfully handled the call, else false

◆ seek()

virtual bool aace::alexa::ExternalMediaAdapter::seek ( const std::string &  localPlayerId,
std::chrono::milliseconds  offset 
)
pure virtual

Called when the user invokes media seek via speech.

Parameters
[in]localPlayerIdThe opaque token that uniquely identifies the local external player app
[in]offsetOffset position within media item, in milliseconds
Returns
true if the platform implementation successfully handled the call, else false

◆ adjustSeek()

virtual bool aace::alexa::ExternalMediaAdapter::adjustSeek ( const std::string &  localPlayerId,
std::chrono::milliseconds  deltaOffset 
)
pure virtual

Called when the user invokes media seek adjustment via speech.

Parameters
[in]localPlayerIdThe opaque token that uniquely identifies the local external player app
[in]deltaOffsetChange in offset position within media item, in milliseconds
Returns
true if the platform implementation successfully handled the call, else false

◆ authorize()

virtual bool aace::alexa::ExternalMediaAdapter::authorize ( const std::vector< AuthorizedPlayerInfo > &  authorizedPlayers)
pure virtual

Called after discovered media players have been reported. Returns a list of reported players and whether they have been authorized for use with Alexa.

Note
It is not guaranteed that every player reported in a call to reportDiscoveredPlayers() will be included in the next call to authorize(). If a player is excluded from a call to authorize() after it is included in the preceding reportDiscoveredPlayers(), this does not necessarily imply it was deauthorized by Alexa. It is possible that a player may be included in more than one call to authorize().
Parameters
[in]authorizedPlayersA list of discovered players with their status of authorization for use with Alexa
Returns
true if the platform implementation successfully handled the call, else false

◆ getOffset()

std::chrono::milliseconds aace::alexa::ExternalMediaAdapter::getOffset ( const std::string &  localPlayerId)
virtual

This function retrieves the offset of the current track the adapter is handling.

Returns
This returns the offset in milliseconds.

◆ getState()

virtual bool aace::alexa::ExternalMediaAdapter::getState ( const std::string &  localPlayerId,
ExternalMediaAdapterState state 
)
pure virtual

Must provide the local external media player apps , and information to maintain cloud sync

Parameters
[in]localPlayerIdThe opaque token that uniquely identifies the local external player app
[in]stateThe ExternalMediaAdapterState to be initialized by the platform
Returns
true if the platform is able to provide state information for the external media player, else false

◆ volumeChanged()

virtual bool aace::alexa::ExternalMediaAdapter::volumeChanged ( float  volume)
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.

Parameters
[in]volumeThe volume to set on the output channel. volume is in the range [0,1].
Returns
true if the platform implementation successfully handled the call, else false

◆ mutedStateChanged()

virtual bool aace::alexa::ExternalMediaAdapter::mutedStateChanged ( MutedState  state)
pure virtual

Notifies the platform implementation to apply a mute state change to the output channel

Parameters
[in]stateThe muted state to apply to the output channel. MutedState::MUTED when the output channel be muted, MutedState::UNMUTED when unmuted
Returns
true if the platform implementation successfully handled the call, else false

◆ reportDiscoveredPlayers()

void aace::alexa::ExternalMediaAdapter::reportDiscoveredPlayers ( const std::vector< DiscoveredPlayerInfo > &  discoveredPlayers)

Should be called on startup in order to notify AVS of the local external media players

Parameters
[in]discoveredPlayerscontains the discovered player info objects

◆ requestToken()

void aace::alexa::ExternalMediaAdapter::requestToken ( const std::string &  localPlayerId)

The device is responsible for requesting an access token when needed. This is typically done immediately upon connection to AVS.

Parameters
[in]localPlayerIdThe opaque token that uniquely identifies the local external player app

◆ loginComplete()

void aace::alexa::ExternalMediaAdapter::loginComplete ( const std::string &  localPlayerId)

Should be called on a local external media player login. This will set authorization of the app with AVS.

Parameters
[in]localPlayerIdThe opaque token that uniquely identifies the local external player app

◆ logoutComplete()

void aace::alexa::ExternalMediaAdapter::logoutComplete ( const std::string &  localPlayerId)

Should be called on a local external media player logout. This will unset authorization of the app with AVS.

Parameters
[in]localPlayerIdThe opaque token that uniquely identifies the local external player app

◆ playerEvent()

void aace::alexa::ExternalMediaAdapter::playerEvent ( const std::string &  localPlayerId,
const std::string &  eventName 
)

Should be called on a local external media player event. This will sync the context with AVS.

Parameters
[in]localPlayerIdThe opaque token that uniquely identifies the local external player app
[in]eventNameCanonical event name. Accepted values:
  • "TrackChanged"
  • "PlaybackSessionStarted"
  • "PlaybackSessionEnded"
  • "PlaybackStarted"
  • "PlaybackStopped"
  • "PlaybackPrevious"
  • "PlaybackNext"
  • "PlayModeChanged"

◆ playerError()

void aace::alexa::ExternalMediaAdapter::playerError ( const std::string &  localPlayerId,
const std::string &  errorName,
long  code,
const std::string &  description,
bool  fatal 
)

Should be called on a player error.

Parameters
[in]localPlayerIdThe opaque token that uniquely identifies the local external player app
[in]errorNameThe name of the error. Accepted values:
  • "INTERNAL_ERROR"
  • "UNPLAYABLE_BY_AUTHORIZATION"
  • "UNPLAYABLE_BY_STREAM_CONCURRENCY"
  • "UNPLAYABLE_BY_ACCOUNT"
  • "OPERATION_REJECTED_UNINTERRUPTIBLE"
  • "OPERATION_REJECTED_END_OF_QUEUE"
  • "UNPLAYABLE_BY_REGION"
  • "OPERATION_UNSUPPORTED"
  • "UNPLAYABLE_BY_PARENTAL_CONTROL"
  • "UNPLAYABLE_BY_SUBSCRIPTION"
  • "OPERATION_REJECTED_SKIP_LIMIT"
  • "UNKNOWN_ERROR"
  • "PLAYER_UNKNOWN"
  • "PLAYER_NOT_FOUND"
  • "PLAYER_CONNECTION_REJECTED"
  • "PLAYER_CONNECTION_TIMEOUT"
[in]codeThe error code
[in]descriptionThe detailed error description
[in]fataltrue if the error is fatal

◆ setFocus()

void aace::alexa::ExternalMediaAdapter::setFocus ( const std::string &  localPlayerId)

Should be called on local external media player events. This will switch the media focus to that context.

Parameters
[in]localPlayerIdThe opaque token that uniquely identifies the local external player app

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