AlexaClientSDK  1.20.1
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
alexaClientSDK::avsCommon::utils::mediaPlayer Namespace Reference

Namespaces

 test
 

Classes

struct  Fingerprint
 
class  MediaPlayerFactoryInterface
 
class  MediaPlayerFactoryObserverInterface
 
class  MediaPlayerInterface
 
class  MediaPlayerObserverInterface
 
struct  MediaPlayerState
 
struct  PlaybackAttributes
 
struct  PlaybackContext
 
struct  PlaybackReport
 
struct  SourceConfig
 

Typedefs

typedef std::map< std::string, std::string > HeaderConfig
 Header Key, Value pairs. More...
 

Enumerations

enum  ErrorType {
  ErrorType::NONE, ErrorType::MEDIA_ERROR_UNKNOWN, ErrorType::MEDIA_ERROR_INVALID_REQUEST, ErrorType::MEDIA_ERROR_SERVICE_UNAVAILABLE,
  ErrorType::MEDIA_ERROR_INTERNAL_SERVER_ERROR, ErrorType::MEDIA_ERROR_INTERNAL_DEVICE_ERROR, ErrorType::MEDIA_ERROR_HTTP_BAD_REQUEST, ErrorType::MEDIA_ERROR_HTTP_UNAUTHORIZED,
  ErrorType::MEDIA_ERROR_HTTP_FORBIDDEN, ErrorType::MEDIA_ERROR_HTTP_NOT_FOUND, ErrorType::MEDIA_ERROR_HTTP_CONFLICT, ErrorType::MEDIA_ERROR_HTTP_INVALID_RANGE,
  ErrorType::MEDIA_ERROR_HTTP_TOO_MANY_REQUESTS, ErrorType::MEDIA_ERROR_HTTP_BAD_GATEWAY, ErrorType::MEDIA_ERROR_HTTP_SERVICE_UNAVAILABLE, ErrorType::MEDIA_ERROR_HTTP_GATEWAY_TIMEOUT,
  ErrorType::MEDIA_ERROR_TIMED_OUT, ErrorType::MEDIA_ERROR_URL_MALFORMED, ErrorType::MEDIA_ERROR_COULD_NOT_RESOLVE_HOST, ErrorType::MEDIA_ERROR_COULD_NOT_CONNECT,
  ErrorType::MEDIA_ERROR_NOT_SEEKABLE, ErrorType::MEDIA_ERROR_UNSUPPORTED, ErrorType::MEDIA_ERROR_POSSIBLY_TEXT, ErrorType::MEDIA_ERROR_IO,
  ErrorType::MEDIA_ERROR_INVALID_COMMAND, ErrorType::MEDIA_ERROR_PLAYLIST_ERROR, ErrorType::MEDIA_ERROR_UNKNOWN, ErrorType::MEDIA_ERROR_INVALID_REQUEST,
  ErrorType::MEDIA_ERROR_SERVICE_UNAVAILABLE, ErrorType::MEDIA_ERROR_INTERNAL_SERVER_ERROR, ErrorType::MEDIA_ERROR_INTERNAL_DEVICE_ERROR
}
 Identifies the specific type of error in a PlaybackFailed event. More...
 
