diff --git a/stream/premium-encoding.mdx b/stream/premium-encoding.mdx index 858b46c8..02a8ac5c 100644 --- a/stream/premium-encoding.mdx +++ b/stream/premium-encoding.mdx @@ -14,7 +14,7 @@ In most cases, videos become playable within **10–15 seconds**, regardless of JIT automatically adapts to different resolutions, bitrates, devices, and network conditions. This ensures a smooth playback experience across a wide range of environments, helping improve viewer engagement and retention. When content is instantly accessible and optimized for each viewer, users are more likely to stay, interact, and return. - Just-in-Time (JIT) encoding is only supported by the Bunny player. We cannot guarantee it will work with 3rd party or custom video players. + Just-in-Time (JIT) encoding is only supported by the Bunny player. We cannot guarantee it will work with 3rd party or custom video players. #### Performance Considerations diff --git a/stream/tus-resumable-uploads.mdx b/stream/tus-resumable-uploads.mdx index 9a66d40a..fb2d61f2 100644 --- a/stream/tus-resumable-uploads.mdx +++ b/stream/tus-resumable-uploads.mdx @@ -5,9 +5,9 @@ description: "Upload videos to Bunny Stream using the TUS protocol for resumable The TUS resumable upload endpoint allows resumable and presigned uploads of video files. This enables end-users to upload directly to Bunny Stream and greatly improves reliability on poor networks and mobile connections. -The endpoint uses the open [tus protocol](https://tus.io/) for resumable file uploads. Before a video can be uploaded through the TUS endpoint, a video object must be created through the [Create Video](/api-reference/stream) API call to obtain the video ID. +The endpoint uses the open [TUS Protocol](https://tus.io/) for resumable file uploads. Before a video can be uploaded through the TUS endpoint, a video object must be created through the [Create Video API](/api-reference/stream) call to obtain the video ID. -## TUS endpoint +## TUS upload API endpoint ```text https://video.bunnycdn.com/tusupload @@ -15,7 +15,7 @@ https://video.bunnycdn.com/tusupload ## How it works -1. **Create a video object** using the [Create Video](/api-reference/stream) API to get a `videoId`. +1. **Create a video object** using the [Create Video API](/api-reference/stream) to get a `videoId`. 2. **Generate a presigned signature** on your server using SHA256. 3. **Upload the file** from the client using a TUS client library with the presigned credentials. @@ -25,23 +25,23 @@ This approach allows secure direct uploads from end-users without exposing your To authenticate a TUS upload request, the following headers must be included: -| Header | Description | -| ------------------------ | --------------------------------------------------- | -| `AuthorizationSignature` | SHA256 signature for request validation | -| `AuthorizationExpire` | UNIX timestamp (in seconds) when the upload expires | -| `LibraryId` | The ID of the video library | -| `VideoId` | The GUID of the previously created video object | +| Header | Description | +| --- | --- | +| `AuthorizationSignature` | SHA256 signature for request validation | +| `AuthorizationExpire` | UNIX timestamp (in seconds) when the upload expires | +| `LibraryId` | The ID of the video library | +| `VideoId` | The GUID of the previously created video object | ## Video metadata parameters The following metadata can be passed with the TUS upload: -| Parameter | Required | Description | -| --------------- | -------- | -------------------------------------------------------- | -| `filetype` | Yes | The MIME type of the uploaded video (e.g., `video/mp4`) | -| `title` | Yes | The title of the video | -| `collection` | No | The GUID of the collection to upload to | -| `thumbnailTime` | No | Time in milliseconds to extract the main video thumbnail | +| Parameter | Required | Description | +| --- | --- | --- | +| `filetype` | Yes | The MIME type of the uploaded video (e.g., `video/mp4`) | +| `title` | Yes | The title of the video | +| `collection` | No | The GUID of the collection to upload to | +| `thumbnailTime` | No | Time in milliseconds to extract the main video thumbnail | ## Generating the signature @@ -76,7 +76,6 @@ const signature = crypto .digest("hex"); ``` - ```php PHP Ensure any `AuthorizationExpire` timestamp is at least 1 hour (3600 seconds) or longer to make sure uploads are completed before authorization expires. + +#### Resumable (TUS) upload FAQ + +Common questions about how authorization and resumability behave when uploading video with the TUS resumable protocol. + + + + `AuthorizationExpire` is validated at the start of **every** `POST`, `HEAD`, and `PATCH` request - not only at upload creation. It is **not** rechecked during an active `PATCH`, so a chunk that is already streaming will not be interrupted mid-request if the signature expires while data is in flight. + + + + Yes. The same video GUID can be re-signed and used to resume through the existing TUS upload URL - there is no need to create a new video object. + + Note that a newly generated signature does **not** extend the upload resource's original expiry. Re-signing lets you continue an existing upload; it does not reset the clock on how long that upload remains available. + + + + An incomplete upload remains resumable until the `AuthorizationExpire` value that was used when it was created, or after roughly **48 hours of inactivity** - whichever comes first. + + Once it expires, requesting the upload returns `404 Not Found `(not `410`). + + \ No newline at end of file