Audio
This module provides API endpoints for streaming audio files.
stream_audio(document_id, request, file_service, user)
async
Streams an audio file from the server.
This endpoint retrieves file information for a given document ID and returns a FileResponse to stream the audio file. It delegates Range handling to Starlette's FileResponse implementation.
Parameters:
-
document_id(UUID) –The unique identifier of the audio document to stream.
-
request(Request) –The FastAPI Request object.
-
file_service(Annotated[FileService, Depends(get_file_service)]) –The file service for handling file operations.
-
user(Annotated[Optional[User], Depends(get_optional_user)]) –The optionally authenticated user making the request.
Returns:
-
FileResponse(FileResponse) –A response object that streams the requested audio file.
Raises:
-
EntityNotFound–If the document or its associated connector is not found.
-
FunctionalError–If there is a functional issue with the request.
-
TechnicalError–If an unexpected error occurs during streaming.
Source code in app/api/v1/endpoints/audio.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |