Alexa Auto SDK  2.0.0
Classes | Public Member Functions | List of all members
com.amazon.aace.alexa.ExternalMediaAdapter Class Referenceabstract

Classes

enum  Favorites
 
enum  MediaType
 
enum  Navigation
 
enum  PlayControlType
 
enum  SupportedPlaybackOperation
 

Public Member Functions

boolean login (String localPlayerId, String accessToken, String userName, boolean forceLogin, long tokenRefreshInterval)
 
boolean logout (String localPlayerId)
 
boolean play (String localPlayerId, String playContextToken, long index, long offset, boolean preload, Navigation navigation)
 
boolean playControl (String localPlayerId, PlayControlType playControlType)
 
boolean seek (String localPlayerId, long offset)
 
boolean adjustSeek (String localPlayerId, long deltaOffset)
 
boolean authorize (AuthorizedPlayerInfo[] authorizedPlayers)
 
boolean getState (String localPlayerId, ExternalMediaAdapterState state)
 
boolean volumeChanged (float volume)
 
boolean mutedStateChanged (MutedState state)
 
final void reportDiscoveredPlayers (DiscoveredPlayerInfo[] discoveredPlayers)
 
final void requestToken (String localPlayerId)
 
final void loginComplete (String localPlayerId)
 
final void logoutComplete (String localPlayerId)
 
final void playerEvent (String localPlayerId, String eventName)
 
final void playerError (String localPlayerId, String errorName, long code, String description, boolean fatal)
 
final void setFocus (String localPlayerId)
 
final void removeDiscoveredPlayer (String localPlayerId)
 

Detailed Description

ExternalMediaAdapter should be extended to handle external media player application interaction with AVS. The platform implementation is responsible for managing the client, and media session state control. The ExternalMediaAdapter will also receive directives from the Engine to handle audio playback/control.

See also
Speaker

Member Function Documentation

◆ login()

boolean com.amazon.aace.alexa.ExternalMediaAdapter.login ( String  localPlayerId,
String  accessToken,
String  userName,
boolean  forceLogin,
long  tokenRefreshInterval 
)

Directive called after a discovered player initiates the loginComplete event.

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

◆ logout()

boolean com.amazon.aace.alexa.ExternalMediaAdapter.logout ( String  localPlayerId)

Directive called after a discovered player initiates the logoutComplete event.

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

◆ play()

boolean com.amazon.aace.alexa.ExternalMediaAdapter.play ( String  localPlayerId,
String  playContextToken,
long  index,
long  offset,
boolean  preload,
Navigation  navigation 
)

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

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

◆ playControl()

boolean com.amazon.aace.alexa.ExternalMediaAdapter.playControl ( String  localPlayerId,
PlayControlType  playControlType 
)

Occurs during playback control via voice interaction or PlaybackController interface

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

◆ seek()

boolean com.amazon.aace.alexa.ExternalMediaAdapter.seek ( String  localPlayerId,
long  offset 
)

Called when the user invokes media seek via speech.

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

◆ adjustSeek()

boolean com.amazon.aace.alexa.ExternalMediaAdapter.adjustSeek ( String  localPlayerId,
long  deltaOffset 
)

Called when the user invokes media seek adjustment via speech.

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

◆ authorize()

boolean com.amazon.aace.alexa.ExternalMediaAdapter.authorize ( AuthorizedPlayerInfo []  authorizedPlayers)

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

◆ getState()

boolean com.amazon.aace.alexa.ExternalMediaAdapter.getState ( String  localPlayerId,
ExternalMediaAdapterState  state 
)

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

Parameters
localPlayerIdThe opaque token that uniquely identifies the local external player app
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()

boolean com.amazon.aace.alexa.ExternalMediaAdapter.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.

Parameters
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()

boolean com.amazon.aace.alexa.ExternalMediaAdapter.mutedStateChanged ( MutedState  state)

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

Parameters
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()

final void com.amazon.aace.alexa.ExternalMediaAdapter.reportDiscoveredPlayers ( DiscoveredPlayerInfo []  discoveredPlayers)

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

Parameters
discoveredPlayerscontains the discovered player info objects

◆ requestToken()

final void com.amazon.aace.alexa.ExternalMediaAdapter.requestToken ( String  localPlayerId)

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

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

◆ loginComplete()

final void com.amazon.aace.alexa.ExternalMediaAdapter.loginComplete ( String  localPlayerId)

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

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

◆ logoutComplete()

final void com.amazon.aace.alexa.ExternalMediaAdapter.logoutComplete ( String  localPlayerId)

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

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

◆ playerEvent()

final void com.amazon.aace.alexa.ExternalMediaAdapter.playerEvent ( String  localPlayerId,
String  eventName 
)

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

Parameters
localPlayerIdThe opaque token that uniquely identifies the local external player app
eventNameCanonical event name

◆ playerError()

final void com.amazon.aace.alexa.ExternalMediaAdapter.playerError ( String  localPlayerId,
String  errorName,
long  code,
String  description,
boolean  fatal 
)

Should be called on a player error.

Parameters
localPlayerIdThe opaque token that uniquely identifies the local external player app
errorNameThe name of the error
codeThe error code
descriptionThe detailed error description
fataltrue if the error is fatal

◆ setFocus()

final void com.amazon.aace.alexa.ExternalMediaAdapter.setFocus ( String  localPlayerId)

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

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

◆ removeDiscoveredPlayer()

final void com.amazon.aace.alexa.ExternalMediaAdapter.removeDiscoveredPlayer ( String  localPlayerId)

Should be called on when a registered media player has been uninstalled or is no longer available.

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

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