AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Namespaces | Classes | Enumerations | Functions
alexaClientSDK::acsdkAudioPlayer Namespace Reference

Namespaces

 test
 

Classes

struct  AudioItem
 Struct which contains all the fields which define an audio item for a Play directive. More...
 
class  AudioPlayer
 
class  ProgressTimer
 
class  Util
 

Enumerations

enum  AudioPlayerState {
  AudioPlayerState::IDLE, AudioPlayerState::BUFFERING, AudioPlayerState::BUFFER_UNDERRUN, AudioPlayerState::PLAYING,
  AudioPlayerState::STOPPED, AudioPlayerState::PAUSED, AudioPlayerState::FINISHED
}
 
enum  ClearBehavior { ClearBehavior::CLEAR_ENQUEUED, ClearBehavior::CLEAR_ALL }
 Used to determine clear queue behavior. More...
 
enum  StreamFormat { StreamFormat::AUDIO_MPEG, StreamFormat::UNKNOWN }
 Specifies the format of a binary audio attachment in a Play directive. More...
 

Functions

std::string playerStateToString (AudioPlayerState state)
 
acsdkManufactory::Component< std::shared_ptr< acsdkAudioPlayerInterfaces::AudioPlayerInterface >, acsdkManufactory::Import< std::shared_ptr< avsCommon::sdkInterfaces::RenderPlayerInfoCardsProviderRegistrarInterface > >, acsdkManufactory::Import< std::shared_ptr< avsCommon::utils::configuration::ConfigurationNode > >, acsdkManufactory::Import< std::shared_ptr< acsdkApplicationAudioPipelineFactoryInterfaces::ApplicationAudioPipelineFactoryInterface > >, acsdkManufactory::Import< acsdkManufactory::Annotated< avsCommon::sdkInterfaces::AudioFocusAnnotation, avsCommon::sdkInterfaces::FocusManagerInterface > >, acsdkManufactory::Import< std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface > >, acsdkManufactory::Import< std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface > >, acsdkManufactory::Import< std::shared_ptr< avsCommon::sdkInterfaces::PlaybackRouterInterface > >, acsdkManufactory::Import< std::shared_ptr< captions::CaptionManagerInterface > >, acsdkManufactory::Import< std::shared_ptr< avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface > >, acsdkManufactory::Import< std::shared_ptr< acsdkShutdownManagerInterfaces::ShutdownNotifierInterface > >, acsdkManufactory::Import< acsdkManufactory::Annotated< avsCommon::sdkInterfaces::endpoints::DefaultEndpointAnnotation, avsCommon::sdkInterfaces::endpoints::EndpointCapabilitiesRegistrarInterface > >, acsdkManufactory::Import< std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > >, acsdkManufactory::Import< std::shared_ptr< cryptoInterfaces::CryptoFactoryInterface > > > getComponent (const std::string &configParentKey="")
 
acsdkManufactory::Component< std::shared_ptr< acsdkAudioPlayerInterfaces::AudioPlayerInterface >, acsdkManufactory::Import< std::shared_ptr< avsCommon::utils::mediaPlayer::PooledMediaResourceProviderInterface > >, acsdkManufactory::Import< std::shared_ptr< avsCommon::sdkInterfaces::RenderPlayerInfoCardsProviderRegistrarInterface > >, acsdkManufactory::Import< acsdkManufactory::Annotated< avsCommon::sdkInterfaces::AudioFocusAnnotation, avsCommon::sdkInterfaces::FocusManagerInterface > >, acsdkManufactory::Import< std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface > >, acsdkManufactory::Import< std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface > >, acsdkManufactory::Import< std::shared_ptr< avsCommon::sdkInterfaces::PlaybackRouterInterface > >, acsdkManufactory::Import< std::shared_ptr< captions::CaptionManagerInterface > >, acsdkManufactory::Import< std::shared_ptr< avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface > >, acsdkManufactory::Import< std::shared_ptr< acsdkShutdownManagerInterfaces::ShutdownNotifierInterface > >, acsdkManufactory::Import< acsdkManufactory::Annotated< avsCommon::sdkInterfaces::endpoints::DefaultEndpointAnnotation, avsCommon::sdkInterfaces::endpoints::EndpointCapabilitiesRegistrarInterface > >, acsdkManufactory::Import< std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > >, acsdkManufactory::Import< std::shared_ptr< cryptoInterfaces::CryptoFactoryInterface > > > getBackwardsCompatibleComponent ()
 
std::string clearBehaviorToString (ClearBehavior clearBehavior)
 
bool stringToClearBehavior (const std::string &text, ClearBehavior *clearBehavior)
 
std::ostream & operator<< (std::ostream &stream, const ClearBehavior &clearBehavior)
 
