Add support for live HLS streams, add playlist refresh logic, add live input tracks

This commit is contained in:
Vanilagy
2026-03-12 15:54:19 +01:00
parent ff523c01c8
commit e8df451bf5
23 changed files with 22399 additions and 417 deletions
+16
View File
@@ -65,6 +65,19 @@ export type PacketRetrievalOptions = {
* its data, this option cannot be enabled together with `metadataOnly`.
*/
verifyKeyPackets?: boolean;
/**
* When querying packets in live media that are in the future relative to the current live edge, Mediabunny will,
* by default, wait for the stream to advance until the query can be satisfied. In a sense, Mediabunny simply treats
* live streams as media files that are still being written, and any read that depends on future information will
* wait until it can be fulfilled.
*
* If you want to query packets based only on the currently known information, set this field to `true` - this way,
* Mediabunny will never wait for the live stream to catch up.
*
* For non-live media, this field has no effect.
*/
skipLiveWait?: boolean;
};
const validatePacketRetrievalOptions = (options: PacketRetrievalOptions) => {
@@ -80,6 +93,9 @@ const validatePacketRetrievalOptions = (options: PacketRetrievalOptions) => {
if (options.verifyKeyPackets && options.metadataOnly) {
throw new TypeError('options.verifyKeyPackets and options.metadataOnly cannot be enabled together.');
}
if (options.skipLiveWait !== undefined && typeof options.skipLiveWait !== 'boolean') {
throw new TypeError('options.skipLiveWait, when defined, must be a boolean.');
}
};
const validateTimestamp = (timestamp: number) => {