AlexaClientSDK  1.25.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
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
 

Typedefs

using MediaPlayerState = avsCommon::utils::mediaPlayer::MediaPlayerState
 
using DefaultEndpointAnnotation = avsCommon::sdkInterfaces::endpoints::DefaultEndpointAnnotation
 

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 > > > 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 > > > 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)
 
static const std::string TAG ("AudioPlayer")
 String to identify log entries originating from this file. More...
 
static const std::chrono::seconds LOCAL_STOP_DEFAULT_PIPELINE_OPEN_TIME (900)
 Time to keep the pipeline open after a local pause. More...
 
static bool compareUrlNotQuery (const std::string &url1, const std::string &url2)
 
static std::shared_ptr< avsCommon::avs::CapabilityConfigurationgetAudioPlayerCapabilityConfiguration (Fingerprint fingerprint)
 
static void submitMetric (const std::shared_ptr< MetricRecorderInterface > &metricRecorder, const std::string &metricActivityName, const DataPoint &dataPoint, const std::string &msgId, const std::string &trackId, const std::string &requesterType="", const std::string &trackProtection="", const std::string &trackPlaylistType="", const std::string &trackDomainNameHash="")
 
static void submitAnnotatedMetric (const std::shared_ptr< MetricRecorderInterface > &metricRecorder, const std::string &baseMetric, const std::string &annotation)
 
static void submitInstanceMetric (const std::shared_ptr< MetricRecorderInterface > &metricRecorder, const std::string &segmentId, const std::string &name, const std::map< std::string, std::string > &metadata={})
 
bool messageSentSuccessfully (MessageRequestObserverInterface::Status status)
 
static audio::MixingBehavior getMixingBehavior (const std::string &messageID, const rapidjson::Value &payload, const std::shared_ptr< MetricRecorderInterface > &metricRecorder)
 
static const std::string TAG ("AudioPlayerComponent")
 String to identify log entries originating from this file. More...
 
static const std::string AUDIOPLAYER_CONFIG_KEY ("audioPlayer")
 Key for the Audio MediaPlayer pool size. More...
 
static const std::string AUDIO_MEDIAPLAYER_POOL_SIZE_KEY ("audioMediaPlayerPoolSize")
 Key for the Audio MediaPlayer pool size. More...
 
static const std::string AUDIO_MEDIA_PLAYER_NAME ("AudioMediaPlayer")
 Name for the audio media players, used for logging purposes. More...
 
std::function< std::shared_ptr< avsCommon::utils::mediaPlayer::PooledMediaResourceProviderInterface > const std::shared_ptr< avsCommon::utils::configuration::ConfigurationNode > &, const std::shared_ptr< acsdkApplicationAudioPipelineFactoryInterfaces::ApplicationAudioPipelineFactoryInterface > &)> getCreatePooledMediaResourceProviderInterface (const std::string &parentConfigKey)
 
static const std::string TAG ("ProgressTimer")
 String to identify log entries originating from this file. More...
 
std::ostream & operator<< (std::ostream &stream, ProgressTimer::State state)
 
static const std::string TAG ("AudioPlayerUtil")
 String to identify log entries originating from this file. More...
 
static const int kBitsInByte (8)
 
static const int kBitsInHex (4)
 
static const int kHexInByte (kBitsInByte/kBitsInHex)
 

Variables

static const std::string AUDIOPLAYER_CAPABILITY_INTERFACE_TYPE = "AlexaInterface"
 
static const std::string AUDIOPLAYER_CAPABILITY_INTERFACE_NAME = "AudioPlayer"
 AudioPlayer interface name. More...
 
static const std::string AUDIOPLAYER_CAPABILITY_INTERFACE_VERSION = "1.5"
 AudioPlayer interface version. More...
 
static const std::string FINGERPRINT_KEY = "fingerprint"
 The fingerprint key used in AudioPlayer configurations. More...
 
static const std::string PACKAGE_KEY = "package"
 The package key used in AudioPlayer fingerprint. More...
 
static const std::string BUILD_TYPE_KEY = "buildType"
 The buildType key used in AudioPlayer fingerprint. More...
 
static const std::string VERSION_NUMBER_KEY = "versionNumber"
 The versionNumber key used in AudioPlayer fingerprint. More...
 
static const AudioPlayer::SourceId ERROR_SOURCE_ID = MediaPlayerInterface::ERROR
 A link to MediaPlayerInterface::ERROR. More...
 
static const std::string CHANNEL_NAME = FocusManagerInterface::CONTENT_CHANNEL_NAME
 The name of the FocusManager channel used by AudioPlayer. More...
 
