AlexaClientSDK  1.25.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer Class Reference

#include <ExternalMediaPlayer.h>

Inheritance diagram for alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer:
Collaboration graph
[legend]

Public Types

using AdapterMediaPlayerMap = std::unordered_map< std::string, std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerInterface > >
 
using AdapterSpeakerMap = std::unordered_map< std::string, std::shared_ptr< avsCommon::sdkInterfaces::ChannelVolumeInterface > >
 
using 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 AdapterCreationMap = std::unordered_map< std::string, AdapterCreateFunction >
 
- Public Types inherited from alexaClientSDK::avsCommon::sdkInterfaces::LocalPlaybackHandlerInterface
enum  PlaybackOperation { STOP_PLAYBACK, PAUSE_PLAYBACK, RESUME_PLAYBACK }
 Available local operations. More...
 

Public Member Functions

std::map< std::string, std::shared_ptr< acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterInterface > > getAdaptersMap ()
 
ContextRequesterInterface Functions
void onContextAvailable (const std::string &jsonContext) override
 
void onContextFailure (const avsCommon::sdkInterfaces::ContextRequestError error) override
 
StateProviderInterface Functions
void provideState (const avsCommon::avs::NamespaceAndName &stateProviderName, unsigned int stateRequestToken) override
 
CapabilityAgent/DirectiveHandlerInterface Functions
void handleDirectiveImmediately (std::shared_ptr< avsCommon::avs::AVSDirective > directive) override
 
void preHandleDirective (std::shared_ptr< DirectiveInfo > info) override
 
void handleDirective (std::shared_ptr< DirectiveInfo > info) override
 
void cancelDirective (std::shared_ptr< DirectiveInfo > info) override
 
void onDeregistered () override
 
avsCommon::avs::DirectiveHandlerConfiguration getConfiguration () const override
 
Overridden PlaybackHandlerInterface methods.
virtual void onButtonPressed (avsCommon::avs::PlaybackButton button) override
 
virtual void onTogglePressed (avsCommon::avs::PlaybackToggle toggle, bool action) override
 
Overridden ExternalMediaPlayerInterface methods.
virtual void setPlayerInFocus (const std::string &playerInFocus) override
 
virtual void updateDiscoveredPlayers (const std::vector< acsdkExternalMediaPlayerInterfaces::DiscoveredPlayerInfo > &addedPlayers, const std::unordered_set< std::string > &removedLocalPlayerIds) override
 
virtual void addAdapterHandler (std::shared_ptr< acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface > adapterHandler) override
 
virtual void removeAdapterHandler (std::shared_ptr< acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface > adapterHandler) override
 
virtual void addObserver (const std::shared_ptr< acsdkExternalMediaPlayerInterfaces::ExternalMediaPlayerObserverInterface > observer) override
 
virtual void removeObserver (const std::shared_ptr< acsdkExternalMediaPlayerInterfaces::ExternalMediaPlayerObserverInterface > observer) override
 
CapabilityConfigurationInterface Functions
std::unordered_set< std::shared_ptr< avsCommon::avs::CapabilityConfiguration > > getCapabilityConfigurations () override
 
RenderPlayerInfoCardsProviderInterface Functions
void setObserver (std::shared_ptr< avsCommon::sdkInterfaces::RenderPlayerInfoCardsObserverInterface > observer) override
 
LocalPlaybackHandlerInterface Functions
bool localOperation (PlaybackOperation op) override
 
bool localSeekTo (std::chrono::milliseconds location, bool fromStart) override
 
MediaPropertiesInterface Functions
std::chrono::milliseconds getAudioItemOffset () override
 
std::chrono::milliseconds getAudioItemDuration () override
 
RequiresStartupInterface methods
bool startup () override
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::avs::CapabilityAgent
virtual ~CapabilityAgent ()=default
 
void preHandleDirective (std::shared_ptr< AVSDirective > directive, std::unique_ptr< sdkInterfaces::DirectiveHandlerResultInterface > result) override final
 
bool handleDirective (const std::string &messageId) override final
 
void cancelDirective (const std::string &messageId) override final
 