bool convertToValue (const rapidjson::Value &documentNode, ClearBehavior *clearBehavior)
 
std::string streamFormatToString (StreamFormat streamFormat)
 
bool stringToStreamFormat (const std::string &text, StreamFormat *streamFormat)
 
std::ostream & operator<< (std::ostream &stream, const StreamFormat &streamFormat)
 
bool convertToValue (const rapidjson::Value &documentNode, StreamFormat *streamFormat)
 

Enumeration Type Documentation

◆ AudioPlayerState

Splitting AudioPlayer internal state from the external facing PlayerActivity the change here is trivial, but the sematics of BUFFERING vs BUFFER_UNDERRUN are slightly different so, this was a recommended path from the sdk team

Enumerator
IDLE 

Initial state, prior to acting on the first Play directive, or after the current queue is finished.

BUFFERING 

Indicates that an audio stream is pre-buffering, but is not ready to play.

BUFFER_UNDERRUN 

Indicates that an audio stream under-run has interrupted playback The difference between BUFFERING and BUFFER_UNDERRUN only affects a couple of behaviors

PLAYING 

Indicates that audio is currently playing.

STOPPED 

Indicates that audio playback was stopped due to an error or a directive which stops or replaces the current stream.

PAUSED 

Indicates that the audio stream has been paused.

FINISHED 

Indicates that playback has finished.

◆ ClearBehavior

Used to determine clear queue behavior.

Enumerator
CLEAR_ENQUEUED 

Clears the queue and continues to play the currently playing stream.

CLEAR_ALL 

Clears the entire playback queue and stops the currently playing stream (if applicable).

◆ StreamFormat

Specifies the format of a binary audio attachment in a Play directive.

Enumerator
AUDIO_MPEG 

Audio is in mpeg format.

UNKNOWN 

Audio is an unknown/unsupported format.

Function Documentation

◆ clearBehaviorToString()

std::string alexaClientSDK::acsdkAudioPlayer::clearBehaviorToString ( ClearBehavior  clearBehavior)
inline

Convert a ClearBehavior to an AVS-compliant std::string.

Parameters
clearBehaviorThe ClearBehavior to convert.
Returns
The AVS-compliant string representation of clearBehavior.

◆ convertToValue() [1/2]

bool alexaClientSDK::acsdkAudioPlayer::convertToValue ( const rapidjson::Value &  documentNode,
StreamFormat streamFormat 
)
inline

Convert a StreamFormat to a rapidjson::Value.

Parameters
documentNodeThe rapidjson::Value to write to.
streamFormatThe StreamFormat to convert.
Returns
true if conversion is successful, else false.

◆ convertToValue() [2/2]

bool alexaClientSDK::acsdkAudioPlayer::convertToValue ( const rapidjson::Value &  documentNode,
ClearBehavior clearBehavior 
)
inline

Convert a ClearBehavior to a rapidjson::Value.

Parameters
documentNodeThe rapidjson::Value to write to.
clearBehaviorThe ClearBehavior to convert.
Returns
true if conversion is successful, else false.

◆ getBackwardsCompatibleComponent()

acsdkManufactory::Component< std::shared_ptr<acsdkAudioPlayerInterfaces::AudioPlayerInterface>, acsdkManufactory::Import<std::shared_ptr<avsCommon::utils::mediaPlayer::PooledMediaResourceProviderInterface> >, acsdkManufactory::Import< std::shared_ptr<avsCommon::sdkInterfaces::RenderPlayerInfoCardsProviderRegistrarInterface> >, acsdkManufactory::Import<acsdkManufactory::Annotated< avsCommon::sdkInterfaces::AudioFocusAnnotation, avsCommon::sdkInterfaces::FocusManagerInterface> >, acsdkManufactory::Import<std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> >, acsdkManufactory::Import<std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> >, acsdkManufactory::Import<std::shared_ptr<avsCommon::sdkInterfaces::PlaybackRouterInterface> >, acsdkManufactory::Import<std::shared_ptr<captions::CaptionManagerInterface> >, acsdkManufactory::Import<std::shared_ptr<avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface> >, acsdkManufactory::Import<std::shared_ptr<acsdkShutdownManagerInterfaces::ShutdownNotifierInterface> >, acsdkManufactory::Import<acsdkManufactory::Annotated< avsCommon::sdkInterfaces::endpoints::DefaultEndpointAnnotation, avsCommon::sdkInterfaces::endpoints::EndpointCapabilitiesRegistrarInterface> >, acsdkManufactory::Import<std::shared_ptr<avsCommon::utils::metrics::MetricRecorderInterface> >, acsdkManufactory::Import<std::shared_ptr<cryptoInterfaces::CryptoFactoryInterface> > > alexaClientSDK::acsdkAudioPlayer::getBackwardsCompatibleComponent ( )

