#include <NotificationRenderer.h>
|
|
void | addObserver (std::shared_ptr< NotificationRendererObserverInterface > observer) override |
|
void | removeObserver (std::shared_ptr< NotificationRendererObserverInterface > observer) override |
|
bool | renderNotification (std::function< std::pair< std::unique_ptr< std::istream >, const avsCommon::utils::MediaType >()> audioFactory, const std::string &url) override |
|
bool | cancelNotificationRendering () 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 | doShutdown () override |
|
|
void | onFocusChanged (alexaClientSDK::avsCommon::avs::FocusState newFocus, avsCommon::avs::MixingBehavior behavior) override |
|
virtual | ~NotificationRendererInterface ()=default |
|
virtual | ~MediaPlayerObserverInterface ()=default |
|
virtual void | onPlaybackPaused (SourceId id, const MediaPlayerState &state) |
|
virtual void | onPlaybackResumed (SourceId id, const MediaPlayerState &state) |
|
virtual void | onBufferUnderrun (SourceId id, const MediaPlayerState &state) |
|
virtual void | onBufferRefilled (SourceId id, const MediaPlayerState &state) |
|
virtual void | onBufferingComplete (SourceId id, const MediaPlayerState &state) |
|
virtual void | onTags (SourceId id, std::unique_ptr< const VectorOfTags > vectorOfTags, const MediaPlayerState &state) |
|
| RequiresShutdown (const std::string &name) |
|
virtual | ~RequiresShutdown () |
| Destructor. More...
|
|
const std::string & | name () const |
|
void | shutdown () |
|
bool | isShutdown () const |
|
virtual | ~ChannelObserverInterface ()=default |
|
|
std::ostream & | operator<< (std::ostream &stream, const NotificationRenderer::State state) |
| Friend relationship to allow accessing State to convert it to a string for logging. More...
|
|
Implementation of NotificationRendererInterface using the MediaPlayerInterface
◆ SourceId
A type that identifies which source is currently being operated on.
◆ addObserver()
◆ cancelNotificationRendering()
bool alexaClientSDK::capabilityAgents::notifications::NotificationRenderer::cancelNotificationRendering |
( |
| ) |
|
|
overridevirtual |
◆ create()
◆ doShutdown()
void alexaClientSDK::capabilityAgents::notifications::NotificationRenderer::doShutdown |
( |
| ) |
|
|
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.
- Warning
- Attempting to call functions on this object after calling shutdown() can result in undefined behavior.
- Neglecting to call shutdown() on this object can result in resource leaks or other undefined behavior.
Implements alexaClientSDK::avsCommon::utils::RequiresShutdown.
◆ onFirstByteRead()
◆ onFocusChanged()
Used to notify the observer of the Channel of focus changes. Once called, the client should make a user observable change only and return immediately. Any additional work that needs to be done should be done on a separate thread or after returning. "User observable change" here refers to events that the end user of the product can visibly see or hear. For example, Alexa speech or music playing would be examples of user observable changes. Other work, such as database storing, logging, or communicating via network should be done on a different thread. Not doing so could result in delays for other clients trying to access the Channel.
- Parameters
-
newFocus | The new Focus of the channel. |
behavior | The mixingBehavior for the ChannelObserver to take as per the interrupt model |
- Note
- when newFocus is FocusState::FOREGROUND, the MixingBehavior shall be guaranteed to be PRIMARY when newFocus is FocusState::NONE, the MixingBehavior shall be guaranteed to be MUST_STOP
Implements alexaClientSDK::avsCommon::sdkInterfaces::ChannelObserverInterface.
◆ onPlaybackError()
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
-
id | The id of the source to which this callback corresponds to. |
type | The type of error encountered by the MediaPlayerInterface . |
error | The error encountered by the MediaPlayerInterface . |
state | Metadata about the media player state |
Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.
◆ onPlaybackFinished()
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
-
id | The id of the source to which this callback corresponds to. |
state | Metadata about the media player state |
Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.
◆ onPlaybackStarted()
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
-
id | The id of the source to which this callback corresponds to. |
state | Metadata about the media player state |
Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.
◆ onPlaybackStopped()
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
-
id | The id of the source to which this callback corresponds to. |
state | Metadata about the media player state |
Reimplemented from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.
◆ removeObserver()
◆ renderNotification()
bool alexaClientSDK::capabilityAgents::notifications::NotificationRenderer::renderNotification |
( |
std::function< std::pair< std::unique_ptr< std::istream >, const avsCommon::utils::MediaType >()> |
audioFactory, |
|
|
const std::string & |
url |
|
) |
| |
|
overridevirtual |
Render (play) a notification audio clip. If the asset at the specified url cannot be played for some reason, the default notification audio clip should be played, instead. If renderNotification is called while another rendering operation is in progress, this method fails and returns false.
- Note
- : Calling this method from a NotificationRendererObserverInterface callback will lead to a deadlock.
- Parameters
-
audioFactory | A function that produces a pair of audio stream and media type char to play if the audio specified by url can not be played. |
url | URL of the preferred audio asset to play. |
- Returns
- Whether rendering the notification was initiated.
Implements alexaClientSDK::capabilityAgents::notifications::NotificationRendererInterface.
◆ operator<<
std::ostream& operator<< |
( |
std::ostream & |
stream, |
|
|
const NotificationRenderer::State |
state |
|
) |
| |
|
friend |
Friend relationship to allow accessing State to convert it to a string for logging.
Emit a NotificationRenderer::State value to a stream.
- Parameters
-
stream | The stream to emit the value to. |
state | The state to emit. |
- Returns
- The stream that was emitted to, allowing chained stream operators.
The documentation for this class was generated from the following files:
- /home/ANT.AMAZON.COM/womw/workplace/1.19_release/doxy/avs-device-sdk/CapabilityAgents/Notifications/include/Notifications/NotificationRenderer.h
- /home/ANT.AMAZON.COM/womw/workplace/1.19_release/doxy/avs-device-sdk/CapabilityAgents/Notifications/src/NotificationRenderer.cpp
AlexaClientSDK 1.19.0 - Copyright 2016-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0