enum  ErrorType {
  ErrorType::NONE, ErrorType::MEDIA_ERROR_UNKNOWN, ErrorType::MEDIA_ERROR_INVALID_REQUEST, ErrorType::MEDIA_ERROR_SERVICE_UNAVAILABLE,
  ErrorType::MEDIA_ERROR_INTERNAL_SERVER_ERROR, ErrorType::MEDIA_ERROR_INTERNAL_DEVICE_ERROR, ErrorType::MEDIA_ERROR_HTTP_BAD_REQUEST, ErrorType::MEDIA_ERROR_HTTP_UNAUTHORIZED,
  ErrorType::MEDIA_ERROR_HTTP_FORBIDDEN, ErrorType::MEDIA_ERROR_HTTP_NOT_FOUND, ErrorType::MEDIA_ERROR_HTTP_CONFLICT, ErrorType::MEDIA_ERROR_HTTP_INVALID_RANGE,
  ErrorType::MEDIA_ERROR_HTTP_TOO_MANY_REQUESTS, ErrorType::MEDIA_ERROR_HTTP_BAD_GATEWAY, ErrorType::MEDIA_ERROR_HTTP_SERVICE_UNAVAILABLE, ErrorType::MEDIA_ERROR_HTTP_GATEWAY_TIMEOUT,
  ErrorType::MEDIA_ERROR_TIMED_OUT, ErrorType::MEDIA_ERROR_URL_MALFORMED, ErrorType::MEDIA_ERROR_COULD_NOT_RESOLVE_HOST, ErrorType::MEDIA_ERROR_COULD_NOT_CONNECT,
  ErrorType::MEDIA_ERROR_NOT_SEEKABLE, ErrorType::MEDIA_ERROR_UNSUPPORTED, ErrorType::MEDIA_ERROR_POSSIBLY_TEXT, ErrorType::MEDIA_ERROR_IO,
  ErrorType::MEDIA_ERROR_INVALID_COMMAND, ErrorType::MEDIA_ERROR_PLAYLIST_ERROR, ErrorType::MEDIA_ERROR_UNKNOWN, ErrorType::MEDIA_ERROR_INVALID_REQUEST,
  ErrorType::MEDIA_ERROR_SERVICE_UNAVAILABLE, ErrorType::MEDIA_ERROR_INTERNAL_SERVER_ERROR, ErrorType::MEDIA_ERROR_INTERNAL_DEVICE_ERROR
}
 Identifies the specific type of error in a PlaybackFailed event. More...
 

Functions

std::string errorTypeToString (ErrorType errorType)
 
std::ostream & operator<< (std::ostream &stream, const ErrorType &errorType)
 
std::ostream & operator<< (std::ostream &stream, const MediaPlayerState &state)
 
bool validatePlaybackContextHeaders (PlaybackContext *playbackContext)
 
SourceConfig emptySourceConfig ()
 
std::ostream & operator<< (std::ostream &stream, const SourceConfig &config)
 
static const std::string TAG ("PlaybackContext")
 String to identify log entries originating from this file. More...
 
static bool validatePlaybackContextHeadersInternal (HeaderConfig *headerConfig)
 

Variables

static const std::chrono::milliseconds MEDIA_PLAYER_INVALID_OFFSET {-1}
 Represents offset returned when MediaPlayer is in an invalid state. More...
 
const std::chrono::milliseconds DURATION_UNKNOWN = std::chrono::milliseconds(-1)
 
static constexpr short MAX_GAIN = 100
 Maximum gain supported. More...
 
static constexpr short MIN_GAIN = 0
 Minimum gain supported. More...
 
static const std::string AUTHORIZATION = "Authorization"
 
static const std::string ALLOWED_PREFIX = "x-"
 
static const unsigned int MIN_KEY_LENGTH = 3
 
static const unsigned int MAX_KEY_LENGTH = 256
 
static const unsigned int MAX_VALUE_LENGTH = 4096
 
static const unsigned int MAX_ENTRIES_PER_CONFIG = 20
 

Typedef Documentation

◆ HeaderConfig

typedef std::map<std::string, std::string> alexaClientSDK::avsCommon::utils::mediaPlayer::HeaderConfig

Header Key, Value pairs.

Enumeration Type Documentation

◆ ErrorType [1/2]

Identifies the specific type of error in a PlaybackFailed event.

Enumerator
NONE 

None.

MEDIA_ERROR_UNKNOWN 

An unknown error occurred.

MEDIA_ERROR_INVALID_REQUEST 

The server recognized the request as being malformed (bad request, unauthorized, forbidden, not found, etc).

MEDIA_ERROR_SERVICE_UNAVAILABLE 

The client was unable to reach the service.

MEDIA_ERROR_INTERNAL_SERVER_ERROR 

The server accepted the request, but was unable to process the request as expected.

MEDIA_ERROR_INTERNAL_DEVICE_ERROR 

There was an internal error on the client.

MEDIA_ERROR_HTTP_BAD_REQUEST 

There was an bad request.

MEDIA_ERROR_HTTP_UNAUTHORIZED 

Request is unauthorized.

MEDIA_ERROR_HTTP_FORBIDDEN 

Request is forbidden.

MEDIA_ERROR_HTTP_NOT_FOUND 

Http resource not found.

MEDIA_ERROR_HTTP_CONFLICT 

There was a conflict.

MEDIA_ERROR_HTTP_INVALID_RANGE 

Range is invalid.

MEDIA_ERROR_HTTP_TOO_MANY_REQUESTS 

There were too many requests.