void onFocusChanged (FocusState newFocus, MixingBehavior behavior) override
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface
virtual ~DirectiveHandlerInterface ()=default
 
virtual void handleDirectiveImmediately (std::shared_ptr< avsCommon::avs::AVSDirective > directive)=0
 
virtual void preHandleDirective (std::shared_ptr< avsCommon::avs::AVSDirective > directive, std::unique_ptr< DirectiveHandlerResultInterface > result)=0
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::ChannelObserverInterface
virtual ~ChannelObserverInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::StateProviderInterface
virtual ~StateProviderInterface ()=default
 
virtual void provideState (const avs::CapabilityTag &stateProviderName, const ContextRequestToken stateRequestToken)
 
virtual bool canStateBeRetrieved ()
 
virtual bool hasReportableStateProperties ()
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::ContextRequesterInterface
virtual ~ContextRequesterInterface ()=default
 
virtual void onContextAvailable (const endpoints::EndpointIdentifier &endpointId, const avs::AVSContext &endpointContext, ContextRequestToken requestToken)
 
virtual void onContextFailure (const ContextRequestError error, ContextRequestToken token)
 
- 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
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::CapabilityConfigurationInterface
virtual ~CapabilityConfigurationInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::acsdkExternalMediaPlayerInterfaces::ExternalMediaPlayerInterface
virtual ~ExternalMediaPlayerInterface ()=default
 
virtual void updateDiscoveredPlayers (const std::vector< DiscoveredPlayerInfo > &addedPlayers, const std::unordered_set< std::string > &removedLocalPlayerIds)=0
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::MediaPropertiesInterface
virtual ~MediaPropertiesInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::RenderPlayerInfoCardsProviderInterface
virtual ~RenderPlayerInfoCardsProviderInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::PlaybackHandlerInterface
virtual ~PlaybackHandlerInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::LocalPlaybackHandlerInterface
virtual ~LocalPlaybackHandlerInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::acsdkStartupManagerInterfaces::RequiresStartupInterface
virtual ~RequiresStartupInterface ()=default
 

Static Public Member Functions

static std::shared_ptr< acsdkExternalMediaPlayerInterfaces::ExternalMediaPlayerInterfacecreateExternalMediaPlayerInterface (std::shared_ptr< ExternalMediaPlayer > externalMediaPlayer)
 
static std::shared_ptr< ExternalMediaPlayercreateExternalMediaPlayer (std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface > messageSender, std::shared_ptr< certifiedSender::CertifiedSender > certifiedMessageSender, std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface > contextManager, std::shared_ptr< avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface > exceptionSender, std::shared_ptr< avsCommon::sdkInterfaces::PlaybackRouterInterface > playbackRouter, acsdkManufactory::Annotated< avsCommon::sdkInterfaces::endpoints::DefaultEndpointAnnotation, avsCommon::sdkInterfaces::endpoints::EndpointCapabilitiesRegistrarInterface > endpointCapabilitiesRegistrar, std::shared_ptr< acsdkShutdownManagerInterfaces::ShutdownNotifierInterface > shutdownNotifier, std::shared_ptr< acsdkStartupManagerInterfaces::StartupNotifierInterface > startupNotifier, std::shared_ptr< avsCommon::sdkInterfaces::RenderPlayerInfoCardsProviderRegistrarInterface > renderPlayerInfoCardsProviderRegistrar, std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > metricRecorder)
 