static const std::string NAMESPACE = "AudioPlayer"
 The namespace for this capability agent. More...
 
static const NamespaceAndName PLAY {NAMESPACE, "Play"}
 The Play directive signature. More...
 
static const NamespaceAndName STOP {NAMESPACE, "Stop"}
 The Stop directive signature. More...
 
static const NamespaceAndName CLEAR_QUEUE {NAMESPACE, "ClearQueue"}
 The ClearQueue directive signature. More...
 
static const NamespaceAndName UPDATE_PROGRESS_REPORT_INTERVAL {NAMESPACE, "UpdateProgressReportInterval"}
 The UpdateProgressReportInterval directive signature. More...
 
static const NamespaceAndName STATE {NAMESPACE, "PlaybackState"}
 The AudioPlayer context state signature. More...
 
static const std::string CID_PREFIX {"cid:"}
 Prefix for content ID prefix in the url property of the directive payload. More...
 
static const char TOKEN_KEY [] = "token"
 The token key used in AudioPlayer events. More...
 
static const char OFFSET_KEY [] = "offsetInMilliseconds"
 The offset key used in AudioPlayer events. More...
 
static const char SEEK_START_OFFSET_KEY [] = "seekStartOffsetInMilliseconds"
 The seek start offset key used in PlaybackSeeked events. More...
 
static const char SEEK_END_OFFSET_KEY [] = "seekEndOffsetInMilliseconds"
 The seek end offset key used in PlaybackSeeked events. More...
 
static const char PLAYBACK_ATTRIBUTES_KEY [] = "playbackAttributes"
 The playbackAttributes key used in AudioPlayer events. More...
 
static const char NAME_KEY [] = "name"
 The name key used in AudioPlayer events. More...
 
static const char CODEC_KEY [] = "codec"
 The codec key used in AudioPlayer events. More...
 
static const char SAMPLING_RATE_IN_HERTZ_KEY [] = "samplingRateInHertz"
 The samplingRateInHertz key used in AudioPlayer events. More...
 
static const char DATA_RATE_IN_BITS_PER_SECOND_KEY [] = "dataRateInBitsPerSecond"
 The dateRateInBitsPerSecond key used in AudioPlayer events. More...
 
static const char PLAYBACK_REPORTS_KEY [] = "playbackReports"
 The playbackReports key used in AudioPlayer events. More...
 
static const char START_OFFSET_KEY [] = "startOffsetInMilliseconds"
 The startOffsetInMilliseconds key used in AudioPlayer events. More...
 
static const char END_OFFSET_KEY [] = "endOffsetInMilliseconds"
 The endOffsetInMilliseconds key used in AudioPlayer events. More...
 
static const char ACTIVITY_KEY [] = "playerActivity"
 The activity key used in AudioPlayer events. More...
 
static const char CAPTION_KEY [] = "caption"
 The key for the "captionData" property in the directive payload. More...
 
static const char CAPTION_TYPE_KEY [] = "type"
 The key under "captionData" containing the caption type. More...
 
static const char CAPTION_CONTENT_KEY [] = "content"
 The key under "captionData" containing the caption content. More...
 
static const char STUTTER_DURATION_KEY [] = "stutterDurationInMilliseconds"
 The stutter key used in AudioPlayer events. More...
 
static const std::chrono::seconds TIMEOUT {2}
 The duration to wait for a state change in onFocusChanged before failing. More...
 
static const audio::MixingBehavior DEFAULT_MIXING_BEHAVIOR = audio::MixingBehavior::BEHAVIOR_PAUSE
 default mixing behavior More...
 
static const std::string AUDIO_PLAYER_METRIC_PREFIX = "AUDIO_PLAYER-"
 prefix for metrics emitted from the AudioPlayer CA More...
 
static const std::string UNSUPPORTED_INTERRUPTED_BEHAVIOR = "UNSUPPORTED_INTERRUPTED_BEHAVIOR_PLAY_DIRECTIVE"
 Metric to catch unsupported/missing interruptedBehavior. More...
 
static const std::string MISSING_INTERRUPTED_BEHAVIOR = "MISSING_INTERRUPTED_BEHAVIOR_PLAY_DIRECTIVE"
 
static const std::string PREPARE_PLAY_DIRECTIVE_RECEIVED = "PREPARE_PLAY_DIRECTIVE_RECEIVED"
 playback metrics use for AudioPlayer UPL More...
 
static const std::string PLAY_DIRECTIVE_RECEIVED = "PLAY_DIRECTIVE_RECEIVED"
 The directive received metric is used in place of 'first bytes' for UPL because pre-buffering may distort the metric. More...
 
static const std::string STOP_DIRECTIVE_RECEIVED = "STOP_DIRECTIVE_RECEIVED"
 The directive received metric is used in place of 'first bytes' for Stop UPL because there are no bytes involved. More...
 
static const std::string PLAYBACK_STARTED = "PLAYBACK_STARTED"
 Metric used to trigger UPL recording for play. More...
 
static const std::string PLAYBACK_STOPPED = "PLAYBACK_STOPPED"
 Metric used to trigger UPL recording for stop. More...
 
static const std::string METADATA_UNFILTERED_ENCOUNTERED = "UnfilteredMetadataEncountered"
 Metrics for filtered and unfiltered metadata. More...
 
static const std::string METADATA_FILTERED_ENCOUNTERED = "FilteredMetadataEncountered"
 
static const std::string AUDIO_PLAYBACK_TIME = "AudioPlaybackTime"
 Total play time metric. More...
 
static const std::string TRACK_TO_TRACK_TIME = "AutoProgressionLatency"
 Track to Track time metric. More...
 
static const std::string TRACK_PROGRESSION_FATAL = "TrackProgressionFatalError"
 Playback error during auto-progression. More...
 
static const std::string MID_PLAYBACK_FATAL = "PlaybackFatalError"
 Fatal error mid-playback. More...
 
static const std::string TRACK_TIME_ON_QUEUE = "TrackTimeOnQueue"
 Time spent on queue. More...
 
static const std::string HANDLE_PLAY_COMMAND_TO_PLAYING = "directiveReceiveToPlaying"
 Latency between handleDirective command for a new play session and PLAYING state. More...
 
static const std::string INVALID_HEADER_RECEIVED = "InvalidHeaderReceived"
 Invalid headers metrics. More...
 
static const std::string MALICIOUS_HEADER_RECEIVED = "MaliciousHeaderReceived"
 
static const std::string MESSAGE_SENT_FAILED = "MessageSentFailed"
 Message sent failed metric. More...
 
static const std::vector< std::string > METADATA_ALLOWLIST = {"title"}
 
static const std::chrono::seconds METADATA_EVENT_RATE {1}
 Min time between metadata events. More...
 
static const std::string NORMALIZATION_LEVEL_HIGH = "HIGH"
 Normalization enabled (HIGH level) More...
 
static const std::string NORMALIZATION_LEVEL_OFF = "OFF"
 Normalization disabled. More...
 
static const std::string TRACK_PROTECTION_NAME = "TrackProtectionName"
 Track protection name, meta data sent with metric. More...
 
static const std::string TRACK_PLAYLIST_TYPE = "TrackType"
 Track playlist type, meta data sent with metric. More...
 
static const std::string TRACK_DOMAIN_NAME_HASH = "TrackDomainNameHash"
 Hash of the domain name of the track url, meta data sent with metric. More...
 
static const std::string METRIC_KEY_SEGMENT_ID = "segment_id"
 Keys for entry metric specific fields. More...
 
static const std::string METRIC_KEY_ACTOR = "actor"
 
static const std::string METRIC_KEY_ENTRY_TYPE = "entry_type"
 
static const std::string METRIC_KEY_ENTRY_NAME = "entry_name"
 
static const std::string METRIC_KEY_ERROR_DESCRIPTION = "error_description"
 
static const std::string METRIC_KEY_ERROR_RECOVERABLE = "error_recoverable"
 
static const std::string METRIC_INSTANCE_RECEIVE_DIRECTIVE = "ReceiveDirective"
 
static const std::string METRIC_INSTANCE_STATE_CHANGED = "PlaybackStateChanged"
 
static const std::string METRIC_META_KEY_NAMESPACE = "namespace"
 
static const std::string METRIC_META_KEY_NAME = "name"
 
static const std::string METRIC_META_KEY_ISPREPARE_BOOL = "isPreparePhase"
 
static const unsigned int AUDIO_MEDIAPLAYER_POOL_SIZE_DEFAULT = 2
 

Typedef Documentation

◆ DefaultEndpointAnnotation

◆ MediaPlayerState

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

◆ AUDIO_MEDIA_PLAYER_NAME()

static const std::string alexaClientSDK::acsdkAudioPlayer::AUDIO_MEDIA_PLAYER_NAME ( "AudioMediaPlayer"  )
static

Name for the audio media players, used for logging purposes.

◆ AUDIO_MEDIAPLAYER_POOL_SIZE_KEY()

static const std::string alexaClientSDK::acsdkAudioPlayer::AUDIO_MEDIAPLAYER_POOL_SIZE_KEY ( "audioMediaPlayerPoolSize"  )
static

