* Add BufferTarget.onFinalize option for awaitable async action on finalize
The `finalized` event fires synchronously and its return value is ignored,
making it unsuitable for use cases where the muxer should wait (e.g.
uploading the buffer to S3, R2, or other object stores that require a
known Content-Length and therefore can't stream via StreamTarget).
Adds a new `BufferTargetOptions` type with an `onFinalize` callback that
the muxer awaits before resolving. Matches the existing callback pattern
used by `HlsOutputFormatOptions.onSegment`, `onMaster`, etc.
When used with PathedTarget, this provides proper backpressure: the next
segment won't start being produced until the previous one has finished
uploading, keeping memory bounded regardless of video length.
- Adds `BufferTargetOptions` type, exported from the package root
- `BufferTarget` constructor now accepts optional options (backward compatible)
- `_finalize()` awaits `onFinalize` before emitting the `finalized` event
- Adds runtime validation for non-function callbacks
- Updates "Upload to a server" docs in writing-hls.md with S3 pattern
- Documents `onFinalize` in writing-media-files.md BufferTarget section
- Adds tests for callback invocation, async awaiting, backward compat, and validation
* Add ConcurrentRunner, add OutputOptions.onFinalize, adjust docs accordingly, clean up tests
* give me more control baby
* forgot to tell about it
* polish guide and js docs
* vanilagy says remove this, docs will reveal it
---------
Co-authored-by: Vanilagy <[email protected]>
* implement in FlacOutputFormatOptions
* implement in flac-muxer.ts
* Fix demuxer: Handle minimumFrameSize = 0, maxiumFrameSize = 0
* add a test
* Update flac-demuxer.ts
* Update flac.test.ts
* clean up comments for minima and maxima
* Add FlacOutputFormatOptions.appendOnly to docs
---------
Co-authored-by: Vanilagy <[email protected]>
* ac3/eac3 detection
* fix tests
* review pass + follow codebase comments style
* Add ac3/eac3 to docs
* WIP mpeg-2
* Set registration_descriptor
* add support for ac3 system b in mpeg-ts
* Update docs with ac3 in .ts support
* fix formatting
* Remove default to fix linter
* Add eac3 to mpeg-ts
* fix formatting
* Fix failing test
* Refactor AC3/EAC3 code a little
---------
Co-authored-by: Vanilagy <[email protected]>