backend: Add support for range requests and improve media retrieval headers

This commit is contained in:
Carlos Santos 2025-04-29 14:21:20 +02:00
parent f841f55c71
commit b5b7776200
6 changed files with 32 additions and 19 deletions

View File

@ -0,0 +1,4 @@
description: Indicates that the server supports range requests for content retrieval
schema:
type: string
example: bytes

View File

@ -0,0 +1,4 @@
description: Directives for caching mechanisms in requests/responses
schema:
type: string
example: public, max-age=3600

View File

@ -0,0 +1,3 @@
description: The size of the content in bytes
schema:
type: integer

View File

@ -0,0 +1,4 @@
description: Specifies the range of bytes being sent and the total size of the resource
schema:
type: string
example: bytes 0-1023/10240

View File

@ -2,7 +2,10 @@ name: Range
in: header
required: false
description: >
Byte range for partial content retrieval.
Example: `bytes=0-1023` to request the first 1024 bytes of the file.
This endpoint accepts a `Range` header to specify the byte range of the recording file to be streamed.
The format of the `Range` header should be `bytes=start-end`, where `start` is required and `end` is optional.
For example,
- `bytes=0-1023` to request the first 1024 bytes of the file.
- `bytes=1000-` to request from byte 1000 to the end of the file.
schema:
type: string

View File

@ -135,7 +135,7 @@
$ref: '../components/responses/internal-server-error.yaml'
/recordings/{recordingId}/media:
get:
operationId: getRecordingMeedia
operationId: getRecordingMedia
summary: Get recording media
description: >
Retrieves the media of a recording with the specified recording ID.
@ -145,6 +145,7 @@
tags:
- OpenVidu Meet - Recordings
security:
- apiKeyInHeader: []
- accessTokenCookie: []
parameters:
- $ref: '../components/parameters/recording-id.yaml'
@ -154,13 +155,11 @@
description: Successfully streaming the full recording
headers:
Accept-Ranges:
description: Indicates that byte-range requests are supported
schema:
type: string
$ref: '../components/headers/accept-ranges.yaml'
Content-Length:
description: The total file size in bytes
schema:
type: integer
$ref: '../components/headers/content-length.yaml'
Cache-Control:
$ref: '../components/headers/cache-control.yaml'
content:
video/mp4:
schema:
@ -170,17 +169,13 @@
description: Partial content streaming based on byte range
headers:
Accept-Ranges:
description: Indicates that byte-range requests are supported
schema:
type: string
Content-Range:
description: Specifies the range of bytes being sent
schema:
type: string
$ref: '../components/headers/accept-ranges.yaml'
Content-Length:
description: The length of the partial content in bytes
schema:
type: integer
$ref: '../components/headers/content-length.yaml'
Cache-Control:
$ref: '../components/headers/cache-control.yaml'
Content-Range:
$ref: '../components/headers/content-range.yaml'
content:
video/mp4:
schema: