![]() |
AlexaClientSDK
1.19.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <AudioPlayer.h>


Static Public Member Functions | |
| static std::shared_ptr< 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) |
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< TagKeyValueType > | VectorOfTags |
Protected Member Functions inherited from alexaClientSDK::avsCommon::avs::CapabilityAgent | |
| 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 |
Protected Attributes inherited from alexaClientSDK::avsCommon::avs::CapabilityAgent | |
| 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 AudioPlayer capability agent.
shutdown() must be called.
|
virtualdefault |
Destructor.
|
overridevirtual |
This function adds an observer to AudioPlayer so that it will get notified for AudioPlayer state changes.
| observer | The AudioPlayerObserverInterface |
Implements alexaClientSDK::avsCommon::sdkInterfaces::AudioPlayerInterface.
|
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.
|
static |
Creates a new AudioPlayer instance.
| mediaPlayerFactory | The instance of the MediaPlayerFactoryInterface used to manage players for playing audio. |
| messageSender | The object to use for sending events. |
| focusManager | The channel focus manager used to manage usage of the dialog channel. |
| 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 AudioPlayer becomes active. |
| audioChannelVolumeInterfaces | A 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. | |
| captionManager | The optional CaptionManagerInterface instance to use for handling captions. |
| metricRecorder | The metric recorder. |
std::shared_ptr to the new AudioPlayer instance.
|
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.
|
override |
|
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.
MediaPlayer from further processing.| id | The id of the source to which this callback corresponds to. |
| state | Metadata about the media player state |
Reimplemented from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.
|
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.
MediaPlayer from further processing.| id | The id of the source to which this callback corresponds to. |
| state | Metadata about the media player state |
Reimplemented from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.
|
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.
MediaPlayer from further processing.| id | The id of the source to which this callback corresponds to. |
| state | Metadata about the media player state |
Reimplemented from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.
|
overridevirtual |
Notification that this handler has been de-registered and will not receive any more calls.
Reimplemented from alexaClientSDK::avsCommon::avs::CapabilityAgent.
|
overridevirtual |
This is an indication to the observer that the MediaPlayer has read its first byte of data.
| id | The id of the source to which this callback corresponds to. |
| state | Metadata about the media player state |
Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.
|
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.
| newFocus | The new Focus of the channel. |
| behavior | The mixingBehavior for the ChannelObserver to take as per the interrupt model |
Reimplemented from alexaClientSDK::avsCommon::avs::CapabilityAgent.
|
overridevirtual |
This is an indication to the observer that the MediaPlayer encountered an error. Errors can occur during playback.
MediaPlayer from further processing.| id | The id of the source to which this callback corresponds to. |
| type | The type of error encountered by the MediaPlayerInterface. |
| error | The error encountered by the MediaPlayerInterface. |
| state | Metadata about the media player state |
Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.
|
overridevirtual |
This is an indication to the observer that the MediaPlayer finished the source.
MediaPlayer from further processing.| id | The id of the source to which this callback corresponds to. |
| state | Metadata about the media player state |
Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.
|
overridevirtual |
This is an indication to the observer that the MediaPlayer has paused playing the source.
MediaPlayer from further processing.| id | The id of the source to which this callback corresponds to. |
| state | Metadata about the media player state |
Reimplemented from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.
|
overridevirtual |
This is an indication to the observer that the MediaPlayer has resumed playing the source.
MediaPlayer from further processing.| id | The id of the source to which this callback corresponds to. |
| state | Metadata about the media player state |
Reimplemented from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.
|
overridevirtual |
This is an indication to the observer that the MediaPlayer has started playing the source specified by the id.
MediaPlayer from further processing.| id | The id of the source to which this callback corresponds to. |
| state | Metadata about the media player state |
Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.
|
overridevirtual |
This is an indication to the observer that the MediaPlayer has stopped the source.
MediaPlayer from further processing.| id | The id of the source to which this callback corresponds to. |
| state | Metadata about the media player state |
Reimplemented from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.
|
overridevirtual |
Notification that it is time to send a ProgressReportDelayElapsed event.
Implements alexaClientSDK::capabilityAgents::audioPlayer::ProgressTimer::ContextInterface.
|
overridevirtual |
Notification that it is time to send a ProgressReportIntervalElapsed event.
Implements alexaClientSDK::capabilityAgents::audioPlayer::ProgressTimer::ContextInterface.
|
overridevirtual |
Notification that it is time to send a ProgressReportIntervalUpdated event.
Implements alexaClientSDK::capabilityAgents::audioPlayer::ProgressTimer::ContextInterface.
|
overridevirtual |
Called when an instance of a MediaPlayerInterface is available. This may be called synchronously with MediaPlayerFactoryInterface::releaseMediaPlayer()
Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerFactoryObserverInterface.
|
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.
MediaPlayer from further processing.| id | The id of the source to which this callback corresponds to. |
| vectorOfTags | The vector containing stream tags. |
| state | Metadata about the media player state |
Reimplemented from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.
|
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 |
This function removes an observer from AudioPlayer so that it will no longer be notified of AudioPlayer state changes.
| observer | The AudioPlayerObserverInterface |
Implements alexaClientSDK::avsCommon::sdkInterfaces::AudioPlayerInterface.
|
overridevirtual |
Request a (potentially asynchronous) callback to onProgress() with the current progress.
Implements alexaClientSDK::capabilityAgents::audioPlayer::ProgressTimer::ContextInterface.
|
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.
| observer | The RenderPlayerInfoCardsObserverInterface |
Implements alexaClientSDK::avsCommon::sdkInterfaces::RenderPlayerInfoCardsProviderInterface.
|
overridevirtual |
This function stops playback of the current song.
Implements alexaClientSDK::avsCommon::sdkInterfaces::AudioPlayerInterface.
AlexaClientSDK 1.19.0 - Copyright 2016-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0