#include <ExternalMediaAdapterHandler.h>
|
|
std::vector< acsdkExternalMediaPlayerInterfaces::PlayerInfo > | updatePlayerInfo (const std::vector< acsdkExternalMediaPlayerInterfaces::PlayerInfo > &playerList) override |
|
bool | login (const std::string &localPlayerId, const std::string &accessToken, const std::string &userName, bool forceLogin, std::chrono::milliseconds tokenRefreshInterval) override |
|
bool | logout (const std::string &localPlayerId) override |
|
bool | play (const PlayParams ¶ms) override |
|
bool | playControl (const std::string &localPlayerId, acsdkExternalMediaPlayerInterfaces::RequestType requestType, const std::string &playbackTarget) override |
|
bool | seek (const std::string &localPlayerId, std::chrono::milliseconds offset) override |
|
bool | adjustSeek (const std::string &localPlayerId, std::chrono::milliseconds deltaOffset) override |
|
acsdkExternalMediaPlayerInterfaces::AdapterState | getAdapterState (const std::string &localPlayerId) override |
|
std::vector< acsdkExternalMediaPlayerInterfaces::AdapterState > | getAdapterStates () override |
|
std::chrono::milliseconds | getOffset (const std::string &localPlayerId) override |
|
void | setExternalMediaPlayer (const std::shared_ptr< acsdkExternalMediaPlayerInterfaces::ExternalMediaPlayerInterface > externalMediaPlayer) override |
|
|
void | onSpeakerSettingsChanged (const Source &source, const avsCommon::sdkInterfaces::ChannelVolumeInterface::Type &type, const avsCommon::sdkInterfaces::SpeakerInterface::SpeakerSettings &settings) override |
|
virtual | ~SpeakerManagerObserverInterface ()=default |
|
Public Member Functions inherited from alexaClientSDK::acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface |
| ExternalMediaAdapterHandlerInterface (const std::string &name) |
|
virtual | ~ExternalMediaAdapterHandlerInterface ()=default |
|
virtual void | setExternalMediaPlayer (const std::shared_ptr< ExternalMediaPlayerInterface > externalMediaPlayer)=0 |
|
| RequiresShutdown (const std::string &name) |
|
virtual | ~RequiresShutdown () |
| Destructor. More...
|
|
const std::string & | name () const |
|
void | shutdown () |
|
bool | isShutdown () const |
|
|
| ExternalMediaAdapterHandler (const std::string &name) |
|
bool | initializeAdapterHandler (std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::SpeakerManagerInterface > speakerManager) |
|
bool | validatePlayer (const std::string &localPlayerId, bool checkAuthorized=true) |
|
std::string | createExternalMediaPlayerEvent (const std::string &localPlayerId, const std::string &event, bool includePlaybackSessionId=false, std::function< void(rapidjson::Value::Object &, rapidjson::Value::AllocatorType &)> createPayload=[](rapidjson::Value::Object &v, rapidjson::Value::AllocatorType &a) {}) |
|
void | reportDiscoveredPlayers (const std::vector< acsdkExternalMediaPlayerInterfaces::DiscoveredPlayerInfo > &discoveredPlayers) |
|
bool | removeDiscoveredPlayer (const std::string &localPlayerId) |
|
virtual void | doShutdown () override |
| alexaClientSDK::avsCommon::utils::RequiresShutdown More...
|
|
|
virtual bool | handleAuthorization (const AuthorizedPlayerInfo &authorizedPlayer)=0 |
|
virtual bool | handleLogin (const std::string &localPlayerId, const std::string &accessToken, const std::string &userName, bool forceLogin, std::chrono::milliseconds tokenRefreshInterval)=0 |
|
virtual bool | handleLogout (const std::string &localPlayerId)=0 |
|
virtual bool | handlePlay (const ExternalMediaAdapterHandlerInterface::PlayParams ¶ms)=0 |
|
virtual bool | handlePlayControl (const std::string &localPlayerId, acsdkExternalMediaPlayerInterfaces::RequestType requestType, const std::string &playbackTarget)=0 |
|
virtual bool | handleSeek (const std::string &localPlayerId, std::chrono::milliseconds offset)=0 |
|
virtual bool | handleAdjustSeek (const std::string &localPlayerId, std::chrono::milliseconds deltaOffset)=0 |
|
virtual bool | handleGetAdapterState (const std::string &localPlayerId, acsdkExternalMediaPlayerInterfaces::AdapterState &state)=0 |
|
virtual std::chrono::milliseconds | handleGetOffset (const std::string &localPlayerId) |
|
virtual void | handleSetVolume (int8_t volume)=0 |
|
virtual void | handleSetMute (bool mute)=0 |
|
The abstract ExternalMediaAdapterHandler class implements the ExternalMediaAdapterHandlerInterface and provides a base for users who wish to add custom External Media Player adapter handlers
◆ ExternalMediaAdapterHandler()
alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler::ExternalMediaAdapterHandler |
( |
const std::string & |
name | ) |
|
|
protected |
Constructor
- Parameters
-
name | The name for this adapter handler |
externalMediaPlayer | The external media player interface |
◆ adjustSeek()
bool alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler::adjustSeek |
( |
const std::string & |
localPlayerId, |
|
|
std::chrono::milliseconds |
deltaOffset |
|
) |
| |
|
overridevirtual |
◆ createExternalMediaPlayerEvent()
std::string alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler::createExternalMediaPlayerEvent |
( |
const std::string & |
localPlayerId, |
|
|
const std::string & |
event, |
|
|
bool |
includePlaybackSessionId = false , |
|
|
std::function< void(rapidjson::Value::Object &, rapidjson::Value::AllocatorType &)> |
createPayload = [](rapidjson::Value::Object &v, rapidjson::Value::AllocatorType &a) {} |
|
) |
| |
|
protected |
Helper function to create an external media player event
- Parameters
-
localPlayerId | The local player ID |
event | The event to send |
includePlaybackSessionId | Whether the playback session id should be included |
createPayload | Optional function which can be used to customize the payload |
- Returns
◆ doShutdown()
virtual void alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler::doShutdown |
( |
| ) |
|
|
overrideprotectedvirtual |
◆ getAdapterState()
◆ getAdapterStates()
◆ getOffset()
std::chrono::milliseconds alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler::getOffset |
( |
const std::string & |
localPlayerId | ) |
|
|
overridevirtual |
◆ handleAdjustSeek()
virtual bool alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler::handleAdjustSeek |
( |
const std::string & |
localPlayerId, |
|
|
std::chrono::milliseconds |
deltaOffset |
|
) |
| |
|
protectedpure virtual |
Method to seek to an offset from the current position.
- Parameters
-
localPlayerId | The player ID to control. |
deltaOffset | The offset to seek to relative to the current offset. |
- Returns
- true if successful
◆ handleAuthorization()
virtual bool alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler::handleAuthorization |
( |
const AuthorizedPlayerInfo & |
authorizedPlayer | ) |
|
|
protectedpure virtual |
The following functions are to be overriden by implementors Called when the list of authorized discovered players is received from AVS
- Parameters
-
authorizedPlayer | The player and the authorization status |
- Returns
- true if authorization successful
◆ handleGetAdapterState()
Method to fetch the state of an adapter.
- Parameters
-
localPlayerId | The local player ID for which the state is requested |
state | reference to the AdapterState object which should be updated with the current state for the adapter |
- Returns
- true if successful
◆ handleGetOffset()
virtual std::chrono::milliseconds alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler::handleGetOffset |
( |
const std::string & |
localPlayerId | ) |
|
|
protectedvirtual |
This function retrieves the offset of the current track the adapter is handling.
- Parameters
-
localPlayerId | The local player Id for which offset is being requested |
- Returns
- This returns the offset in milliseconds.
◆ handleLogin()
virtual bool alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler::handleLogin |
( |
const std::string & |
localPlayerId, |
|
|
const std::string & |
accessToken, |
|
|
const std::string & |
userName, |
|
|
bool |
forceLogin, |
|
|
std::chrono::milliseconds |
tokenRefreshInterval |
|
) |
| |
|
protectedpure virtual |
The handler should login the given player using the provided details
- Parameters
-
localPlayerId | The player ID to be logged in |
accessToken | The access context of the user identifier. |
userName | The userName of the user logging in. |
forceLogin | bool which signifies if the adapter has to a force a login or merely cache the access token. |
tokenRefreshInterval | The duration in milliseconds for which the accessToken is valid. |
- Returns
- true if login was successful
◆ handleLogout()
virtual bool alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler::handleLogout |
( |
const std::string & |
localPlayerId | ) |
|
|
protectedpure virtual |
The handler should log out the given player
- Parameters
-
localPlayerId | The player ID to be logged out |
- Returns
- true if logout was successful
◆ handlePlay()
virtual bool alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler::handlePlay |
( |
const ExternalMediaAdapterHandlerInterface::PlayParams & |
params | ) |
|
|
protectedpure virtual |
The handler should play the given player
- Parameters
-
params | Play parameters to play with |
- Returns
- true if successful
◆ handlePlayControl()
virtual bool alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler::handlePlayControl |
( |
const std::string & |
localPlayerId, |
|
|
acsdkExternalMediaPlayerInterfaces::RequestType |
requestType, |
|
|
const std::string & |
playbackTarget |
|
) |
| |
|
protectedpure virtual |
Method to initiate the different types of play control like PLAY/PAUSE/RESUME/NEXT/...
- Parameters
-
localPlayerId | The player ID to control |
requestType | The type of REQUEST. Will always be PLAY/PAUSE/RESUME/NEXT... |
playbackTarget | Target for handling play control |
- Returns
◆ handleSeek()
virtual bool alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler::handleSeek |
( |
const std::string & |
localPlayerId, |
|
|
std::chrono::milliseconds |
offset |
|
) |
| |
|
protectedpure virtual |
Method to seek to the given offset.
- Parameters
-
localPlayerId | The player ID to control |
offset | The offset to seek to. |
- Returns
- true if successful
◆ handleSetMute()
virtual void alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler::handleSetMute |
( |
bool |
mute | ) |
|
|
protectedpure virtual |
Called when the SpeakerManager reports a change to the mute state
- Parameters
-
◆ handleSetVolume()
virtual void alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler::handleSetVolume |
( |
int8_t |
volume | ) |
|
|
protectedpure virtual |
Called when the SpeakerManager reports a volume change
- Parameters
-
◆ initializeAdapterHandler()
◆ login()
bool alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler::login |
( |
const std::string & |
localPlayerId, |
|
|
const std::string & |
accessToken, |
|
|
const std::string & |
userName, |
|
|
bool |
forceLogin, |
|
|
std::chrono::milliseconds |
tokenRefreshInterval |
|
) |
| |
|
overridevirtual |
Method to allow a user to login to a third party music provider.
- Parameters
-
localPlayerId | The local player ID being logged in |
accessToken | The access context of the user identifier. |
userName | The userName of the user logging in. |
forceLogin | bool which signifies if the adapter has to a force a login or merely cache the access token. |
tokenRefreshInterval | The duration in milliseconds for which the accessToken is valid. |
- Returns
- True if the call was handled
Implements alexaClientSDK::acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface.
◆ logout()
bool alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler::logout |
( |
const std::string & |
localPlayerId | ) |
|
|
overridevirtual |
◆ onSpeakerSettingsChanged()
◆ play()
bool alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler::play |
( |
const PlayParams & |
params | ) |
|
|
overridevirtual |
◆ playControl()
◆ removeDiscoveredPlayer()
bool alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler::removeDiscoveredPlayer |
( |
const std::string & |
localPlayerId | ) |
|
|
protected |
Removes a player
- Parameters
-
- Returns
- if the player was removed
◆ reportDiscoveredPlayers()
Add a newly discovered player
- Parameters
-
discoveredPlayers | The details for the player |
◆ seek()
bool alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler::seek |
( |
const std::string & |
localPlayerId, |
|
|
std::chrono::milliseconds |
offset |
|
) |
| |
|
overridevirtual |
◆ setExternalMediaPlayer()
◆ updatePlayerInfo()
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
-
playerList | The list of players whose state has changed |
- Returns
- The list of players which were processed by this handler
Implements alexaClientSDK::acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface.
◆ validatePlayer()
bool alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaAdapterHandler::validatePlayer |
( |
const std::string & |
localPlayerId, |
|
|
bool |
checkAuthorized = true |
|
) |
| |
|
protected |
Validates if a player exists, and whether it is authorized
- Parameters
-
localPlayerId | The local player ID |
checkAuthorized | Check if the player should be authorized |
- Returns
- true if the validation check passes
◆ m_externalMediaPlayer
The pointer to the external media player object.
The documentation for this class was generated from the following file:
- /workplace/avs-device-sdk/capabilities/ExternalMediaPlayer/acsdkExternalMediaPlayer/include/acsdkExternalMediaPlayer/ExternalMediaAdapterHandler.h
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0