AlexaClientSDK  1.19.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Public Member Functions | Static Public Member Functions | List of all members
alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer Class Reference

#include <AudioPlayer.h>

Inheritance diagram for alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer:
Collaboration graph
[legend]

Public Member Functions

virtual ~AudioPlayer ()=default
 
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
 
ChannelObserverInterface Functions
void onFocusChanged (avsCommon::avs::FocusState newFocus, avsCommon::avs::MixingBehavior behavior) override
 
MediaPlayerObserverInterface Functions
void onFirstByteRead (SourceId id, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
 
void onPlaybackStarted (SourceId id, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
 
void onPlaybackStopped (SourceId id, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
 
void onPlaybackFinished (SourceId id, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
 
void onPlaybackError (SourceId id, const avsCommon::utils::mediaPlayer::ErrorType &type, std::string error, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
 
void onPlaybackPaused (SourceId id, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
 
void onPlaybackResumed (SourceId id, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
 
void onBufferUnderrun (SourceId id, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
 
void onBufferRefilled (SourceId id, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
 
void onBufferingComplete (SourceId id, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
 
void onTags (SourceId id, std::unique_ptr< const VectorOfTags > vectorOfTags, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
 
MediaPlayerFactoryObserverInterface Functions
void onReadyToProvideNextPlayer () override
 
ProgressTimer::ContextInterface methods
void onProgressReportDelayElapsed () override
 
void onProgressReportIntervalElapsed () override
 
void onProgressReportIntervalUpdated () override
 
void requestProgress () override
 
AudioPlayerInterface Functions
void addObserver (std::shared_ptr< avsCommon::sdkInterfaces::AudioPlayerObserverInterface > observer) override
 
void removeObserver (std::shared_ptr< avsCommon::sdkInterfaces::AudioPlayerObserverInterface > observer) override
 
void stopPlayback () override
 
RenderPlayerInfoCardsProviderInterface Functions
void setObserver (std::shared_ptr< avsCommon::sdkInterfaces::RenderPlayerInfoCardsObserverInterface > observer) override
 
MediaPropertiesInterface Functions
std::chrono::milliseconds getAudioItemOffset () override
 
CapabilityConfigurationInterface Functions
std::unordered_set< std::shared_ptr< avsCommon::avs::CapabilityConfiguration > > getCapabilityConfigurations () 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
 
- 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 ()
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::ContextRequesterInterface
virtual ~ContextRequesterInterface ()=default
 
virtual void onContextAvailable (const std::string &jsonContext)
 
virtual void onContextAvailable (const endpoints::EndpointIdentifier &endpointId, const avs::AVSContext &endpointContext, ContextRequestToken requestToken)
 
virtual void onContextFailure (const ContextRequestError error)
 
virtual void onContextFailure (const ContextRequestError error, ContextRequestToken token)
 
- Public Member Functions inherited from alexaClientSDK::capabilityAgents::audioPlayer::ProgressTimer::ContextInterface
virtual ~ContextInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::AudioPlayerInterface
virtual ~AudioPlayerInterface ()=default
 
- 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::CapabilityConfigurationInterface
virtual ~CapabilityConfigurationInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface
virtual ~MediaPlayerObserverInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerFactoryObserverInterface
virtual ~MediaPlayerFactoryObserverInterface ()=default
 
- 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
 

Static Public Member Functions

static std::shared_ptr< AudioPlayercreate (std::unique_ptr< avsCommon::utils::mediaPlayer::MediaPlayerFactoryInterface > mediaPlayerFactory, std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface > messageSender, std::shared_ptr< avsCommon::sdkInterfaces::FocusManagerInterface > focusManager, std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface > contextManager, std::shared_ptr< avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface > exceptionSender, std::shared_ptr< avsCommon::sdkInterfaces::PlaybackRouterInterface > playbackRouter, std::vector< std::shared_ptr< avsCommon::sdkInterfaces::ChannelVolumeInterface >> audioChannelVolumeInterfaces, std::shared_ptr< captions::CaptionManagerInterface > captionManager=nullptr, std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > metricRecorder=nullptr)
 

Additional Inherited Members

- Public Types inherited from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface
enum  TagType {
  TagType::STRING, TagType::UINT, TagType::INT, TagType::DOUBLE,
  TagType::BOOLEAN
}
 The different types of metadata "stream tags". More...
 
using SourceId = MediaPlayerInterface::SourceId
 A type that identifies which source is currently being operated on. More...
 
typedef std::vector< TagKeyValueTypeVectorOfTags
 
- 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 AudioPlayer capability agent.

See also
https://developer.amazon.com/public/solutions/alexa/alexa-voice-service/reference/audioplayer
Note
For instances of this class to be cleaned up correctly, shutdown() must be called.

Constructor & Destructor Documentation

◆ ~AudioPlayer()

virtual alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::~AudioPlayer ( )
virtualdefault

Destructor.

Member Function Documentation

◆ addObserver()

void alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::addObserver ( std::shared_ptr< avsCommon::sdkInterfaces::AudioPlayerObserverInterface observer)
overridevirtual

This function adds an observer to AudioPlayer so that it will get notified for AudioPlayer state changes.

Parameters
observerThe AudioPlayerObserverInterface

Implements alexaClientSDK::avsCommon::sdkInterfaces::AudioPlayerInterface.

◆ cancelDirective()

void alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::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.

◆ create()

std::shared_ptr< AudioPlayer > alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::create ( std::unique_ptr< avsCommon::utils::mediaPlayer::MediaPlayerFactoryInterface mediaPlayerFactory,
std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface messageSender,
std::shared_ptr< avsCommon::sdkInterfaces::FocusManagerInterface focusManager,
std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface contextManager,
std::shared_ptr< avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface exceptionSender,
std::shared_ptr< avsCommon::sdkInterfaces::PlaybackRouterInterface playbackRouter,
std::vector< std::shared_ptr< avsCommon::sdkInterfaces::ChannelVolumeInterface >>  audioChannelVolumeInterfaces,
std::shared_ptr< captions::CaptionManagerInterface captionManager = nullptr,
std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface metricRecorder = nullptr 
)
static

Creates a new AudioPlayer instance.

Parameters
mediaPlayerFactoryThe instance of the MediaPlayerFactoryInterface used to manage players for playing audio.
messageSenderThe object to use for sending events.
focusManagerThe channel focus manager used to manage usage of the dialog channel.
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 AudioPlayer becomes active.
audioChannelVolumeInterfacesA list of ChannelVolumeInterface instances to use to control/attenuate channel volume. These instances are required for controlling volume for the MediaPlayerInterface instances created by
mediaPlayerFactory.
captionManagerThe optional CaptionManagerInterface instance to use for handling captions.
metricRecorderThe metric recorder.
Returns
A std::shared_ptr to the new AudioPlayer instance.

◆ getAudioItemOffset()

std::chrono::milliseconds alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::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::capabilityAgents::audioPlayer::AudioPlayer::getCapabilityConfigurations ( )
overridevirtual

Returns the configurations of the capability interfaces being implemented.

Returns
A set of CapabilityConfigurations

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

◆ getConfiguration()

DirectiveHandlerConfiguration alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::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::capabilityAgents::audioPlayer::AudioPlayer::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::capabilityAgents::audioPlayer::AudioPlayer::handleDirectiveImmediately ( std::shared_ptr< avsCommon::avs::AVSDirective directive)
override

◆ onBufferingComplete()

void alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::onBufferingComplete ( SourceId  id,
const avsCommon::utils::mediaPlayer::MediaPlayerState state 
)
overridevirtual

This is an indication to the observer that the MediaPlayer has completed buffering of the source specified by the id. This can be sent anytime after a source is set. This notification is part of AudioPlayer's implementation for pre-buffering, and must be called by MediaPlayer implementations for this feature to work properly.

Note
The observer must quickly return from this callback. Failure to do so could block the MediaPlayer from further processing.
Parameters
idThe id of the source to which this callback corresponds to.
stateMetadata about the media player state

Reimplemented from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.

◆ onBufferRefilled()

void alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::onBufferRefilled ( SourceId  id,
const avsCommon::utils::mediaPlayer::MediaPlayerState state 
)
overridevirtual

This is an indication to the observer that the MediaPlayer's buffer has refilled. This will only be sent after playback has started. Playback will resume.

Note
The observer must quickly return from this callback. Failure to do so could block the MediaPlayer from further processing.
Parameters
idThe id of the source to which this callback corresponds to.
stateMetadata about the media player state

Reimplemented from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.

◆ onBufferUnderrun()

void alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::onBufferUnderrun ( SourceId  id,
const avsCommon::utils::mediaPlayer::MediaPlayerState state 
)
overridevirtual

This is an indication to the observer that the MediaPlayer is experiencing a buffer underrun. This will only be sent after playback has started. Playback will be paused until the buffer is filled.

Note
The observer must quickly return from this callback. Failure to do so could block the MediaPlayer from further processing.
Parameters
idThe id of the source to which this callback corresponds to.
stateMetadata about the media player state

Reimplemented from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.

◆ onDeregistered()

void alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::onDeregistered ( )
overridevirtual

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

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

◆ onFirstByteRead()

void alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::onFirstByteRead ( SourceId  id,
const avsCommon::utils::mediaPlayer::MediaPlayerState state 
)
overridevirtual

This is an indication to the observer that the MediaPlayer has read its first byte of data.

Parameters
idThe id of the source to which this callback corresponds to.
stateMetadata about the media player state

Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.

◆ onFocusChanged()

void alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::onFocusChanged ( avsCommon::avs::FocusState  newFocus,
avsCommon::avs::MixingBehavior  behavior 
)
overridevirtual

Used to notify the observer of the Channel of focus changes. Once called, the client should make a user observable change only and return immediately. Any additional work that needs to be done should be done on a separate thread or after returning. "User observable change" here refers to events that the end user of the product can visibly see or hear. For example, Alexa speech or music playing would be examples of user observable changes. Other work, such as database storing, logging, or communicating via network should be done on a different thread. Not doing so could result in delays for other clients trying to access the Channel.

Parameters
newFocusThe new Focus of the channel.
behaviorThe mixingBehavior for the ChannelObserver to take as per the interrupt model
Note
when newFocus is FocusState::FOREGROUND, the MixingBehavior shall be guaranteed to be PRIMARY when newFocus is FocusState::NONE, the MixingBehavior shall be guaranteed to be MUST_STOP

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

◆ onPlaybackError()

void alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::onPlaybackError ( SourceId  id,
const avsCommon::utils::mediaPlayer::ErrorType type,
std::string  error,
const avsCommon::utils::mediaPlayer::MediaPlayerState state 
)
overridevirtual

This is an indication to the observer that the MediaPlayer encountered an error. Errors can occur during playback.

Note
The observer must quickly return from this callback. Failure to do so could block the MediaPlayer from further processing.
Parameters
idThe id of the source to which this callback corresponds to.
typeThe type of error encountered by the MediaPlayerInterface.
errorThe error encountered by the MediaPlayerInterface.
stateMetadata about the media player state

Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.

◆ onPlaybackFinished()

void alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::onPlaybackFinished ( SourceId  id,
const avsCommon::utils::mediaPlayer::MediaPlayerState state 
)
overridevirtual

This is an indication to the observer that the MediaPlayer finished the source.

Note
The observer must quickly return to quickly from this callback. Failure to do so could block the MediaPlayer from further processing.
Parameters
idThe id of the source to which this callback corresponds to.
stateMetadata about the media player state

Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.

◆ onPlaybackPaused()

void alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::onPlaybackPaused ( SourceId  id,
const avsCommon::utils::mediaPlayer::MediaPlayerState state 
)
overridevirtual

This is an indication to the observer that the MediaPlayer has paused playing the source.

Note
The observer must quickly return from this callback. Failure to do so could block the MediaPlayer from further processing.
Parameters
idThe id of the source to which this callback corresponds to.
stateMetadata about the media player state

Reimplemented from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.

◆ onPlaybackResumed()

void alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::onPlaybackResumed ( SourceId  id,
const avsCommon::utils::mediaPlayer::MediaPlayerState state 
)
overridevirtual

This is an indication to the observer that the MediaPlayer has resumed playing the source.

Note
The observer must quickly return from this callback. Failure to do so could block the MediaPlayer from further processing.
Parameters
idThe id of the source to which this callback corresponds to.
stateMetadata about the media player state

Reimplemented from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.

◆ onPlaybackStarted()

void alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::onPlaybackStarted ( SourceId  id,
const avsCommon::utils::mediaPlayer::MediaPlayerState state 
)
overridevirtual

This is an indication to the observer that the MediaPlayer has started playing the source specified by the id.

Note
The observer must quickly return to quickly from this callback. Failure to do so could block the MediaPlayer from further processing.
Parameters
idThe id of the source to which this callback corresponds to.
stateMetadata about the media player state

Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.

◆ onPlaybackStopped()

void alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::onPlaybackStopped ( SourceId  id,
const avsCommon::utils::mediaPlayer::MediaPlayerState state 
)
overridevirtual

This is an indication to the observer that the MediaPlayer has stopped the source.

Note
The observer must quickly return from this callback. Failure to do so could block the MediaPlayer from further processing.
Parameters
idThe id of the source to which this callback corresponds to.
stateMetadata about the media player state

Reimplemented from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.

◆ onProgressReportDelayElapsed()

void alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::onProgressReportDelayElapsed ( )
overridevirtual

Notification that it is time to send a ProgressReportDelayElapsed event.

Implements alexaClientSDK::capabilityAgents::audioPlayer::ProgressTimer::ContextInterface.

◆ onProgressReportIntervalElapsed()

void alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::onProgressReportIntervalElapsed ( )
overridevirtual

Notification that it is time to send a ProgressReportIntervalElapsed event.

Implements alexaClientSDK::capabilityAgents::audioPlayer::ProgressTimer::ContextInterface.

◆ onProgressReportIntervalUpdated()

void alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::onProgressReportIntervalUpdated ( )
overridevirtual

Notification that it is time to send a ProgressReportIntervalUpdated event.

Implements alexaClientSDK::capabilityAgents::audioPlayer::ProgressTimer::ContextInterface.

◆ onReadyToProvideNextPlayer()

void alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::onReadyToProvideNextPlayer ( )
overridevirtual

Called when an instance of a MediaPlayerInterface is available. This may be called synchronously with MediaPlayerFactoryInterface::releaseMediaPlayer()

Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerFactoryObserverInterface.

◆ onTags()

void alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::onTags ( SourceId  id,
std::unique_ptr< const VectorOfTags vectorOfTags,
const avsCommon::utils::mediaPlayer::MediaPlayerState state 
)
overridevirtual

This is an indication to the observer that the MediaPlayer has found tags in the stream. Tags are key value pairs extracted from the metadata of the stream. There can be multiple tags that have the same key. Vector preserves the order of insertion (push_back) which may come in handy.

Note
The observer must quickly returnfrom this callback. Failure to do so could block the MediaPlayer from further processing.
Parameters
idThe id of the source to which this callback corresponds to.
vectorOfTagsThe vector containing stream tags.
stateMetadata about the media player state

Reimplemented from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.

◆ preHandleDirective()

void alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::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::capabilityAgents::audioPlayer::AudioPlayer::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.

◆ removeObserver()

void alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::removeObserver ( std::shared_ptr< avsCommon::sdkInterfaces::AudioPlayerObserverInterface observer)
overridevirtual

This function removes an observer from AudioPlayer so that it will no longer be notified of AudioPlayer state changes.

Parameters
observerThe AudioPlayerObserverInterface

Implements alexaClientSDK::avsCommon::sdkInterfaces::AudioPlayerInterface.

◆ requestProgress()

void alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::requestProgress ( )
overridevirtual

Request a (potentially asynchronous) callback to onProgress() with the current progress.

Implements alexaClientSDK::capabilityAgents::audioPlayer::ProgressTimer::ContextInterface.

◆ setObserver()

void alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::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.

◆ stopPlayback()

void alexaClientSDK::capabilityAgents::audioPlayer::AudioPlayer::stopPlayback ( )
overridevirtual

This function stops playback of the current song.

Implements alexaClientSDK::avsCommon::sdkInterfaces::AudioPlayerInterface.


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

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