Key for the Audio MediaPlayer pool size.

◆ AUDIOPLAYER_CONFIG_KEY()

static const std::string alexaClientSDK::acsdkAudioPlayer::AUDIOPLAYER_CONFIG_KEY ( "audioPlayer"  )
static

Key for the Audio MediaPlayer pool size.

◆ 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.

◆ compareUrlNotQuery()

static bool alexaClientSDK::acsdkAudioPlayer::compareUrlNotQuery ( const std::string &  url1,
const std::string &  url2 
)
static

Compare two URLs up to the 'query' portion, if one exists.

Parameters
url1First URL to compare
url2URL to compare to
Returns
true if the URLs are identical except for their query strings.

◆ 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.

◆ getAudioPlayerCapabilityConfiguration()

std::shared_ptr< CapabilityConfiguration > alexaClientSDK::acsdkAudioPlayer::getAudioPlayerCapabilityConfiguration ( Fingerprint  fingerprint)
static

Creates the AudioPlayer capability configuration.

Parameters
fingerprintThe Fingerprint of MediaPlayer.
Returns
The AudioPlayer capability configuration.

◆ 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()

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.

◆ getCreatePooledMediaResourceProviderInterface()

std::function<std::shared_ptr<avsCommon::utils::mediaPlayer::PooledMediaResourceProviderInterface> const std::shared_ptr<avsCommon::utils::configuration::ConfigurationNode>&, const std::shared_ptr<acsdkApplicationAudioPipelineFactoryInterfaces::ApplicationAudioPipelineFactoryInterface>&)> alexaClientSDK::acsdkAudioPlayer::getCreatePooledMediaResourceProviderInterface ( const std::string &  parentConfigKey)

◆ getMixingBehavior()

static audio::MixingBehavior alexaClientSDK::acsdkAudioPlayer::getMixingBehavior ( const std::string &  messageID,
const rapidjson::Value &  payload,
const std::shared_ptr< MetricRecorderInterface > &  metricRecorder 
)
static

◆ kBitsInByte()

static const int alexaClientSDK::acsdkAudioPlayer::kBitsInByte ( )
static

◆ kBitsInHex()

static const int alexaClientSDK::acsdkAudioPlayer::kBitsInHex ( )
static

◆ kHexInByte()

static const int alexaClientSDK::acsdkAudioPlayer::kHexInByte ( kBitsInByte kBitsInHex)
static

◆ LOCAL_STOP_DEFAULT_PIPELINE_OPEN_TIME()

static const std::chrono::seconds alexaClientSDK::acsdkAudioPlayer::LOCAL_STOP_DEFAULT_PIPELINE_OPEN_TIME ( 900  )
static

Time to keep the pipeline open after a local pause.

◆ messageSentSuccessfully()

bool alexaClientSDK::acsdkAudioPlayer::messageSentSuccessfully ( MessageRequestObserverInterface::Status  status)
inline

◆ operator<<() [1/3]

std::ostream& alexaClientSDK::acsdkAudioPlayer::operator<< ( std::ostream &  stream,
ProgressTimer::State  state 
)

Write a ProgressTimer::State value to an ostream as a string.

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

◆ operator<<() [2/3]

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<<() [3/3]

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.

◆ submitAnnotatedMetric()

static void alexaClientSDK::acsdkAudioPlayer::submitAnnotatedMetric ( const std::shared_ptr< MetricRecorderInterface > &  metricRecorder,
const std::string &  baseMetric,
const std::string &  annotation 
)
static

◆ submitInstanceMetric()

static void alexaClientSDK::acsdkAudioPlayer::submitInstanceMetric ( const std::shared_ptr< MetricRecorderInterface > &  metricRecorder,
const std::string &  segmentId,
const std::string &  name,
const std::map< std::string, std::string > &  metadata = {} 
)
static

◆ submitMetric()

static void alexaClientSDK::acsdkAudioPlayer::submitMetric ( const std::shared_ptr< MetricRecorderInterface > &  metricRecorder,
const std::string &  metricActivityName,
const DataPoint dataPoint,
const std::string &  msgId,
const std::string &  trackId,
const std::string &  requesterType = "",
const std::string &  trackProtection = "",
const std::string &  trackPlaylistType = "",
const std::string &  trackDomainNameHash = "" 
)
static

Handles a Metric event by creating and recording it. Failure to create or record the event results in an early return.

