AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | 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]

Classes

struct  PlayParams
 PlayParams is a struct that contains the parameters for the play method. More...
 

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 PlayParams &params)=0
 
virtual bool playControl (const std::string &localPlayerId, acsdkExternalMediaPlayerInterfaces::RequestType requestType, const std::string &playbackTarget)=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 PlayParams params)
pure virtual

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

Parameters
paramsPlay parameters required for playback
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,
const std::string &  playbackTarget 
)
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...
playbackTargetPlayback target to handle play control with
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

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


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

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