![]() |
AlexaClientSDK
1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <TestMediaPlayer.h>
Additional Inherited Members | |
![]() | |
using | SourceId = uint64_t |
A type that identifies which source is currently being operated on. This must be unique across all instances. More... | |
![]() | |
static const SourceId | ERROR = 0 |
An SourceId used to represent an error from calls to setSource() . More... | |
A Mock MediaPlayer that attempts to alert the observer of playing and stopping without actually playing audio. This removes the dependancy on an audio player to run tests with SpeechSynthesizer
alexaClientSDK::integration::test::TestMediaPlayer::~TestMediaPlayer | ( | ) |
|
overridevirtual |
Adds an observer to be notified when playback state changes.
playerObserver | The observer to send the notifications to. |
Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerInterface.
|
overridevirtual |
Returns the current state of the media player source, including the id and offset.
id | The unique id of the source for the desired state. |
Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerInterface.
|
overridevirtual |
Returns the number of bytes queued up in the media player buffers.
Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerInterface.
|
overridevirtual |
Returns the offset, in milliseconds, of the media source.
id | The unique id of the source on which to operate. |
getMediaPlayerState
instead, which contains the offset Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerInterface.
|
overridevirtual |
Pauses playing audio specified by the setSource()
call.
The source must be set before issuing pause()
. If pause()
is called
setSource()
, false
will be returned. false
will be returned. MediaPlayerObserverInterface::onPlaybackStarted()
/ MediaPlayerObserverInterface::onPlaybackResumed
and MediaPlayerObserverInterface::onPlaybackPaused()
in this scenario, as both the play()
/ resume()
and the pause()
are required to have corresponding callbacks.If the id does not match the id of the active source, then false
will be returned. If the pause()
succeeded, true
will be returned. When true
is returned, a callback will be made to either MediaPlayerObserverInterface::onPlaybackPaused()
or to MediaPlayerObserverInterface::onPlaybackError()
.
id | The unique id of the source on which to operate. |
true
if the call succeeded, in which case a callback will be made, or false
otherwise. Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerInterface.
|
overridevirtual |
Starts playing audio specified by the setSource()
call.
The source must be set before issuing play()
.
If play()
is called
setSource()
, false
will be returned. false
will be returned. false
will be returned.If the id does not match the id of the active source, then false
will be returned. If the play()
succeeded, true
will be returned. When true
is returned, a callback will be made to either MediaPlayerObserverInterface::onPlaybackStarted()
or to MediaPlayerObserverInterface::onPlaybackError()
.
id | The unique id of the source on which to operate. |
true
if the call succeeded, in which case a callback will be made, or false
otherwise. Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerInterface.
|
overridevirtual |
Removes an observer to be notified when playback state changes.
playerObserver | The observer to be removed |
Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerInterface.
|
overridevirtual |
Resumes playing the paused audio specified by the setSource()
call.
The source must be set before issuing resume()
. If resume()
is called
setSource()
, false
will be returned. false
will be returned. false
will be returned. false
will be returned.If the id does not match the id of the active source, then false
will be returned. If the resume()
succeeded, true
will be returned. When true
is returned, a callback will be made to either MediaPlayerObserverInterface::onPlaybackResumed()
or to MediaPlayerObserverInterface::onPlaybackError()
.
id | The unique id of the source on which to operate. |
true
if the call succeeded, in which case a callback will be made, or false
otherwise. Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerInterface.
|
overridevirtual |
Set a url source to play. The source should be set before making calls to any of the playback control APIs. If any source was set prior to this call, that source will be discarded.
MediaPlayerInterface
implementation must handle only one source at a time. An implementation must call MediaPlayerObserverInterface::onPlaybackStopped()
with the previous source's id if there was a source set. Also, an implementation must call MediaPlayerObserverInterface::onBufferingComplete()
when this source has been fully bufferedurl | The url to set as the source. |
offset | An optional offset parameter to start playing from when a play() call is made. |
config | Media configuration of source. |
repeat | An optional parameter to play the url source in a loop. |
playbackContext | An optional parameter used for sending headers needed for data requests. |
SourceId
that represents the source being handled as a result of this call. ERROR
will be returned if the source failed to be set. Must be unique across all instances. Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerInterface.
|
overridevirtual |
Set an AttachmentReader
source to play. The source should be set before making calls to any of the playback control APIs. If any source was set prior to this call, that source will be discarded.
MediaPlayerInterface
implementation must handle only one source at a time. An implementation must call MediaPlayerObserverInterface::onPlaybackStopped()
with the previous source's id if there was a source set. Also, an implementation must call MediaPlayerObserverInterface::onBufferingComplete()
when this source has been fully bufferedattachmentReader | Object with which to read an incoming audio attachment. |
format | The audioFormat to be used to interpret raw audio data. |
config | Media configuration of source. |
SourceId
that represents the source being handled as a result of this call. ERROR
will be returned if the source failed to be set. Must be unique across all instances. Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerInterface.
|
overridevirtual |
Set an AttachmentReader
source to play. The source should be set before making calls to any of the playback control APIs. If any source was set prior to this call, that source will be discarded.
MediaPlayerInterface
implementation must handle only one source at a time. An implementation must call MediaPlayerObserverInterface::onPlaybackStopped()
with the previous source's id if there was a source set. Also, an implementation must call MediaPlayerObserverInterface::onBufferingComplete()
when this source has been fully bufferedattachmentReader | Object with which to read an incoming audio attachment. |
format | The audioFormat to be used to interpret raw audio data. |
offsetAdjustment | Offset adjustment required for the offset reported |
config | Media configuration of source. |
SourceId
that represents the source being handled as a result of this call. ERROR
will be returned if the source failed to be set. Must be unique across all instances. Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerInterface.
|
overridevirtual |
Set an istream
source to play. The source should be set before making calls to any of the playback control APIs. If any source was set prior to this call, that source will be discarded.
MediaPlayerInterface
implementation must handle only one source at a time. An implementation must call MediaPlayerObserverInterface::onPlaybackStopped()
with the previous source's id if there was a source set. Also, an implementation must call MediaPlayerObserverInterface::onBufferingComplete()
when this source has been fully bufferedstream | Object from which to read an incoming audio stream. |
repeat | Whether the audio stream should be played in a loop until stopped. |
config | Media configuration of source. |
format | The MediaType audio encoding format of the incoming audio stream. |
SourceId
that represents the source being handled as a result of this call. ERROR
will be returned if the source failed to be set. Must be unique across all instances. Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerInterface.
|
overridevirtual |
Stops playing the audio specified by the setSource()
call.
The source must be set before issuing stop()
.
Once stop()
has been called, subsequent play()
calls will fail. If stop()
is called when audio has already stopped, false
will be returned. If the id does not match the id of the active source, then false
will be returned. If the stop()
succeeded, true
will be returned. When true
is returned, a callback will be made to either MediaPlayerObserverInterface::onPlaybackStopped()
or to MediaPlayerObserverInterface::onPlaybackError()
.
id | The unique id of the source on which to operate. |
true
if the call succeeded, in which case a callback will be made, or false
otherwise. Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerInterface.
AlexaClientSDK 1.26.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0