MEDIA_ERROR_HTTP_BAD_GATEWAY 

Bad Gateway.

MEDIA_ERROR_HTTP_SERVICE_UNAVAILABLE 

Service is unavailable.

MEDIA_ERROR_HTTP_GATEWAY_TIMEOUT 

Gateway timeout occurred.

MEDIA_ERROR_TIMED_OUT 

There was a timeout.

MEDIA_ERROR_URL_MALFORMED 

URL was malformed.

MEDIA_ERROR_COULD_NOT_RESOLVE_HOST 

Couldn't resolve host.

MEDIA_ERROR_COULD_NOT_CONNECT 

Coudln't connect to server.

MEDIA_ERROR_NOT_SEEKABLE 

The resource is not seekable.

MEDIA_ERROR_UNSUPPORTED 

Unsupported error.

MEDIA_ERROR_POSSIBLY_TEXT 

Text file, hence not playable.

MEDIA_ERROR_IO 

IO error.

MEDIA_ERROR_INVALID_COMMAND 

Invalid command.

MEDIA_ERROR_PLAYLIST_ERROR 

Playlist error occurred.

MEDIA_ERROR_UNKNOWN 

An unknown error occurred.

MEDIA_ERROR_INVALID_REQUEST 

The server recognized the request as being malformed (bad request, unauthorized, forbidden, not found, etc).

MEDIA_ERROR_SERVICE_UNAVAILABLE 

The client was unable to reach the service.

MEDIA_ERROR_INTERNAL_SERVER_ERROR 

The server accepted the request, but was unable to process the request as expected.

MEDIA_ERROR_INTERNAL_DEVICE_ERROR 

There was an internal error on the client.

◆ ErrorType [2/2]

Identifies the specific type of error in a PlaybackFailed event.

Enumerator
NONE 

None.

MEDIA_ERROR_UNKNOWN 

An unknown error occurred.

MEDIA_ERROR_INVALID_REQUEST 

The server recognized the request as being malformed (bad request, unauthorized, forbidden, not found, etc).

MEDIA_ERROR_SERVICE_UNAVAILABLE 

The client was unable to reach the service.

MEDIA_ERROR_INTERNAL_SERVER_ERROR 

The server accepted the request, but was unable to process the request as expected.

MEDIA_ERROR_INTERNAL_DEVICE_ERROR 

There was an internal error on the client.

MEDIA_ERROR_HTTP_BAD_REQUEST 

There was an bad request.

MEDIA_ERROR_HTTP_UNAUTHORIZED 

Request is unauthorized.

MEDIA_ERROR_HTTP_FORBIDDEN 

Request is forbidden.

MEDIA_ERROR_HTTP_NOT_FOUND 

Http resource not found.

MEDIA_ERROR_HTTP_CONFLICT 

There was a conflict.

MEDIA_ERROR_HTTP_INVALID_RANGE 

Range is invalid.

MEDIA_ERROR_HTTP_TOO_MANY_REQUESTS 

There were too many requests.

MEDIA_ERROR_HTTP_BAD_GATEWAY 

Bad Gateway.

MEDIA_ERROR_HTTP_SERVICE_UNAVAILABLE 

Service is unavailable.

MEDIA_ERROR_HTTP_GATEWAY_TIMEOUT 

Gateway timeout occurred.

MEDIA_ERROR_TIMED_OUT 

There was a timeout.

MEDIA_ERROR_URL_MALFORMED 

URL was malformed.

MEDIA_ERROR_COULD_NOT_RESOLVE_HOST 

Couldn't resolve host.

MEDIA_ERROR_COULD_NOT_CONNECT 

Coudln't connect to server.

MEDIA_ERROR_NOT_SEEKABLE 

The resource is not seekable.

MEDIA_ERROR_UNSUPPORTED 

Unsupported error.

MEDIA_ERROR_POSSIBLY_TEXT 

Text file, hence not playable.

MEDIA_ERROR_IO 

IO error.

MEDIA_ERROR_INVALID_COMMAND 

Invalid command.

MEDIA_ERROR_PLAYLIST_ERROR 

Playlist error occurred.

MEDIA_ERROR_UNKNOWN 

An unknown error occurred.

MEDIA_ERROR_INVALID_REQUEST 

The server recognized the request as being malformed (bad request, unauthorized, forbidden, not found, etc).

MEDIA_ERROR_SERVICE_UNAVAILABLE 

The client was unable to reach the service.

MEDIA_ERROR_INTERNAL_SERVER_ERROR 

The server accepted the request, but was unable to process the request as expected.

MEDIA_ERROR_INTERNAL_DEVICE_ERROR 

There was an internal error on the client.

Function Documentation

◆ emptySourceConfig()

SourceConfig alexaClientSDK::avsCommon::utils::mediaPlayer::emptySourceConfig ( )
inline

Builds a Source Config object with fade in disabled.

Returns
a Source Config object without fade in

◆ errorTypeToString()

std::string alexaClientSDK::avsCommon::utils::mediaPlayer::errorTypeToString ( ErrorType  errorType)
inline

Convert an ErrorType to an AVS-compliant std::string.

Parameters
errorTypeThe ErrorType to convert.
Returns
The AVS-compliant string representation of errorType.

◆ operator<<() [1/3]

std::ostream& alexaClientSDK::avsCommon::utils::mediaPlayer::operator<< ( std::ostream &  stream,
const SourceConfig config 
)
inline

Write a SourceConfig value to the given stream.

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

◆ operator<<() [2/3]

std::ostream & alexaClientSDK::avsCommon::utils::mediaPlayer::operator<< ( std::ostream &  stream,
const ErrorType errorType 
)
inline

Write an ErrorType value to an ostream.

Parameters
streamThe stream to write the value to.
errorTypeThe ErrorType 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::avsCommon::utils::mediaPlayer::operator<< ( std::ostream &  stream,
const MediaPlayerState state 
)
inline

Write a MediaPlayerState to an ostream as a string.

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

◆ TAG()

static const std::string alexaClientSDK::avsCommon::utils::mediaPlayer::TAG ( "PlaybackContext"  )
static

String to identify log entries originating from this file.

◆ validatePlaybackContextHeaders()

bool alexaClientSDK::avsCommon::utils::mediaPlayer::validatePlaybackContextHeaders ( PlaybackContext playbackContext)

Validate the headers. Delete the invalid entries

Parameters
[out]playbackContextto be validated and the invalid entries will be deleted.
Returns
true if validation had no errrors, else false.

◆ validatePlaybackContextHeadersInternal()

static bool alexaClientSDK::avsCommon::utils::mediaPlayer::validatePlaybackContextHeadersInternal ( HeaderConfig headerConfig)
static

Helper function to validate the headers.

Parameters
[out]headerConfigto be validated and the invalid entries will be deleted.
Returns
true if validation had no errrors, else false.

Variable Documentation

◆ ALLOWED_PREFIX

const std::string alexaClientSDK::avsCommon::utils::mediaPlayer::ALLOWED_PREFIX = "x-"
static

◆ AUTHORIZATION

const std::string alexaClientSDK::avsCommon::utils::mediaPlayer::AUTHORIZATION = "Authorization"
static

◆ DURATION_UNKNOWN

const std::chrono::milliseconds alexaClientSDK::avsCommon::utils::mediaPlayer::DURATION_UNKNOWN = std::chrono::milliseconds(-1)

◆ MAX_ENTRIES_PER_CONFIG

const unsigned int alexaClientSDK::avsCommon::utils::mediaPlayer::MAX_ENTRIES_PER_CONFIG = 20
static

◆ MAX_GAIN

constexpr short alexaClientSDK::avsCommon::utils::mediaPlayer::MAX_GAIN = 100
static

Maximum gain supported.

◆ MAX_KEY_LENGTH

const unsigned int alexaClientSDK::avsCommon::utils::mediaPlayer::MAX_KEY_LENGTH = 256
static

◆ MAX_VALUE_LENGTH

const unsigned int alexaClientSDK::avsCommon::utils::mediaPlayer::MAX_VALUE_LENGTH = 4096
static

◆ MEDIA_PLAYER_INVALID_OFFSET

const std::chrono::milliseconds alexaClientSDK::avsCommon::utils::mediaPlayer::MEDIA_PLAYER_INVALID_OFFSET {-1}
static

Represents offset returned when MediaPlayer is in an invalid state.

◆ MIN_GAIN

constexpr short alexaClientSDK::avsCommon::utils::mediaPlayer::MIN_GAIN = 0
static

Minimum gain supported.

◆ MIN_KEY_LENGTH

const unsigned int alexaClientSDK::avsCommon::utils::mediaPlayer::MIN_KEY_LENGTH = 3
static

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