graph LR
FlaskAskRequestDispatcher["FlaskAskRequestDispatcher"]
AudioStreamStateManager["AudioStreamStateManager"]
AudioStreamDataExtractor["AudioStreamDataExtractor"]
AudioPlaybackDirectiveGenerator["AudioPlaybackDirectiveGenerator"]
AudioDirectiveFactory["AudioDirectiveFactory"]
FlaskAskRequestDispatcher -- "updates state of" --> AudioStreamStateManager
AudioStreamStateManager -- "retrieves details from" --> AudioStreamDataExtractor
AudioStreamDataExtractor -- "provides data to" --> AudioStreamStateManager
AudioPlaybackDirectiveGenerator -- "constructs directives for" --> AudioDirectiveFactory
AudioDirectiveFactory -- "receives requests from" --> AudioPlaybackDirectiveGenerator
The Flask-Ask audio subsystem orchestrates the management and playback of audio streams within Alexa skills. It begins with the FlaskAskRequestDispatcher handling incoming Alexa requests, which then updates the AudioStreamStateManager to reflect the current audio playback context. The AudioStreamStateManager relies on the AudioStreamDataExtractor to accurately parse and provide necessary audio stream details from these requests. For generating audio responses, skill developers interact with the AudioPlaybackDirectiveGenerator, a high-level interface that delegates the creation of precise Alexa AudioPlayer directives to the AudioDirectiveFactory, ensuring compliance with Alexa API specifications. This structured interaction enables robust and context-aware audio experiences for Alexa skill users.
Responsible for receiving and processing incoming Alexa requests within the Flask-Ask framework. It dispatches these requests to appropriate handlers and initiates updates to the audio stream state based on the request type (e.g., AudioPlayer events). This component acts as the central entry point for Alexa interactions.
Related Classes/Methods:
Manages and maintains the current state of the audio stream within the Flask-Ask application's context. It is responsible for updating the stream's status based on incoming Alexa requests (e.g., AudioPlayer.PlaybackStarted, AudioPlayer.PlaybackFinished) and providing the current playback details to other parts of the application. This component is fundamental for enabling continuous and context-aware audio experiences.
Related Classes/Methods:
Specializes in parsing and extracting relevant audio stream information from various parts of an incoming Alexa request. This includes details from the session context (e.g., previously played audio) and specific AudioPlayer directives (e.g., AudioPlayer.PlaybackStarted). It acts as an interpreter, making raw request data accessible for audio state management.
Related Classes/Methods:
Provides a high-level, developer-friendly interface for initiating, enqueuing, or resuming audio playback. It abstracts the complexity of Alexa's AudioPlayer directives, allowing skill developers to simply call methods like play(), enqueue(), or resume() to control audio output. This component is the primary entry point for developers to programmatically manage audio.
Related Classes/Methods:
A utility component responsible for the low-level assembly and validation of Alexa AudioItem objects and complete AudioPlayer.Play directives. It ensures that the generated directives conform precisely to the Alexa API specifications, handling details like token generation, URL formatting, and play behavior.
Related Classes/Methods: