AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | Static Public Member Functions | List of all members
alexaClientSDK::acsdkAlerts::renderer::Renderer Class Reference

#include <Renderer.h>

Inheritance diagram for alexaClientSDK::acsdkAlerts::renderer::Renderer:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::acsdkAlerts::renderer::Renderer:
Collaboration graph
[legend]

Public Member Functions

void start (std::shared_ptr< RendererObserverInterface > observer, std::function< std::pair< std::unique_ptr< std::istream >, const avsCommon::utils::MediaType >()> audioFactory, bool volumeRampEnabled, const std::vector< std::string > &urls=std::vector< std::string >(), int loopCount=0, std::chrono::milliseconds loopPause=std::chrono::milliseconds{0}, bool startWithPause=false) override
 
void stop () override
 
void onFirstByteRead (SourceId sourceId, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
 
void onPlaybackStarted (SourceId sourceId, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
 
void onPlaybackStopped (SourceId sourceId, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
 
void onPlaybackFinished (SourceId sourceId, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
 
void onPlaybackError (SourceId sourceId, const avsCommon::utils::mediaPlayer::ErrorType &type, std::string error, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
 
void onConnectionStatusChanged (bool connected) override
 
- Public Member Functions inherited from alexaClientSDK::acsdkAlerts::renderer::RendererInterface
virtual ~RendererInterface ()=default
 
virtual void start (std::shared_ptr< acsdkAlerts::renderer::RendererObserverInterface > observer, std::function< std::pair< std::unique_ptr< std::istream >, const avsCommon::utils::MediaType >()> audioFactory, bool volumeRampEnabled, const std::vector< std::string > &urls=std::vector< std::string >(), int loopCount=0, std::chrono::milliseconds loopPause=std::chrono::milliseconds{0}, bool startWithPause=false)=0
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::InternetConnectionObserverInterface
virtual ~InternetConnectionObserverInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface
virtual ~MediaPlayerObserverInterface ()=default
 
virtual void onPlaybackPaused (SourceId, const MediaPlayerState &)
 
virtual void onPlaybackResumed (SourceId, const MediaPlayerState &)
 
virtual void onBufferUnderrun (SourceId, const MediaPlayerState &)
 
virtual void onBufferRefilled (SourceId, const MediaPlayerState &)
 
virtual void onBufferingComplete (SourceId, const MediaPlayerState &)
 
virtual void onSeeked (SourceId, const MediaPlayerState &, const MediaPlayerState &)
 
virtual void onTags (SourceId, std::unique_ptr< const VectorOfTags >, const MediaPlayerState &)
 
- 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
 

Static Public Member Functions

static std::shared_ptr< RenderercreateAlertRenderer (const std::shared_ptr< acsdkApplicationAudioPipelineFactoryInterfaces::ApplicationAudioPipelineFactoryInterface > &audioPipelineFactory, const std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > &metricRecorder, const std::shared_ptr< acsdkShutdownManagerInterfaces::ShutdownNotifierInterface > &shutdownNotifier, const std::shared_ptr< avsCommon::sdkInterfaces::InternetConnectionMonitorInterface > &internetConnectionMonitor)
 
static std::shared_ptr< Renderercreate (std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerInterface > mediaPlayer, std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > metricRecorder=nullptr, std::shared_ptr< avsCommon::sdkInterfaces::InternetConnectionMonitorInterface > internetConnectionMonitor=nullptr)
 

Additional Inherited Members

- Public Types inherited from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface
enum  TagType {
  TagType::STRING, TagType::UINT, TagType::INT, TagType::DOUBLE,
  TagType::BOOLEAN
}
 The different types of metadata "stream tags". More...
 
using SourceId = MediaPlayerInterface::SourceId
 A type that identifies which source is currently being operated on. More...
 
typedef std::vector< TagKeyValueTypeVectorOfTags
 

Detailed Description

An implementation of an alert renderer. This class is thread-safe.

Member Function Documentation

◆ create()

std::shared_ptr< Renderer > alexaClientSDK::acsdkAlerts::renderer::Renderer::create ( std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerInterface mediaPlayer,
std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface metricRecorder = nullptr,
std::shared_ptr< avsCommon::sdkInterfaces::InternetConnectionMonitorInterface internetConnectionMonitor = nullptr 
)
static

Creates a Renderer.

Deprecated:
Use createAlertRenderer.
Parameters
mediaPlayerthe MediaPlayerInterface that the Renderer object will interact with.
metricRecorderthe metric recorder.
internetConnectionMonitorThe object use to monitor connectivity with the internet.
Returns
The Renderer object.

◆ createAlertRenderer()

std::shared_ptr< Renderer > alexaClientSDK::acsdkAlerts::renderer::Renderer::createAlertRenderer ( const std::shared_ptr< acsdkApplicationAudioPipelineFactoryInterfaces::ApplicationAudioPipelineFactoryInterface > &  audioPipelineFactory,
const std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > &  metricRecorder,
const std::shared_ptr< acsdkShutdownManagerInterfaces::ShutdownNotifierInterface > &  shutdownNotifier,
const std::shared_ptr< avsCommon::sdkInterfaces::InternetConnectionMonitorInterface > &  internetConnectionMonitor 
)
static

Factory method to create an Alerts Renderer.

Parameters
audioPipelineFactoryThe ApplicationAudioPlayerInterface instance to use to create the notifications media player for rendering audio.
internetConnectionMonitorThe object use to monitor connectivity with the internet.
metricRecorderthe metric recorder.
shutdownNotifierthe ShutdownNotifier to notify if a shutdown occurred.
Returns
The Renderer object.

◆ onConnectionStatusChanged()

void alexaClientSDK::acsdkAlerts::renderer::Renderer::onConnectionStatusChanged ( bool  connected)
overridevirtual

Take necessary actions as a result of an internet connection change.

Parameters
connectedWhether or not we are currently connected to the internet.

Implements alexaClientSDK::avsCommon::sdkInterfaces::InternetConnectionObserverInterface.

◆ onFirstByteRead()

void alexaClientSDK::acsdkAlerts::renderer::Renderer::onFirstByteRead ( SourceId  id,
const avsCommon::utils::mediaPlayer::MediaPlayerState state 
)
overridevirtual

This is an indication to the observer that the MediaPlayer has read its first byte of data.

Parameters
idThe id of the source to which this callback corresponds to.
stateMetadata about the media player state

Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.

◆ onPlaybackError()

void alexaClientSDK::acsdkAlerts::renderer::Renderer::onPlaybackError ( SourceId  id,
const avsCommon::utils::mediaPlayer::ErrorType type,
std::string  error,
const avsCommon::utils::mediaPlayer::MediaPlayerState state 
)
overridevirtual

This is an indication to the observer that the MediaPlayer encountered an error. Errors can occur during playback.

Note
The observer must quickly return from this callback. Failure to do so could block the MediaPlayer from further processing.
Parameters
idThe id of the source to which this callback corresponds to.
typeThe type of error encountered by the MediaPlayerInterface.
errorThe error encountered by the MediaPlayerInterface.
stateMetadata about the media player state

Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.

◆ onPlaybackFinished()

void alexaClientSDK::acsdkAlerts::renderer::Renderer::onPlaybackFinished ( SourceId  id,
const avsCommon::utils::mediaPlayer::MediaPlayerState state 
)
overridevirtual

This is an indication to the observer that the MediaPlayer finished the source.

Note
The observer must quickly return to quickly from this callback. Failure to do so could block the MediaPlayer from further processing.
Parameters
idThe id of the source to which this callback corresponds to.
stateMetadata about the media player state

Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.

◆ onPlaybackStarted()

void alexaClientSDK::acsdkAlerts::renderer::Renderer::onPlaybackStarted ( SourceId  id,
const avsCommon::utils::mediaPlayer::MediaPlayerState state 
)
overridevirtual

This is an indication to the observer that the MediaPlayer has started playing the source specified by the id.

Note
The observer must quickly return to quickly from this callback. Failure to do so could block the MediaPlayer from further processing.
Parameters
idThe id of the source to which this callback corresponds to.
stateMetadata about the media player state

Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.

◆ onPlaybackStopped()

void alexaClientSDK::acsdkAlerts::renderer::Renderer::onPlaybackStopped ( SourceId  ,
const avsCommon::utils::mediaPlayer::MediaPlayerState  
)
overridevirtual

This is an indication to the observer that the MediaPlayer has stopped the source.

Note
The observer must quickly return from this callback. Failure to do so could block the MediaPlayer from further processing.
Parameters
SourceIdThe id of the source to which this callback corresponds to.
MediaPlayerStateMetadata about the media player state

Reimplemented from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.

◆ start()

void alexaClientSDK::acsdkAlerts::renderer::Renderer::start ( std::shared_ptr< RendererObserverInterface observer,
std::function< std::pair< std::unique_ptr< std::istream >, const avsCommon::utils::MediaType >()>  audioFactory,
bool  volumeRampEnabled,
const std::vector< std::string > &  urls = std::vector<std::string>(),
int  loopCount = 0,
std::chrono::milliseconds  loopPause = std::chrono::milliseconds{0},
bool  startWithPause = false 
)
override

◆ stop()

void alexaClientSDK::acsdkAlerts::renderer::Renderer::stop ( )
overridevirtual

The documentation for this class was generated from the following files:

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