AlexaClientSDK  1.22.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | List of all members
alexaClientSDK::acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface Class Referenceabstract

#include <ExternalMediaAdapterHandlerInterface.h>

Inheritance diagram for alexaClientSDK::acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface:
Collaboration graph
[legend]

Public Member Functions

 ExternalMediaAdapterHandlerInterface (const std::string &name)
 
virtual ~ExternalMediaAdapterHandlerInterface ()=default
 
virtual std::vector< PlayerInfoupdatePlayerInfo (const std::vector< PlayerInfo > &playerList)=0
 
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, const std::string &skillToken, const std::string &playbackSessionId, const std::string &navigation, bool preload, const alexaClientSDK::avsCommon::avs::PlayRequestor &playRequestor)=0
 
virtual bool playControl (const std::string &localPlayerId, acsdkExternalMediaPlayerInterfaces::RequestType requestType)=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 acsdkExternalMediaPlayerInterfaces::AdapterState getAdapterState (const std::string &localPlayerId)=0
 
virtual std::vector< acsdkExternalMediaPlayerInterfaces::AdapterStategetAdapterStates ()=0
 
virtual std::chrono::milliseconds getOffset (const std::string &localPlayerId)=0
 
virtual void setExternalMediaPlayer (const std::shared_ptr< ExternalMediaPlayerInterface > externalMediaPlayer)=0
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::utils::RequiresShutdown
 RequiresShutdown (const std::string &name)
 
virtual ~RequiresShutdown ()
 Destructor. More...
 
const std::string & name () const
 
void shutdown ()
 
bool isShutdown () const
 

Additional Inherited Members

- Protected Member Functions inherited from alexaClientSDK::avsCommon::utils::RequiresShutdown
virtual void doShutdown ()=0
 

Detailed Description

The ExternalMediaAdapterHandlerInterface specifies the interface of adapter handler objects which interact with third party music service providers. The adapter handler may handle multiple players distinguished by a different player ID and provides users with an interface to manage playback control and session management.

Note
Multiple handlers are supported by the AVS SDK, and each handler has the ability to support multiple players, both options are equally valid and it is up to the implementor to decide which implementation better suits their use case. For example, registering two handlers, one of which supports a single player, and a second handler which supports two players is a valid use case.

Constructor & Destructor Documentation

◆ ExternalMediaAdapterHandlerInterface()

alexaClientSDK::acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface::ExternalMediaAdapterHandlerInterface ( const std::string &  name)
inlineexplicit

Constructor

Parameters
nameThe name to identify this ExternalMediaAdapterHandler

◆ ~ExternalMediaAdapterHandlerInterface()

virtual alexaClientSDK::acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface::~ExternalMediaAdapterHandlerInterface ( )
virtualdefault

Destructor

Member Function Documentation

◆ adjustSeek()

virtual bool alexaClientSDK::acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface::adjustSeek ( const std::string &  localPlayerId,
std::chrono::milliseconds  deltaOffset 
)
pure virtual

Method to seek to an offset from the current position.

Parameters
localPlayerIdThe localPlayerId that this seek control is targeted at
deltaOffsetThe offset to seek to relative to the current offset.
Returns
True if the call was handled

Implemented in alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler, and alexaClientSDK::acsdkExternalMediaPlayer::StaticExternalMediaPlayerAdapterHandler.

◆ getAdapterState()

virtual acsdkExternalMediaPlayerInterfaces::AdapterState alexaClientSDK::acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface::getAdapterState ( const std::string &  localPlayerId)
pure virtual

Method to fetch the state(session state and playback state) of an adapter.

Parameters
localPlayerIdThe player ID for which the state is being requested
Returns
The adapter state

Implemented in alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler, and alexaClientSDK::acsdkExternalMediaPlayer::StaticExternalMediaPlayerAdapterHandler.

◆ getAdapterStates()

virtual std::vector<acsdkExternalMediaPlayerInterfaces::AdapterState> alexaClientSDK::acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface::getAdapterStates ( )
pure virtual

Method to fetch the state for all adapters handled by this adapter handler

Returns
Vector of all adapter states

Implemented in alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler, and alexaClientSDK::acsdkExternalMediaPlayer::StaticExternalMediaPlayerAdapterHandler.

◆ getOffset()

virtual std::chrono::milliseconds alexaClientSDK::acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface::getOffset ( const std::string &  localPlayerId)
pure virtual

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

Parameters
localPlayerIdThe player ID for which the offset is being requested
Returns
The offset in milliseconds

Implemented in alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler, and alexaClientSDK::acsdkExternalMediaPlayer::StaticExternalMediaPlayerAdapterHandler.