static std::shared_ptr< ExternalMediaPlayercreateExternalMediaPlayerWithAdapters (const acsdkExternalMediaPlayer::ExternalMediaPlayer::AdapterCreationMap &adapterCreationMap, std::shared_ptr< acsdkApplicationAudioPipelineFactoryInterfaces::ApplicationAudioPipelineFactoryInterface > audioPipelineFactory, std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface > messageSender, std::shared_ptr< certifiedSender::CertifiedSender > certifiedMessageSender, acsdkManufactory::Annotated< avsCommon::sdkInterfaces::AudioFocusAnnotation, avsCommon::sdkInterfaces::FocusManagerInterface > audioFocusManager, std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface > contextManager, std::shared_ptr< avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface > exceptionSender, std::shared_ptr< avsCommon::sdkInterfaces::PlaybackRouterInterface > playbackRouter, acsdkManufactory::Annotated< avsCommon::sdkInterfaces::endpoints::DefaultEndpointAnnotation, avsCommon::sdkInterfaces::endpoints::EndpointCapabilitiesRegistrarInterface > endpointCapabilitiesRegistrar, std::shared_ptr< acsdkShutdownManagerInterfaces::ShutdownNotifierInterface > shutdownNotifier, std::shared_ptr< acsdkStartupManagerInterfaces::StartupNotifierInterface > startupNotifier, std::shared_ptr< avsCommon::sdkInterfaces::RenderPlayerInfoCardsProviderRegistrarInterface > renderPlayerInfoCardsProviderRegistrar, std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > metricRecorder, std::shared_ptr< avsCommon::sdkInterfaces::SpeakerManagerInterface > speakerManager)
 

Static Public Attributes

static constexpr const char * SPI_VERSION = "1.0"
 The spiVersion of this implementation of ExternalMediaPlayer. More...
 

Additional Inherited Members

- Protected Member Functions inherited from alexaClientSDK::avsCommon::avs::CapabilityAgent
 CapabilityAgent (const std::string &nameSpace, std::shared_ptr< sdkInterfaces::ExceptionEncounteredSenderInterface > exceptionEncounteredSender)
 