Creates an manufactory component that exports AudioPlayer-related implementations.

Deprecated:
This is for backwards compatibility only to allow the application to inject a PooledMediaResourceProviderInterface; prefer using getComponent.
Returns
A component.

◆ getComponent()

acsdkManufactory::Component< std::shared_ptr<acsdkAudioPlayerInterfaces::AudioPlayerInterface>, acsdkManufactory::Import< std::shared_ptr<avsCommon::sdkInterfaces::RenderPlayerInfoCardsProviderRegistrarInterface> >, acsdkManufactory::Import<std::shared_ptr<avsCommon::utils::configuration::ConfigurationNode> >, acsdkManufactory::Import< std::shared_ptr<acsdkApplicationAudioPipelineFactoryInterfaces::ApplicationAudioPipelineFactoryInterface> >, acsdkManufactory::Import<acsdkManufactory::Annotated< avsCommon::sdkInterfaces::AudioFocusAnnotation, avsCommon::sdkInterfaces::FocusManagerInterface> >, acsdkManufactory::Import<std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> >, acsdkManufactory::Import<std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> >, acsdkManufactory::Import<std::shared_ptr<avsCommon::sdkInterfaces::PlaybackRouterInterface> >, acsdkManufactory::Import<std::shared_ptr<captions::CaptionManagerInterface> >, acsdkManufactory::Import<std::shared_ptr<avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface> >, acsdkManufactory::Import<std::shared_ptr<acsdkShutdownManagerInterfaces::ShutdownNotifierInterface> >, acsdkManufactory::Import<acsdkManufactory::Annotated< avsCommon::sdkInterfaces::endpoints::DefaultEndpointAnnotation, avsCommon::sdkInterfaces::endpoints::EndpointCapabilitiesRegistrarInterface> >, acsdkManufactory::Import<std::shared_ptr<avsCommon::utils::metrics::MetricRecorderInterface> >, acsdkManufactory::Import<std::shared_ptr<cryptoInterfaces::CryptoFactoryInterface> > > alexaClientSDK::acsdkAudioPlayer::getComponent ( const std::string &  configParentKey = "")

Creates an manufactory component that exports AudioPlayer-related implementations.

Parameters
configParentKeyOptional key to the parent node of AudioPlayer-related configurations in the ConfigurationNode. This is needed to maintain backwards compatibility with AlexaClientSDKConfig.json, which previously placed AudioPlayer configurations under the sampleApp parent node.
Returns
A component.

◆ operator<<() [1/2]

std::ostream& alexaClientSDK::acsdkAudioPlayer::operator<< ( std::ostream &  stream,
const StreamFormat streamFormat 
)
inline

Write a StreamFormat value to an ostream.

Parameters
streamThe stream to write the value to.
streamFormatThe StreamFormat value to write to the ostream as a string.
Returns
The ostream that was passed in and written to.

◆ operator<<() [2/2]

std::ostream& alexaClientSDK::acsdkAudioPlayer::operator<< ( std::ostream &  stream,
const ClearBehavior clearBehavior 
)
inline

Write a ClearBehavior value to an ostream.

Parameters
streamThe stream to write the value to.
clearBehaviorThe ClearBehavior value to write to the ostream as a string.
Returns
The ostream that was passed in and written to.

◆ playerStateToString()

std::string alexaClientSDK::acsdkAudioPlayer::playerStateToString ( AudioPlayerState  state)
inline

◆ streamFormatToString()

std::string alexaClientSDK::acsdkAudioPlayer::streamFormatToString ( StreamFormat  streamFormat)
inline

Convert a StreamFormat to an AVS-compliant std::string.

Parameters
streamFormatThe StreamFormat to convert.
Returns
The AVS-compliant string representation of streamFormat.

◆ stringToClearBehavior()

bool alexaClientSDK::acsdkAudioPlayer::stringToClearBehavior ( const std::string &  text,
ClearBehavior clearBehavior 
)
inline

Convert an AVS-compliant string to a ClearBehavior.

Parameters
textThe string to convert.
[out]clearBehaviorThe converted ClearBehavior.
Returns
true if the string converted succesfully, else false.

◆ stringToStreamFormat()

bool alexaClientSDK::acsdkAudioPlayer::stringToStreamFormat ( const std::string &  text,
StreamFormat streamFormat 
)
inline

Convert an AVS-compliant string to a StreamFormat.

Parameters
textThe string to convert.
[out]streamFormatThe converted StreamFormat.
Returns
true if the string converted succesfully, else false.

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