◆ login()

virtual bool alexaClientSDK::acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface::login ( const std::string &  localPlayerId,
const std::string &  accessToken,
const std::string &  userName,
bool  forceLogin,
std::chrono::milliseconds  tokenRefreshInterval 
)
pure virtual

Method to allow a user to login to a third party music provider.

Parameters
localPlayerIdThe local player ID being logged in
accessTokenThe access context of the user identifier.
userNameThe userName of the user logging in.
forceLoginbool which signifies if the adapter has to a force a login or merely cache the access token.
tokenRefreshIntervalThe duration in milliseconds for which the accessToken is valid.
Returns
True if the call was handled

Implemented in alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler, and alexaClientSDK::acsdkExternalMediaPlayer::StaticExternalMediaPlayerAdapterHandler.

◆ logout()

virtual bool alexaClientSDK::acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface::logout ( const std::string &  localPlayerId)
pure virtual

Method that handles logging out a user from a third party library/cloud.

Parameters
localPlayerIdThe local player ID being logged out
Returns
True if the call was handled

Implemented in alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler, and alexaClientSDK::acsdkExternalMediaPlayer::StaticExternalMediaPlayerAdapterHandler.

◆ play()

virtual bool alexaClientSDK::acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface::play ( const std::string &  localPlayerId,
const std::string &  playContextToken,
int64_t  index,
std::chrono::milliseconds  offset,
const std::string &  skillToken,
const std::string &  playbackSessionId,
const std::string &  navigation,
bool  preload,
const alexaClientSDK::avsCommon::avs::PlayRequestor playRequestor 
)
pure virtual

Method to allow a user to initiate play from a third party music service provider based on a play context.

Parameters
localPlayerIdThe localPlayerId that this play control is targeted at
playContextTokenPlay context {Track/playlist/album/artist/station/podcast} identifier.
indexThe index of the media item in the container, if the container is indexable.
offsetThe offset position within media item, in milliseconds.
skillTokenAn opaque token for the domain or skill that is presently associated with this player.
playbackSessionIdA universally unique identifier (UUID) generated to the RFC 4122 specification.
navigationCommunicates desired visual display behavior for the app associated with playback.
preloadIf true, this Play directive is intended to preload the identified content only but not begin playback.
playRequestorThe PlayRequestor object that is used to distinguish if it's a music alarm or not.
Returns
True if the call was handled

Implemented in alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler, and alexaClientSDK::acsdkExternalMediaPlayer::StaticExternalMediaPlayerAdapterHandler.

◆ playControl()

virtual bool alexaClientSDK::acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface::playControl ( const std::string &  localPlayerId,
acsdkExternalMediaPlayerInterfaces::RequestType  requestType 
)
pure virtual

Method to initiate the different types of play control like PLAY/PAUSE/RESUME/NEXT/...

Parameters
localPlayerIdThe localPlayerId that this play control is targeted at
requestTypeThe type of REQUEST. Will always be PLAY/PAUSE/RESUME/NEXT...
Returns
True if the call was handled

Implemented in alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler, and alexaClientSDK::acsdkExternalMediaPlayer::StaticExternalMediaPlayerAdapterHandler.

◆ seek()

virtual bool alexaClientSDK::acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface::seek ( const std::string &  localPlayerId,
std::chrono::milliseconds  offset 
)
pure virtual

Method to seek to the given offset.

Parameters
localPlayerIdThe localPlayerId that this seek control is targeted at
offsetThe offset to seek to.
Returns
True if the call was handled

Implemented in alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler, and alexaClientSDK::acsdkExternalMediaPlayer::StaticExternalMediaPlayerAdapterHandler.

◆ setExternalMediaPlayer()

virtual void alexaClientSDK::acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface::setExternalMediaPlayer ( const std::shared_ptr< ExternalMediaPlayerInterface externalMediaPlayer)
pure virtual

Method to set the external media player interface used by this handler

Parameters
externalMediaPlayerPointer to the external media player

◆ updatePlayerInfo()

virtual std::vector<PlayerInfo> alexaClientSDK::acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface::updatePlayerInfo ( const std::vector< PlayerInfo > &  playerList)
pure virtual

Method to notify the handler that the cloud status of given players has been updated. This method also provides the playerId and skillToken as identified by the cloud. The cloud support for a player may be revoked at any time. The state of any players not included on the playerList should be assumed to be unchanged.

Parameters
playerListThe list of players whose state has changed
Returns
The list of players which were processed by this handler

The documentation for this class was generated from the following file:

AlexaClientSDK 1.22.0 - Copyright 2016-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0