Parameters
metricRecorderThe MetricRecorderInterface which records Metric events.
activityNameThe activityName of the Metric event.
dataPointThe DataPoint of this Metric event.
msgIdThe message id string retrieved from the directive.
trackIdThe track id string retrieved from the directive.
requesterTypeThe requester type string retrieved from the directive, defaults to empty string.
trackProtectionThe track protection on the track.
trackPlaylistTypeTrack playtlist type.
trackDomainNameHashHash of the track url domain

◆ TAG() [1/4]

static const std::string alexaClientSDK::acsdkAudioPlayer::TAG ( "AudioPlayerUtil"  )
static

String to identify log entries originating from this file.

◆ TAG() [2/4]

static const std::string alexaClientSDK::acsdkAudioPlayer::TAG ( "ProgressTimer"  )
static

String to identify log entries originating from this file.

◆ TAG() [3/4]

static const std::string alexaClientSDK::acsdkAudioPlayer::TAG ( "AudioPlayerComponent"  )
static

String to identify log entries originating from this file.

◆ TAG() [4/4]

static const std::string alexaClientSDK::acsdkAudioPlayer::TAG ( "AudioPlayer"  )
static

String to identify log entries originating from this file.

Variable Documentation

◆ ACTIVITY_KEY

const char alexaClientSDK::acsdkAudioPlayer::ACTIVITY_KEY[] = "playerActivity"
static

The activity key used in AudioPlayer events.

◆ AUDIO_MEDIAPLAYER_POOL_SIZE_DEFAULT

const unsigned int alexaClientSDK::acsdkAudioPlayer::AUDIO_MEDIAPLAYER_POOL_SIZE_DEFAULT = 2
static

The default number of MediaPlayers used by AudioPlayer CA/ Can be overridden in the Configuration using AUDIO_MEDIAPLAYER_POOL_SIZE_KEY

◆ AUDIO_PLAYBACK_TIME

const std::string alexaClientSDK::acsdkAudioPlayer::AUDIO_PLAYBACK_TIME = "AudioPlaybackTime"
static

Total play time metric.

◆ AUDIO_PLAYER_METRIC_PREFIX

const std::string alexaClientSDK::acsdkAudioPlayer::AUDIO_PLAYER_METRIC_PREFIX = "AUDIO_PLAYER-"
static

prefix for metrics emitted from the AudioPlayer CA

◆ AUDIOPLAYER_CAPABILITY_INTERFACE_NAME

const std::string alexaClientSDK::acsdkAudioPlayer::AUDIOPLAYER_CAPABILITY_INTERFACE_NAME = "AudioPlayer"
static

AudioPlayer interface name.

◆ AUDIOPLAYER_CAPABILITY_INTERFACE_TYPE

const std::string alexaClientSDK::acsdkAudioPlayer::AUDIOPLAYER_CAPABILITY_INTERFACE_TYPE = "AlexaInterface"
static

AudioPlayer capability constants AudioPlayer interface type

◆ AUDIOPLAYER_CAPABILITY_INTERFACE_VERSION

const std::string alexaClientSDK::acsdkAudioPlayer::AUDIOPLAYER_CAPABILITY_INTERFACE_VERSION = "1.5"
static

AudioPlayer interface version.

◆ BUILD_TYPE_KEY

const std::string alexaClientSDK::acsdkAudioPlayer::BUILD_TYPE_KEY = "buildType"
static

The buildType key used in AudioPlayer fingerprint.

◆ CAPTION_CONTENT_KEY

const char alexaClientSDK::acsdkAudioPlayer::CAPTION_CONTENT_KEY[] = "content"
static

The key under "captionData" containing the caption content.

◆ CAPTION_KEY

const char alexaClientSDK::acsdkAudioPlayer::CAPTION_KEY[] = "caption"
static

The key for the "captionData" property in the directive payload.

◆ CAPTION_TYPE_KEY

const char alexaClientSDK::acsdkAudioPlayer::CAPTION_TYPE_KEY[] = "type"
static

The key under "captionData" containing the caption type.

◆ CHANNEL_NAME

const std::string alexaClientSDK::acsdkAudioPlayer::CHANNEL_NAME = FocusManagerInterface::CONTENT_CHANNEL_NAME
static

The name of the FocusManager channel used by AudioPlayer.

◆ CID_PREFIX

const std::string alexaClientSDK::acsdkAudioPlayer::CID_PREFIX {"cid:"}
static

Prefix for content ID prefix in the url property of the directive payload.

◆ CLEAR_QUEUE

const NamespaceAndName alexaClientSDK::acsdkAudioPlayer::CLEAR_QUEUE {NAMESPACE, "ClearQueue"}
static

The ClearQueue directive signature.