virtual std::shared_ptr< DirectiveInfocreateDirectiveInfo (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
 
- Protected Attributes inherited from alexaClientSDK::avsCommon::avs::CapabilityAgent
const std::string m_namespace
 The namespace of the capability agent. More...
 
std::shared_ptr< sdkInterfaces::ExceptionEncounteredSenderInterfacem_exceptionEncounteredSender
 Object to use to send exceptionEncountered messages. More...
 

Detailed Description

This class implements the ExternalMediaPlayer capability agent. This agent is responsible for handling music service providers which manage their PLAY queue.

Note
For instances of this class to be cleaned up correctly, shutdown() must be called.

Member Typedef Documentation

◆ AdapterCreateFunction

◆ AdapterCreationMap

◆ AdapterMediaPlayerMap

◆ AdapterSpeakerMap

Member Function Documentation

◆ addAdapterHandler()

void alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::addAdapterHandler ( std::shared_ptr< acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface adapterHandler)
overridevirtual

◆ addObserver()

void alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::addObserver ( const std::shared_ptr< acsdkExternalMediaPlayerInterfaces::ExternalMediaPlayerObserverInterface observer)
overridevirtual

Adds an observer which will be notified on any observable state changes

Parameters
observerThe observer to add

Implements alexaClientSDK::acsdkExternalMediaPlayerInterfaces::ExternalMediaPlayerInterface.

◆ cancelDirective()

void alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::cancelDirective ( std::shared_ptr< DirectiveInfo info)
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.

Note
The implementation of this method MUST be thread-safe.
The implementation of this method MUST return quickly. Failure to do so blocks the processing of subsequent AVSDirectives.
Parameters
infoThe DirectiveInfo instance for the AVSDirective to process.

Implements alexaClientSDK::avsCommon::avs::CapabilityAgent.

◆ createExternalMediaPlayer()

std::shared_ptr< ExternalMediaPlayer > alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::createExternalMediaPlayer ( std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface messageSender,
std::shared_ptr< certifiedSender::CertifiedSender certifiedMessageSender,
std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface contextManager,
std::shared_ptr< avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface exceptionSender,
std::shared_ptr< avsCommon::sdkInterfaces::PlaybackRouterInterface playbackRouter,
acsdkManufactory::Annotated< avsCommon::sdkInterfaces::endpoints::DefaultEndpointAnnotation, avsCommon::sdkInterfaces::endpoints::EndpointCapabilitiesRegistrarInterface endpointCapabilitiesRegistrar,
std::shared_ptr< acsdkShutdownManagerInterfaces::ShutdownNotifierInterface shutdownNotifier,
std::shared_ptr< acsdkStartupManagerInterfaces::StartupNotifierInterface startupNotifier,
std::shared_ptr< avsCommon::sdkInterfaces::RenderPlayerInfoCardsProviderRegistrarInterface renderPlayerInfoCardsProviderRegistrar,
std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface metricRecorder 
)
static

Factory method to create a new ExternalMediaPlayer.

Parameters
messageSenderThe object to use for sending events.
certifiedMessageSenderUsed to send messages that must be guaranteed.
contextManagerThe AVS Context Manager used to generate system context for events.
exceptionSenderThe object to use for sending AVS Exception messages.
playbackRouterThe PlaybackRouterInterface instance to use when the EMP becomes active.
endpointCapabilitiesRegistrarThe EndpointCapabilitiesRegistratInterface to use to register this capability with the default endpoint.
shutdownNotifierThe object that will notify this EMP should shut down.
startupNotifierThe object that will notify this EMP to startup.
renderPlayerInfoCardsProviderRegistrarThe registrar for this PlayerInfoCardsProvider.
metricRecorderThe object to record metrics.
Returns
A shared pointer to an ExternalMediaPlayer.

◆ createExternalMediaPlayerInterface()

std::shared_ptr< acsdkExternalMediaPlayerInterfaces::ExternalMediaPlayerInterface > alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::createExternalMediaPlayerInterface ( std::shared_ptr< ExternalMediaPlayer externalMediaPlayer)
static

Forwards an ExternalMediaPlayer as an ExternalMediaPlayerInterface.

Parameters
externalMediaPlayerThe object to forward.
Returns
A shared_ptr to ExternalMediaPlayerInterface.

◆ createExternalMediaPlayerWithAdapters()

std::shared_ptr< ExternalMediaPlayer > alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::createExternalMediaPlayerWithAdapters ( const acsdkExternalMediaPlayer::ExternalMediaPlayer::AdapterCreationMap adapterCreationMap,
std::shared_ptr< acsdkApplicationAudioPipelineFactoryInterfaces::ApplicationAudioPipelineFactoryInterface audioPipelineFactory,
std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface messageSender,
std::shared_ptr< certifiedSender::CertifiedSender certifiedMessageSender,
acsdkManufactory::Annotated< avsCommon::sdkInterfaces::AudioFocusAnnotation, avsCommon::sdkInterfaces::FocusManagerInterface audioFocusManager,
std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface contextManager,
std::shared_ptr< avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface exceptionSender,
std::shared_ptr< avsCommon::sdkInterfaces::PlaybackRouterInterface playbackRouter,
acsdkManufactory::Annotated< avsCommon::sdkInterfaces::endpoints::DefaultEndpointAnnotation, avsCommon::sdkInterfaces::endpoints::EndpointCapabilitiesRegistrarInterface endpointCapabilitiesRegistrar,
std::shared_ptr< acsdkShutdownManagerInterfaces::ShutdownNotifierInterface shutdownNotifier,
std::shared_ptr< acsdkStartupManagerInterfaces::StartupNotifierInterface startupNotifier,
std::shared_ptr< avsCommon::sdkInterfaces::RenderPlayerInfoCardsProviderRegistrarInterface renderPlayerInfoCardsProviderRegistrar,
std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface metricRecorder,
std::shared_ptr< avsCommon::sdkInterfaces::SpeakerManagerInterface speakerManager 
)
static

Factory method to create a new ExternalMediaPlayer.

Deprecated:
This is for backwards compatibility only; prefer createExternalMediaPlayer which does not create adapters as part of EMP initialization, and instead adapters should register themselves with EMP.
Parameters
adapterCreationMapA map of <playerId: AdapterCreateFunction> that this EMP will use to instantiate adapters.
audioPipelineFactoryThe object to use for creating the media players and related interfaces for the adapters.
messageSenderThe object to use for sending events.
certifiedMessageSenderUsed to send messages that must be guaranteed.
audioFocusManagerThe object used to manage audio focus for the adapter managed by the EMP.
contextManagerThe AVS Context Manager used to generate system context for events.
exceptionSenderThe object to use for sending AVS Exception messages.
playbackRouterThe PlaybackRouterInterface instance to use when the EMP becomes active.
endpointCapabilitiesRegistrarThe EndpointCapabilitiesRegistratInterface to use to register this capability with the default endpoint.
shutdownNotifierThe object that will notify this EMP should shut down.
startupNotifierThe object that will notify this EMP to startup.
renderPlayerInfoCardsProviderRegistrarThe registrar for this PlayerInfoCardsProvider.
metricRecorderThe object to record metrics.
Returns
A shared pointer to an ExternalMediaPlayer.

◆ getAdaptersMap()

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

Returns
The Map of localPlayerId (business names) to adapters.

◆ getAudioItemDuration()

std::chrono::milliseconds alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::getAudioItemDuration ( )
overridevirtual

Returns the duration of the current AudioItem the player is handling.

Returns
returns the duration.

Reimplemented from alexaClientSDK::avsCommon::sdkInterfaces::MediaPropertiesInterface.

◆ getAudioItemOffset()

std::chrono::milliseconds alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::getAudioItemOffset ( )
overridevirtual

This function retrieves the offset of the current AudioItem the player is handling.

Returns
This returns the offset in milliseconds.

Implements alexaClientSDK::avsCommon::sdkInterfaces::MediaPropertiesInterface.

◆ getCapabilityConfigurations()

std::unordered_set< std::shared_ptr< avsCommon::avs::CapabilityConfiguration > > alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::getCapabilityConfigurations ( )
overridevirtual

Returns the configurations of the capability interfaces being implemented.

Returns
A set of CapabilityConfigurations

Implements alexaClientSDK::avsCommon::sdkInterfaces::CapabilityConfigurationInterface.

◆ getConfiguration()

DirectiveHandlerConfiguration alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::getConfiguration ( ) const
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).

