AlexaClientSDK  1.20.1
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
Collaboration diagram for alexaClientSDK::playlistParser::UrlContentToAttachmentConverter:
Collaboration graph


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()

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 

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.

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.
A std::shared_ptr to the new UrlContentToAttachmentConverter object or nullptr on failure.
This object is intended to be used once. Subsequent calls to convertPlaylistToAttachment() will fail.

◆ doShutdown()

void alexaClientSDK::playlistParser::UrlContentToAttachmentConverter::doShutdown ( )

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.

  • 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< InProcessAttachment > alexaClientSDK::playlistParser::UrlContentToAttachmentConverter::getAttachment ( )

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

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.

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.

The point from which streaming began.

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

AlexaClientSDK 1.20.1 - Copyright 2016-2020, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0