◆ CODEC_KEY

const char alexaClientSDK::acsdkAudioPlayer::CODEC_KEY[] = "codec"
static

The codec key used in AudioPlayer events.

◆ DATA_RATE_IN_BITS_PER_SECOND_KEY

const char alexaClientSDK::acsdkAudioPlayer::DATA_RATE_IN_BITS_PER_SECOND_KEY[] = "dataRateInBitsPerSecond"
static

The dateRateInBitsPerSecond key used in AudioPlayer events.

◆ DEFAULT_MIXING_BEHAVIOR

const audio::MixingBehavior alexaClientSDK::acsdkAudioPlayer::DEFAULT_MIXING_BEHAVIOR = audio::MixingBehavior::BEHAVIOR_PAUSE
static

default mixing behavior

◆ END_OFFSET_KEY

const char alexaClientSDK::acsdkAudioPlayer::END_OFFSET_KEY[] = "endOffsetInMilliseconds"
static

The endOffsetInMilliseconds key used in AudioPlayer events.

◆ ERROR_SOURCE_ID

const AudioPlayer::SourceId alexaClientSDK::acsdkAudioPlayer::ERROR_SOURCE_ID = MediaPlayerInterface::ERROR
static

◆ FINGERPRINT_KEY

const std::string alexaClientSDK::acsdkAudioPlayer::FINGERPRINT_KEY = "fingerprint"
static

The fingerprint key used in AudioPlayer configurations.

◆ HANDLE_PLAY_COMMAND_TO_PLAYING

const std::string alexaClientSDK::acsdkAudioPlayer::HANDLE_PLAY_COMMAND_TO_PLAYING = "directiveReceiveToPlaying"
static

Latency between handleDirective command for a new play session and PLAYING state.

◆ INVALID_HEADER_RECEIVED

const std::string alexaClientSDK::acsdkAudioPlayer::INVALID_HEADER_RECEIVED = "InvalidHeaderReceived"
static

Invalid headers metrics.

◆ MALICIOUS_HEADER_RECEIVED

const std::string alexaClientSDK::acsdkAudioPlayer::MALICIOUS_HEADER_RECEIVED = "MaliciousHeaderReceived"
static

◆ MESSAGE_SENT_FAILED

const std::string alexaClientSDK::acsdkAudioPlayer::MESSAGE_SENT_FAILED = "MessageSentFailed"
static

Message sent failed metric.

◆ METADATA_ALLOWLIST

const std::vector<std::string> alexaClientSDK::acsdkAudioPlayer::METADATA_ALLOWLIST = {"title"}
static

allowlisted metadata to send to server. This is done to avoid excessive traffic must be all lower-case

◆ METADATA_EVENT_RATE

const std::chrono::seconds alexaClientSDK::acsdkAudioPlayer::METADATA_EVENT_RATE {1}
static

Min time between metadata events.

◆ METADATA_FILTERED_ENCOUNTERED

const std::string alexaClientSDK::acsdkAudioPlayer::METADATA_FILTERED_ENCOUNTERED = "FilteredMetadataEncountered"
static

◆ METADATA_UNFILTERED_ENCOUNTERED

const std::string alexaClientSDK::acsdkAudioPlayer::METADATA_UNFILTERED_ENCOUNTERED = "UnfilteredMetadataEncountered"
static

Metrics for filtered and unfiltered metadata.

◆ METRIC_INSTANCE_RECEIVE_DIRECTIVE

const std::string alexaClientSDK::acsdkAudioPlayer::METRIC_INSTANCE_RECEIVE_DIRECTIVE = "ReceiveDirective"
static

◆ METRIC_INSTANCE_STATE_CHANGED

const std::string alexaClientSDK::acsdkAudioPlayer::METRIC_INSTANCE_STATE_CHANGED = "PlaybackStateChanged"
static

◆ METRIC_KEY_ACTOR

const std::string alexaClientSDK::acsdkAudioPlayer::METRIC_KEY_ACTOR = "actor"
static

◆ METRIC_KEY_ENTRY_NAME

const std::string alexaClientSDK::acsdkAudioPlayer::METRIC_KEY_ENTRY_NAME = "entry_name"
static

◆ METRIC_KEY_ENTRY_TYPE

const std::string alexaClientSDK::acsdkAudioPlayer::METRIC_KEY_ENTRY_TYPE = "entry_type"
static

◆ METRIC_KEY_ERROR_DESCRIPTION

const std::string alexaClientSDK::acsdkAudioPlayer::METRIC_KEY_ERROR_DESCRIPTION = "error_description"
static

