![]() |
AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <ExternalMediaPlayer.h>
Static Public Attributes | |
static constexpr const char * | SPI_VERSION = "1.0" |
The spiVersion of this implementation of ExternalMediaPlayer. More... | |
Additional Inherited Members | |
![]() | |
CapabilityAgent (const std::string &nameSpace, std::shared_ptr< sdkInterfaces::ExceptionEncounteredSenderInterface > exceptionEncounteredSender) | |
virtual std::shared_ptr< DirectiveInfo > | createDirectiveInfo (std::shared_ptr< AVSDirective > directive, std::unique_ptr< sdkInterfaces::DirectiveHandlerResultInterface > result) |
void | removeDirective (const std::string &messageId) |
void | sendExceptionEncounteredAndReportFailed (std::shared_ptr< DirectiveInfo > info, const std::string &message, avsCommon::avs::ExceptionErrorType type=avsCommon::avs::ExceptionErrorType::INTERNAL_ERROR) |
const std::pair< std::string, std::string > | buildJsonEventString (const std::string &eventName, const std::string &dialogRequestIdString="", const std::string &payload="{}", const std::string &context="") const |
![]() | |
const std::string | m_namespace |
The namespace of the capability agent. More... | |
std::shared_ptr< sdkInterfaces::ExceptionEncounteredSenderInterface > | m_exceptionEncounteredSender |
Object to use to send exceptionEncountered messages. More... | |
This class implements the ExternalMediaPlayer
capability agent. This agent is responsible for handling music service providers which manage their PLAY queue.
shutdown()
must be called. using alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::AdapterCreateFunction = std::shared_ptr<acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterInterface> (*)( std::shared_ptr<alexaClientSDK::avsCommon::utils::metrics::MetricRecorderInterface>, std::shared_ptr<avsCommon::utils::mediaPlayer::MediaPlayerInterface> mediaPlayer, std::shared_ptr<avsCommon::sdkInterfaces::ChannelVolumeInterface> speaker, std::shared_ptr<avsCommon::sdkInterfaces::SpeakerManagerInterface> speakerManager, std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> messageSender, std::shared_ptr<avsCommon::sdkInterfaces::FocusManagerInterface> focusManager, std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> contextManager, std::shared_ptr<acsdkExternalMediaPlayerInterfaces::ExternalMediaPlayerInterface> externalMediaPlayer) |
using alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::AdapterCreationMap = std::unordered_map<std::string, AdapterCreateFunction> |
using alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::AdapterMediaPlayerMap = std::unordered_map<std::string, std::shared_ptr<avsCommon::utils::mediaPlayer::MediaPlayerInterface> > |
using alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::AdapterSpeakerMap = std::unordered_map<std::string, std::shared_ptr<avsCommon::sdkInterfaces::ChannelVolumeInterface> > |
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
Cancel an ongoing preHandleDirective()
or handleDirective()
operation for the AVSDirective
in . Once this has been called the CapabilityAgent
should not expect to receive further calls regarding this directive.
AVSDirectives
.info | The DirectiveInfo instance for the AVSDirective to process. |
Implements alexaClientSDK::avsCommon::avs::CapabilityAgent.
Factory method to create a new ExternalMediaPlayer
.
messageSender | The object to use for sending events. |
certifiedMessageSender | Used to send messages that must be guaranteed. |
contextManager | The AVS Context Manager used to generate system context for events. |
exceptionSender | The object to use for sending AVS Exception messages. |
playbackRouter | The PlaybackRouterInterface instance to use when the EMP becomes active. |
endpointCapabilitiesRegistrar | The EndpointCapabilitiesRegistratInterface to use to register this capability with the default endpoint. |
shutdownNotifier | The object that will notify this EMP should shut down. |
startupNotifier | The object that will notify this EMP to startup. |
renderPlayerInfoCardsProviderRegistrar | The registrar for this PlayerInfoCardsProvider. |
metricRecorder | The object to record metrics. |
ExternalMediaPlayer
.
|
static |
Forwards an ExternalMediaPlayer
as an ExternalMediaPlayerInterface
.
externalMediaPlayer | The object to forward. |
ExternalMediaPlayerInterface
.
|
static |
Factory method to create a new ExternalMediaPlayer
.
adapterCreationMap | A map of <playerId: AdapterCreateFunction> that this EMP will use to instantiate adapters. |
audioPipelineFactory | The object to use for creating the media players and related interfaces for the adapters. |
messageSender | The object to use for sending events. |
certifiedMessageSender | Used to send messages that must be guaranteed. |
audioFocusManager | The object used to manage audio focus for the adapter managed by the EMP. |
contextManager | The AVS Context Manager used to generate system context for events. |
exceptionSender | The object to use for sending AVS Exception messages. |
playbackRouter | The PlaybackRouterInterface instance to use when the EMP becomes active. |
endpointCapabilitiesRegistrar | The EndpointCapabilitiesRegistratInterface to use to register this capability with the default endpoint. |
shutdownNotifier | The object that will notify this EMP should shut down. |
startupNotifier | The object that will notify this EMP to startup. |
renderPlayerInfoCardsProviderRegistrar | The registrar for this PlayerInfoCardsProvider. |
metricRecorder | The object to record metrics. |
ExternalMediaPlayer
. std::map<std::string, std::shared_ptr<acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterInterface> > alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::getAdaptersMap | ( | ) |
Getter for statically configured adapters - note this only returns adapters provided through the adapterCreationMap during init
localPlayerId
(business names) to adapters.
|
overridevirtual |
Returns the duration of the current AudioItem the player is handling.
Reimplemented from alexaClientSDK::avsCommon::sdkInterfaces::MediaPropertiesInterface.
|
overridevirtual |
This function retrieves the offset of the current AudioItem the player is handling.
Implements alexaClientSDK::avsCommon::sdkInterfaces::MediaPropertiesInterface.
|
overridevirtual |
Returns the configurations of the capability interfaces being implemented.
Implements alexaClientSDK::avsCommon::sdkInterfaces::CapabilityConfigurationInterface.
|
overridevirtual |
Returns the configuration of the directive handler.
The configuration consists of multiple directive routing rules and their respective blocking policy. The directives will be matched from the most specific rule (with all fields defined) to the least specific rule (which only matches the directive endpointId).
avs::DirectiveHandlerConfiguration
of the handler. Implements alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface.
|
overridevirtual |
Handle the action specified by the AVSDirective
in info
. The handling of subsequent directives with the same DialogRequestId
may be blocked until the DirectiveHandler
calls the setSucceeded()
method of the DirectiveHandlingResult
present in info
. If handling of this directive fails setFailed()
should be called to indicate a failure.
AVSDirectives
.info | The DirectiveInfo instance for the AVSDirective to process. |
Implements alexaClientSDK::avsCommon::avs::CapabilityAgent.
|
overridevirtual |
Handle the action specified AVSDirective
. Once this has been called the DirectiveHandler
should not expect to receive further calls regarding this directive.
AVSDirectives
. ExceptionEncountered
message should be sent to AVS.directive | The directive to handle. |
Implements alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface.
|
overridevirtual |
Request the handler to perform a local playback operation.
op | Operation to request |
Implements alexaClientSDK::avsCommon::sdkInterfaces::LocalPlaybackHandlerInterface.
|
overridevirtual |
Request the handler to perform a local seek operation.
location | Position to seek to |
fromStart | true to seek to absolute location, false to seek reletive to current location. |
Implements alexaClientSDK::avsCommon::sdkInterfaces::LocalPlaybackHandlerInterface.
|
overridevirtual |
Used to notify the handler when a playback button is pressed.
button | The button that has been pressed. |
Implements alexaClientSDK::avsCommon::sdkInterfaces::PlaybackHandlerInterface.
|
overridevirtual |
This is called by the ContextManager once the context is ready and available.
ContextRequester
should perform minimum processing and return quickly. Otherwise it will block the processing of updating the of other ContextProviders
.jsonContext | Context information.Context provided is of the format {"context"[{...}, {...}]} |
Reimplemented from alexaClientSDK::avsCommon::sdkInterfaces::ContextRequesterInterface.
|
overridevirtual |
The contextManager calls this if it is unable to process a getContext
request successfully.
ContextRequester
should perform minimum processing and return quickly. Otherwise it will block the processing of updating the of other ContextProviders
.error | The reason why the getContext request failed. |
Reimplemented from alexaClientSDK::avsCommon::sdkInterfaces::ContextRequesterInterface.
|
overridevirtual |
Notification that this handler has been de-registered and will not receive any more calls.
Reimplemented from alexaClientSDK::avsCommon::avs::CapabilityAgent.
|
overridevirtual |
Used to notify the handler when a playback toggle is pressed.
toggle | The toggle that has been pressed. |
action | The boolean action for the toggle state |
Implements alexaClientSDK::avsCommon::sdkInterfaces::PlaybackHandlerInterface.
|
overridevirtual |
Notification that a directive has arrived. This notification gives the DirectiveHandler a chance to prepare for handling of an AVSDirective
. If an error occurs during the pre-Handling phase and that error should cancel the handling of subsequent AVSDirectives
with the same DialogRequestId
, the DirectiveHandler
should call the setFailed
method on the result
instance passed in to this call.
AVSDirectives
.info | The DirectiveInfo instance for the AVSDirective to process. |
Implements alexaClientSDK::avsCommon::avs::CapabilityAgent.
|
overridevirtual |
A request to a StateProvider
to provide the state. The StateProvider
should perform minimum processing and return quickly, otherwise it will block the processing of updating the states of other StateProviders
. The ContextManager
specifies a token which it uses to track the getContext
request associated with this provideState
request. The stateProviderInterface
must use the same token when it updates its state via the setState
call.
: The setState method MUST be called from a different thread from where the provideState method is being called from.
stateProviderName | The name of the state provider. |
stateRequestToken | The token to use in the setState call. |
NamespaceAndName
is being deprecated. Use the CapabilityMessageIdentifier version instead. Reimplemented from alexaClientSDK::avsCommon::sdkInterfaces::StateProviderInterface.
|
overridevirtual |
|
overridevirtual |
|
override |
|
overridevirtual |
Method to set which player is currently active and which should be the target for playback control by the ExternalMediaPlayer. This is not related to AFML focus.
playerInFocus | The business name of the adapter that has currently acquired focus. |
ExternalMediaAdapterInterface
. Implements alexaClientSDK::acsdkExternalMediaPlayerInterfaces::ExternalMediaPlayerInterface.
|
overridevirtual |
Perform a startup operation.
Implements alexaClientSDK::acsdkStartupManagerInterfaces::RequiresStartupInterface.
|
overridevirtual |
Method used by External Media Player adapters to notify that a change has occurred to the discovered players
addedPlayers | The players that have been added |
removedPlayers | The players that have been removed |
Implements alexaClientSDK::acsdkExternalMediaPlayerInterfaces::ExternalMediaPlayerInterface.
|
static |
The spiVersion of this implementation of ExternalMediaPlayer.
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0