Returns
The avs::DirectiveHandlerConfiguration of the handler.

Implements alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface.

◆ handleDirective()

void alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::handleDirective ( std::shared_ptr< DirectiveInfo info)
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.

Note
The implementation of this method MUST be thread-safe.
The implementation of this method MUST return quickly. Failure to do so blocks the processing of subsequent AVSDirectives.
Parameters
infoThe DirectiveInfo instance for the AVSDirective to process.

Implements alexaClientSDK::avsCommon::avs::CapabilityAgent.

◆ handleDirectiveImmediately()

void alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::handleDirectiveImmediately ( std::shared_ptr< avsCommon::avs::AVSDirective directive)
override

◆ localOperation()

bool alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::localOperation ( PlaybackOperation  op)
overridevirtual

Request the handler to perform a local playback operation.

Parameters
opOperation to request
Returns
true if successful, false if the operation cannot be performed locally.

Implements alexaClientSDK::avsCommon::sdkInterfaces::LocalPlaybackHandlerInterface.

◆ localSeekTo()

bool alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::localSeekTo ( std::chrono::milliseconds  location,
bool  fromStart 
)
overridevirtual

Request the handler to perform a local seek operation.

Parameters
locationPosition to seek to
fromStarttrue to seek to absolute location, false to seek reletive to current location.
Returns
true if successful, false if the operation cannot be performed locally.

Implements alexaClientSDK::avsCommon::sdkInterfaces::LocalPlaybackHandlerInterface.

◆ onButtonPressed()

void alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::onButtonPressed ( avsCommon::avs::PlaybackButton  button)
overridevirtual

Used to notify the handler when a playback button is pressed.

Parameters
buttonThe button that has been pressed.

Implements alexaClientSDK::avsCommon::sdkInterfaces::PlaybackHandlerInterface.

◆ onContextAvailable()

void alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::onContextAvailable ( const std::string &  jsonContext)
overridevirtual

This is called by the ContextManager once the context is ready and available.

Deprecated:
This method is being deprecated since it cannot specify the source endpoint.
Note
The ContextRequester should perform minimum processing and return quickly. Otherwise it will block the processing of updating the of other ContextProviders.
Parameters
jsonContextContext information.Context provided is of the format {"context"[{...}, {...}]}

Reimplemented from alexaClientSDK::avsCommon::sdkInterfaces::ContextRequesterInterface.

◆ onContextFailure()

void alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::onContextFailure ( const avsCommon::sdkInterfaces::ContextRequestError  error)
overridevirtual

The contextManager calls this if it is unable to process a getContext request successfully.