◆ METRIC_KEY_ERROR_RECOVERABLE

const std::string alexaClientSDK::acsdkAudioPlayer::METRIC_KEY_ERROR_RECOVERABLE = "error_recoverable"
static

◆ METRIC_KEY_SEGMENT_ID

const std::string alexaClientSDK::acsdkAudioPlayer::METRIC_KEY_SEGMENT_ID = "segment_id"
static

Keys for entry metric specific fields.

◆ METRIC_META_KEY_ISPREPARE_BOOL

const std::string alexaClientSDK::acsdkAudioPlayer::METRIC_META_KEY_ISPREPARE_BOOL = "isPreparePhase"
static

◆ METRIC_META_KEY_NAME

const std::string alexaClientSDK::acsdkAudioPlayer::METRIC_META_KEY_NAME = "name"
static

◆ METRIC_META_KEY_NAMESPACE

const std::string alexaClientSDK::acsdkAudioPlayer::METRIC_META_KEY_NAMESPACE = "namespace"
static

◆ MID_PLAYBACK_FATAL

const std::string alexaClientSDK::acsdkAudioPlayer::MID_PLAYBACK_FATAL = "PlaybackFatalError"
static

Fatal error mid-playback.

◆ MISSING_INTERRUPTED_BEHAVIOR

const std::string alexaClientSDK::acsdkAudioPlayer::MISSING_INTERRUPTED_BEHAVIOR = "MISSING_INTERRUPTED_BEHAVIOR_PLAY_DIRECTIVE"
static

◆ NAME_KEY

const char alexaClientSDK::acsdkAudioPlayer::NAME_KEY[] = "name"
static

The name key used in AudioPlayer events.

◆ NAMESPACE

const std::string alexaClientSDK::acsdkAudioPlayer::NAMESPACE = "AudioPlayer"
static

The namespace for this capability agent.

◆ NORMALIZATION_LEVEL_HIGH

const std::string alexaClientSDK::acsdkAudioPlayer::NORMALIZATION_LEVEL_HIGH = "HIGH"
static

Normalization enabled (HIGH level)

◆ NORMALIZATION_LEVEL_OFF

const std::string alexaClientSDK::acsdkAudioPlayer::NORMALIZATION_LEVEL_OFF = "OFF"
static

Normalization disabled.

◆ OFFSET_KEY

const char alexaClientSDK::acsdkAudioPlayer::OFFSET_KEY[] = "offsetInMilliseconds"
static

The offset key used in AudioPlayer events.

◆ PACKAGE_KEY

const std::string alexaClientSDK::acsdkAudioPlayer::PACKAGE_KEY = "package"
static

The package key used in AudioPlayer fingerprint.

◆ PLAY

const NamespaceAndName alexaClientSDK::acsdkAudioPlayer::PLAY {NAMESPACE, "Play"}
static

The Play directive signature.

◆ PLAY_DIRECTIVE_RECEIVED

const std::string alexaClientSDK::acsdkAudioPlayer::PLAY_DIRECTIVE_RECEIVED = "PLAY_DIRECTIVE_RECEIVED"
static

The directive received metric is used in place of 'first bytes' for UPL because pre-buffering may distort the metric.

◆ PLAYBACK_ATTRIBUTES_KEY

const char alexaClientSDK::acsdkAudioPlayer::PLAYBACK_ATTRIBUTES_KEY[] = "playbackAttributes"
static

The playbackAttributes key used in AudioPlayer events.

◆ PLAYBACK_REPORTS_KEY

const char alexaClientSDK::acsdkAudioPlayer::PLAYBACK_REPORTS_KEY[] = "playbackReports"
static

The playbackReports key used in AudioPlayer events.

◆ PLAYBACK_STARTED

const std::string alexaClientSDK::acsdkAudioPlayer::PLAYBACK_STARTED = "PLAYBACK_STARTED"
static

Metric used to trigger UPL recording for play.

◆ PLAYBACK_STOPPED

const std::string alexaClientSDK::acsdkAudioPlayer::PLAYBACK_STOPPED = "PLAYBACK_STOPPED"
static

Metric used to trigger UPL recording for stop.

◆ PREPARE_PLAY_DIRECTIVE_RECEIVED

const std::string alexaClientSDK::acsdkAudioPlayer::PREPARE_PLAY_DIRECTIVE_RECEIVED = "PREPARE_PLAY_DIRECTIVE_RECEIVED"
static

playback metrics use for AudioPlayer UPL

The directive received metric is used in place of 'first bytes' for UPL because pre-buffering may distort the metric

◆ SAMPLING_RATE_IN_HERTZ_KEY

