Provide "in-band" encoding errors

This commit is contained in:
Vanilagy
2025-06-05 15:31:38 +02:00
parent d0d847edf8
commit c600b60ee0
6 changed files with 87 additions and 48 deletions
-8
View File
@@ -59,9 +59,6 @@ type VideoEncodingConfig = {
packet: EncodedPacket,
meta: EncodedVideoChunkMetadata | undefined
) => unknown;
onEncoderError?: (
error: Error
) => unknown;
onEncoderConfig?: (
config: AudioEncoderConfig
) => unknown;
@@ -73,7 +70,6 @@ type VideoEncodingConfig = {
- `keyFrameInterval`: The maximum interval in seconds between two adjacent key frames. Defaults to 5 seconds. More frequent key frames improve seeking behavior but increase file size. When using multiple video tracks, this value should be set to the same value for all tracks.
- `fullCodecString`: Allows you to optionally specify the full codec string used by the video encoder, as specified in the [WebCodecs Codec Registry](https://www.w3.org/TR/webcodecs-codec-registry/). For example, you may set it to `'avc1.42001f'` when using AVC. Keep in mind that the codec string must still match the codec specified in `codec`. If you don't set this field, a codec string will be generated automatically.
- `onEncodedPacket`: Called for each successfully encoded packet. Useful for determining encoding progress.
- `onEncoderError`: Called when an error occurs within [VideoEncoder](https://developer.mozilla.org/en-US/docs/Web/API/VideoEncoder).
- `onEncoderConfig`: Called when the internal encoder config, as used by the WebCodecs API, is created. You can use this to introspect the full codec string.
### Audio encoding config
@@ -89,9 +85,6 @@ type AudioEncodingConfig = {
packet: EncodedPacket,
meta: EncodedAudioChunkMetadata | undefined
) => unknown;
onEncoderError?: (
error: Error
) => unknown;
onEncoderConfig?: (
config: AudioEncoderConfig
) => unknown;
@@ -101,7 +94,6 @@ type AudioEncodingConfig = {
- `bitrate`: The target number of bits per second. Alternatively, this can be a [subjective quality](#subjective-qualities).
- `fullCodecString`: Allows you to optionally specify the full codec string used by the audio encoder, as specified in the [WebCodecs Codec Registry](https://www.w3.org/TR/webcodecs-codec-registry/). For example, you may set it to `'mp4a.40.2'` when using AAC. Keep in mind that the codec string must still match the codec specified in `codec`. If you don't set this field, a codec string will be generated automatically.
- `onEncodedPacket`: Called for each successfully encoded packet. Useful for determining encoding progress.
- `onEncoderError`: Called when an error occurs within [AudioEncoder](https://developer.mozilla.org/en-US/docs/Web/API/AudioEncoder).
- `onEncoderConfig`: Called when the internal encoder config, as used by the WebCodecs API, is created. You can use this to introspect the full codec string.
### Subjective qualities