Deprecated:
This method is being deprecated since it cannot specify the optional token.
Note
The ContextRequester should perform minimum processing and return quickly. Otherwise it will block the processing of updating the of other ContextProviders.
Parameters
errorThe reason why the getContext request failed.

Reimplemented from alexaClientSDK::avsCommon::sdkInterfaces::ContextRequesterInterface.

◆ onDeregistered()

void alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::onDeregistered ( )
overridevirtual

Notification that this handler has been de-registered and will not receive any more calls.

Reimplemented from alexaClientSDK::avsCommon::avs::CapabilityAgent.

◆ onTogglePressed()

void alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::onTogglePressed ( avsCommon::avs::PlaybackToggle  toggle,
bool  action 
)
overridevirtual

Used to notify the handler when a playback toggle is pressed.

Parameters
toggleThe toggle that has been pressed.
actionThe boolean action for the toggle state

Implements alexaClientSDK::avsCommon::sdkInterfaces::PlaybackHandlerInterface.

◆ preHandleDirective()

void alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::preHandleDirective ( std::shared_ptr< DirectiveInfo info)
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.

Note
The implementation of this method MUST be thread-safe.
The implementation of this method MUST return quickly. Failure to do so blocks the processing of subsequent AVSDirectives.
Parameters
infoThe DirectiveInfo instance for the AVSDirective to process.

Implements alexaClientSDK::avsCommon::avs::CapabilityAgent.

◆ provideState()

void alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::provideState ( const avsCommon::avs::NamespaceAndName stateProviderName,
unsigned int  stateRequestToken 
)
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.

Parameters
stateProviderNameThe name of the state provider.
stateRequestTokenThe token to use in the setState call.
Deprecated:
NamespaceAndName is being deprecated. Use the CapabilityMessageIdentifier version instead.

Reimplemented from alexaClientSDK::avsCommon::sdkInterfaces::StateProviderInterface.

◆ removeAdapterHandler()

void alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::removeAdapterHandler ( std::shared_ptr< acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface adapterHandler)
overridevirtual

◆ removeObserver()

void alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::removeObserver ( const std::shared_ptr< acsdkExternalMediaPlayerInterfaces::ExternalMediaPlayerObserverInterface observer)
overridevirtual

Removes an observer from the list of active watchers

Parameters
observerThe observer to remove

Implements alexaClientSDK::acsdkExternalMediaPlayerInterfaces::ExternalMediaPlayerInterface.

◆ setObserver()

void alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::setObserver ( std::shared_ptr< avsCommon::sdkInterfaces::RenderPlayerInfoCardsObserverInterface observer)
overridevirtual

This function sets an RenderPlayerInfoCardsObserverInterface so that it will get notified for RenderPlayerInfoCards state changes. This implies that there can be one or no observer at a given time.

Parameters
observerThe RenderPlayerInfoCardsObserverInterface

Implements alexaClientSDK::avsCommon::sdkInterfaces::RenderPlayerInfoCardsProviderInterface.

◆ setPlayerInFocus()

void alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::setPlayerInFocus ( const std::string &  playerInFocus)
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.

Parameters
playerInFocusThe business name of the adapter that has currently acquired focus.
Note
This function should not be called during the callback in ExternalMediaAdapterInterface.

Implements alexaClientSDK::acsdkExternalMediaPlayerInterfaces::ExternalMediaPlayerInterface.

◆ startup()

bool alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::startup ( )
overridevirtual

Perform a startup operation.

Returns
Whether startup should continue.

Implements alexaClientSDK::acsdkStartupManagerInterfaces::RequiresStartupInterface.

◆ updateDiscoveredPlayers()

void alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::updateDiscoveredPlayers ( const std::vector< acsdkExternalMediaPlayerInterfaces::DiscoveredPlayerInfo > &  addedPlayers,
const std::unordered_set< std::string > &  removedLocalPlayerIds 
)
overridevirtual

Member Data Documentation

◆ SPI_VERSION

constexpr const char* alexaClientSDK::acsdkExternalMediaPlayer::ExternalMediaPlayer::SPI_VERSION = "1.0"
static

The spiVersion of this implementation of ExternalMediaPlayer.


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

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