AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Public Member Functions | Static Public Member Functions | List of all members
alexaClientSDK::playlistParser::UrlContentToAttachmentConverter Class Reference

Class that handles the streaming of urls containing media into Attachments. More...

#include <UrlContentToAttachmentConverter.h>

Inheritance diagram for alexaClientSDK::playlistParser::UrlContentToAttachmentConverter:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::playlistParser::UrlContentToAttachmentConverter:
Collaboration graph
[legend]

Classes

class  ErrorObserverInterface
 Class to observe errors that arise from converting a URL to to an Attachment. More...
 
class  WriteCompleteObserverInterface
 Class to allow notification when writing to the attachment is complete. More...
 

Public Member Functions

std::shared_ptr< avsCommon::avs::attachment::InProcessAttachmentgetAttachment ()
 
std::chrono::milliseconds getStartStreamingPoint ()
 
std::chrono::milliseconds getDesiredStreamingPoint ()
 
void doShutdown () override
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::utils::playlistParser::PlaylistParserObserverInterface
virtual ~PlaylistParserObserverInterface ()=default
 
- 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< UrlContentToAttachmentConvertercreate (std::shared_ptr< avsCommon::sdkInterfaces::HTTPContentFetcherInterfaceFactoryInterface > contentFetcherFactory, const std::string &url, std::shared_ptr< ErrorObserverInterface > observer, std::chrono::milliseconds startTime=std::chrono::milliseconds::zero(), std::shared_ptr< WriteCompleteObserverInterface > writeCompleteObserver=nullptr, size_t numOfReaders=1)
 

Additional Inherited Members

Detailed Description

Class that handles the streaming of urls containing media into Attachments.

Member Function Documentation

◆ create()

static std::shared_ptr<UrlContentToAttachmentConverter> alexaClientSDK::playlistParser::UrlContentToAttachmentConverter::create ( std::shared_ptr< avsCommon::sdkInterfaces::HTTPContentFetcherInterfaceFactoryInterface contentFetcherFactory,
const std::string &  url,
std::shared_ptr< ErrorObserverInterface observer,
std::chrono::milliseconds  startTime = std::chrono::milliseconds::zero(),
std::shared_ptr< WriteCompleteObserverInterface writeCompleteObserver = nullptr,
size_t  numOfReaders = 1 
)
static

Creates a converter object. Note that calling this function will commence the parsing and streaming of the URL into the internal attachment. If a desired start time is specified, this function will attempt to start streaming at that offset, based on available metadata if the URL points to a playlist file. If no such information is available, streaming will begin from the beginning. It is up to the caller of this function to make a call to getStartStreamingPoint() to find out the actual offset from which streaming began.

Parameters
contentFetcherFactoryUsed to create HTTPContentFetchers.
urlThe URL to stream from.
observerAn observer to be notified of any errors that may happen during streaming.
startTimeThe desired time to attempt to start streaming from. Note that this will only succeed in cases where the URL points to a playlist with metadata about individual chunks within it. If none are found, streaming will begin from the beginning.
writeCompleteObserverAn observer to be notified when data written to the attachment is complete. Optional.
numOfReadersMaximum number of readers to this contentFetcher.
Returns
A std::shared_ptr to the new UrlContentToAttachmentConverter object or nullptr on failure.
Note
This object is intended to be used once. Subsequent calls to convertPlaylistToAttachment() will fail.

◆ doShutdown()

void alexaClientSDK::playlistParser::UrlContentToAttachmentConverter::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.

◆ getAttachment()

std::shared_ptr<avsCommon::avs::attachment::InProcessAttachment> alexaClientSDK::playlistParser::UrlContentToAttachmentConverter::getAttachment ( )

Returns the attachment into which the URL content was streamed into.

Returns
A std::shared_ptr of an InProcessAttachment or nullptr on failure.

◆ getDesiredStreamingPoint()

std::chrono::milliseconds alexaClientSDK::playlistParser::UrlContentToAttachmentConverter::getDesiredStreamingPoint ( )

Gets the initial desired point of steaming.

Returns
The point from which streaming was desired to begin at.

◆ getStartStreamingPoint()

std::chrono::milliseconds alexaClientSDK::playlistParser::UrlContentToAttachmentConverter::getStartStreamingPoint ( )

Gets the actual point from which streaming began.

Returns
The point from which streaming began.

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

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