const char alexaClientSDK::acsdkAudioPlayer::SAMPLING_RATE_IN_HERTZ_KEY[] = "samplingRateInHertz"
static

The samplingRateInHertz key used in AudioPlayer events.

◆ SEEK_END_OFFSET_KEY

const char alexaClientSDK::acsdkAudioPlayer::SEEK_END_OFFSET_KEY[] = "seekEndOffsetInMilliseconds"
static

The seek end offset key used in PlaybackSeeked events.

◆ SEEK_START_OFFSET_KEY

const char alexaClientSDK::acsdkAudioPlayer::SEEK_START_OFFSET_KEY[] = "seekStartOffsetInMilliseconds"
static

The seek start offset key used in PlaybackSeeked events.

◆ START_OFFSET_KEY

const char alexaClientSDK::acsdkAudioPlayer::START_OFFSET_KEY[] = "startOffsetInMilliseconds"
static

The startOffsetInMilliseconds key used in AudioPlayer events.

◆ STATE

const NamespaceAndName alexaClientSDK::acsdkAudioPlayer::STATE {NAMESPACE, "PlaybackState"}
static

The AudioPlayer context state signature.

◆ STOP

const NamespaceAndName alexaClientSDK::acsdkAudioPlayer::STOP {NAMESPACE, "Stop"}
static

The Stop directive signature.

◆ STOP_DIRECTIVE_RECEIVED

const std::string alexaClientSDK::acsdkAudioPlayer::STOP_DIRECTIVE_RECEIVED = "STOP_DIRECTIVE_RECEIVED"
static

The directive received metric is used in place of 'first bytes' for Stop UPL because there are no bytes involved.

◆ STUTTER_DURATION_KEY

const char alexaClientSDK::acsdkAudioPlayer::STUTTER_DURATION_KEY[] = "stutterDurationInMilliseconds"
static

The stutter key used in AudioPlayer events.

◆ TIMEOUT

const std::chrono::seconds alexaClientSDK::acsdkAudioPlayer::TIMEOUT {2}
static

The duration to wait for a state change in onFocusChanged before failing.

◆ TOKEN_KEY

const char alexaClientSDK::acsdkAudioPlayer::TOKEN_KEY[] = "token"
static

The token key used in AudioPlayer events.

◆ TRACK_DOMAIN_NAME_HASH

const std::string alexaClientSDK::acsdkAudioPlayer::TRACK_DOMAIN_NAME_HASH = "TrackDomainNameHash"
static

Hash of the domain name of the track url, meta data sent with metric.

◆ TRACK_PLAYLIST_TYPE

const std::string alexaClientSDK::acsdkAudioPlayer::TRACK_PLAYLIST_TYPE = "TrackType"
static

Track playlist type, meta data sent with metric.

◆ TRACK_PROGRESSION_FATAL

const std::string alexaClientSDK::acsdkAudioPlayer::TRACK_PROGRESSION_FATAL = "TrackProgressionFatalError"
static

Playback error during auto-progression.

◆ TRACK_PROTECTION_NAME

const std::string alexaClientSDK::acsdkAudioPlayer::TRACK_PROTECTION_NAME = "TrackProtectionName"
static

Track protection name, meta data sent with metric.

◆ TRACK_TIME_ON_QUEUE

const std::string alexaClientSDK::acsdkAudioPlayer::TRACK_TIME_ON_QUEUE = "TrackTimeOnQueue"
static

Time spent on queue.

◆ TRACK_TO_TRACK_TIME

const std::string alexaClientSDK::acsdkAudioPlayer::TRACK_TO_TRACK_TIME = "AutoProgressionLatency"
static

Track to Track time metric.

◆ UNSUPPORTED_INTERRUPTED_BEHAVIOR

const std::string alexaClientSDK::acsdkAudioPlayer::UNSUPPORTED_INTERRUPTED_BEHAVIOR = "UNSUPPORTED_INTERRUPTED_BEHAVIOR_PLAY_DIRECTIVE"
static

Metric to catch unsupported/missing interruptedBehavior.

◆ UPDATE_PROGRESS_REPORT_INTERVAL

const NamespaceAndName alexaClientSDK::acsdkAudioPlayer::UPDATE_PROGRESS_REPORT_INTERVAL {NAMESPACE, "UpdateProgressReportInterval"}
static

The UpdateProgressReportInterval directive signature.

◆ VERSION_NUMBER_KEY

const std::string alexaClientSDK::acsdkAudioPlayer::VERSION_NUMBER_KEY = "versionNumber"
static

The versionNumber key used in AudioPlayer fingerprint.

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