upload(segments, manifest, options)
Encrypts HLS segments in the browser and uploads them to S3 via presigned URLs.
Parameters:
| Parameter | Type | Description |
|---|---|---|
segments | SegmentInput[] | Array of HLS segments to encrypt and upload |
manifest | string | The .m3u8 manifest text |
options | UploadOptions | Configuration for the upload |
Promise<Result<UploadResult, UploaderError>>
UploadOptions
SegmentInput
UploadResult
UploadProgress
Error codes
| Code | Cause |
|---|---|
KEY_FETCH_FAILED | Could not fetch content key from key server |
ENCRYPT_FAILED | Segment encryption failed |
PRESIGN_FAILED | Presign endpoint returned an error or non-200 status |
UPLOAD_FAILED | S3 upload failed (network error or rejected) |
MANIFEST_PARSE_ERROR | The manifest text is not valid HLS |
INVALID_INPUT | Segments array is empty, contentId is invalid, or segment data is missing |
ABORTED | Upload was cancelled via AbortSignal |