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


Public Member Functions | |
| ~MediaPlayer () | |
| void | doShutdown () override |
Overridden MediaPlayerInterface methods. | |
| SourceId | setSource (std::shared_ptr< avsCommon::avs::attachment::AttachmentReader > attachmentReader, const avsCommon::utils::AudioFormat *format=nullptr, const avsCommon::utils::mediaPlayer::SourceConfig &config=avsCommon::utils::mediaPlayer::emptySourceConfig()) override |
| SourceId | setSource (std::shared_ptr< avsCommon::avs::attachment::AttachmentReader > attachmentReader, std::chrono::milliseconds offsetAdjustment, const avsCommon::utils::AudioFormat *format=nullptr, const avsCommon::utils::mediaPlayer::SourceConfig &config=avsCommon::utils::mediaPlayer::emptySourceConfig()) override |
| SourceId | setSource (const std::string &url, std::chrono::milliseconds offset=std::chrono::milliseconds::zero(), const avsCommon::utils::mediaPlayer::SourceConfig &config=avsCommon::utils::mediaPlayer::emptySourceConfig(), bool repeat=false, const avsCommon::utils::mediaPlayer::PlaybackContext &playbackContext=avsCommon::utils::mediaPlayer::PlaybackContext()) override |
| SourceId | setSource (std::shared_ptr< std::istream > stream, bool repeat=false, const avsCommon::utils::mediaPlayer::SourceConfig &config=avsCommon::utils::mediaPlayer::emptySourceConfig(), avsCommon::utils::MediaType format=avsCommon::utils::MediaType::UNKNOWN) override |
| bool | play (SourceId id) override |
| bool | stop (SourceId id) override |
| bool | pause (SourceId id) override |
| bool | resume (SourceId id) override |
| uint64_t | getNumBytesBuffered () override |
| std::chrono::milliseconds | getOffset (SourceId id) override |
| avsCommon::utils::Optional< avsCommon::utils::mediaPlayer::MediaPlayerState > | getMediaPlayerState (SourceId id) override |
| void | addObserver (std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface > observer) override |
| void | removeObserver (std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface > observer) override |
Overridden SpeakerInterface methods. | |
| bool | setVolume (int8_t volume) override |
| bool | setMute (bool mute) override |
| bool | getSpeakerSettings (avsCommon::sdkInterfaces::SpeakerInterface::SpeakerSettings *settings) override |
Overridden PipelineInterface methods. | |
| void | setAppSrc (GstAppSrc *appSrc) override |
| GstAppSrc * | getAppSrc () const override |
| void | setDecoder (GstElement *decoder) override |
| GstElement * | getDecoder () const override |
| GstElement * | getPipeline () const override |
| guint | queueCallback (const std::function< gboolean()> *callback) override |
| guint | attachSource (GSource *source) override |
| gboolean | removeSource (guint tag) override |
Overridden UrlContentToAttachmentConverter::ErrorObserverInterface methods. | |
| void | onError () override |
| void | onWriteComplete () override |
Overridden SourceObserverInterface methods. | |
| void | onFirstByteRead () override |
Public Member Functions inherited from alexaClientSDK::avsCommon::utils::RequiresShutdown | |
| RequiresShutdown (const std::string &name) | |
| virtual | ~RequiresShutdown () |
| Destructor. More... | |
| const std::string & | name () const |
| void | shutdown () |
| bool | isShutdown () const |
Public Member Functions inherited from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerInterface | |
| virtual | ~MediaPlayerInterface ()=default |
| virtual SourceId | setSource (std::shared_ptr< avsCommon::avs::attachment::AttachmentReader > attachmentReader, const avsCommon::utils::AudioFormat *format=nullptr, const SourceConfig &config=emptySourceConfig())=0 |
| virtual SourceId | setSource (std::shared_ptr< avsCommon::avs::attachment::AttachmentReader > attachmentReader, std::chrono::milliseconds offsetAdjustment, const avsCommon::utils::AudioFormat *format=nullptr, const SourceConfig &config=emptySourceConfig())=0 |
| virtual bool | stop (SourceId id, std::chrono::seconds timeToPipelineShutdown) |
| virtual bool | seekTo (SourceId id, std::chrono::milliseconds location, bool fromStart) |
| virtual void | addObserver (std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface > playerObserver)=0 |
| virtual void | removeObserver (std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface > playerObserver)=0 |
| virtual utils::Optional< PlaybackAttributes > | getPlaybackAttributes () |
| virtual std::vector< PlaybackReport > | getPlaybackReports () |
| virtual utils::Optional< Fingerprint > | getFingerprint () |
Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::SpeakerInterface | |
| virtual | ~SpeakerInterface ()=default |
Public Member Functions inherited from alexaClientSDK::acsdkEqualizerInterfaces::EqualizerInterface | |
| virtual | ~EqualizerInterface ()=default |
Public Member Functions inherited from alexaClientSDK::playlistParser::UrlContentToAttachmentConverter::ErrorObserverInterface | |
| virtual | ~ErrorObserverInterface ()=default |
Public Member Functions inherited from alexaClientSDK::playlistParser::UrlContentToAttachmentConverter::WriteCompleteObserverInterface | |
| virtual | ~WriteCompleteObserverInterface ()=default |
Public Member Functions inherited from alexaClientSDK::mediaPlayer::SourceObserverInterface | |
| virtual | ~SourceObserverInterface ()=default |
Static Public Member Functions | |
| static std::shared_ptr< MediaPlayer > | create (std::shared_ptr< avsCommon::sdkInterfaces::HTTPContentFetcherInterfaceFactoryInterface > contentFetcherFactory=nullptr, bool enableEqualizer=false, std::string name="", bool enableLiveMode=false) |
Additional Inherited Members | |
Public Types inherited from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerInterface | |
| using | SourceId = uint64_t |
| A type that identifies which source is currently being operated on. This must be unique across all instances. More... | |
Static Public Attributes inherited from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerInterface | |
| static const SourceId | ERROR = 0 |
An SourceId used to represent an error from calls to setSource(). More... | |
Class that handles creation of audio pipeline and playing of audio data.
| alexaClientSDK::mediaPlayer::MediaPlayer::~MediaPlayer | ( | ) |
Destructor.
|
override |
To resume playback after a pause, call resume. Calling play will reset the pipeline and source, and will not resume playback.
|
overridevirtual |
Attach the source to the worker thread.
| source | The source to be executed on the worker thread. |
Implements alexaClientSDK::mediaPlayer::PipelineInterface.
|
static |
Creates an instance of the MediaPlayer.
| contentFetcherFactory | Used to create objects that can fetch remote HTTP content. |
| enableEqualizer | Flag, indicating whether equalizer should be enabled for this instance. |
| name | Readable name for the new instance. |
| enableLiveMode | Flag, indicating if the player is in live mode. |
MediaPlayer if successful else a nullptr.
|
overridevirtual |
Prepares/enables this object to be deleted. This should be the last function called on this object prior to deleting (or resetting) its shared_ptr.
Implements alexaClientSDK::avsCommon::utils::RequiresShutdown.
|
overridevirtual |
Gets the appSrc element of the AudioPipeline.
Implements alexaClientSDK::mediaPlayer::PipelineInterface.
|
overridevirtual |
Gets the decoder element of the AudioPipeline.
Implements alexaClientSDK::mediaPlayer::PipelineInterface.
|
overridevirtual |
To resume playback after a pause, call resume. Calling play will reset the pipeline and source, and will not resume playback.
Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerInterface.
|
overridevirtual |
To resume playback after a pause, call resume. Calling play will reset the pipeline and source, and will not resume playback.
Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerInterface.
|
overridevirtual |
To resume playback after a pause, call resume. Calling play will reset the pipeline and source, and will not resume playback.
Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerInterface.
|
overridevirtual |
Gets the pipeline of the AudioPipeline.
Implements alexaClientSDK::mediaPlayer::PipelineInterface.
|
overridevirtual |
Return a SpeakerSettings object to indicate the current settings of the SpeakerInterface.
| [out] | settings | A SpeakerSettings object if successful. |
Implements alexaClientSDK::avsCommon::sdkInterfaces::SpeakerInterface.
|
overridevirtual |
Notification that an error has occurred in the streaming of content.
Implements alexaClientSDK::playlistParser::UrlContentToAttachmentConverter::ErrorObserverInterface.
|
overridevirtual |
This indicates that the first bytes of data have been read from the source.
Implements alexaClientSDK::mediaPlayer::SourceObserverInterface.
|
overridevirtual |
Notification that the attachement has had all data written to it
Implements alexaClientSDK::playlistParser::UrlContentToAttachmentConverter::WriteCompleteObserverInterface.
|
overridevirtual |
To resume playback after a pause, call resume. Calling play will reset the pipeline and source, and will not resume playback.
Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerInterface.
|
overridevirtual |
To resume playback after a pause, call resume. Calling play will reset the pipeline and source, and will not resume playback.
Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerInterface.
|
overridevirtual |
Queue the specified callback for execution on the worker thread.
| callback | The callback to queue. |
g_source_remove). Implements alexaClientSDK::mediaPlayer::PipelineInterface.
|
override |
To resume playback after a pause, call resume. Calling play will reset the pipeline and source, and will not resume playback.
|
overridevirtual |
Remove the callback from the worker thread.
| The | ID of the queued callback. |
Implements alexaClientSDK::mediaPlayer::PipelineInterface.
|
overridevirtual |
To resume playback after a pause, call resume. Calling play will reset the pipeline and source, and will not resume playback.
Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerInterface.
|
overridevirtual |
Sets the appSrc element in the AudioPipeline.
| appSrc | The element the appSrc of AudioPipeline should be set to. |
Implements alexaClientSDK::mediaPlayer::PipelineInterface.
|
overridevirtual |
Sets the decoder element in the AudioPipeline
| decoder | The element the decoder of AudioPipeline should be set to. |
Implements alexaClientSDK::mediaPlayer::PipelineInterface.
|
overridevirtual |
Set the mute of the speaker.
| mute | Represents whether the speaker should be muted (true) or unmuted (false). |
Implements alexaClientSDK::avsCommon::sdkInterfaces::SpeakerInterface.
|
override |
To resume playback after a pause, call resume. Calling play will reset the pipeline and source, and will not resume playback.
|
override |
To resume playback after a pause, call resume. Calling play will reset the pipeline and source, and will not resume playback.
|
overridevirtual |
To resume playback after a pause, call resume. Calling play will reset the pipeline and source, and will not resume playback.
Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerInterface.
|
overridevirtual |
To resume playback after a pause, call resume. Calling play will reset the pipeline and source, and will not resume playback.
Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerInterface.
|
overridevirtual |
Set the absolute volume of the speaker. volume will be [AVS_SET_VOLUME_MIN, AVS_SET_VOLUME_MAX], and implementers of the interface must normalize the volume to fit the needs of their drivers.
| volume | A volume to set the speaker to. |
Implements alexaClientSDK::avsCommon::sdkInterfaces::SpeakerInterface.
|
overridevirtual |
To resume playback after a pause, call resume. Calling play will reset the pipeline and source, and will not resume playback.
Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerInterface.
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0