Add onread callback

This commit is contained in:
Vanilagy
2025-01-04 14:46:53 +01:00
parent 3487bae4fe
commit 316e16211b
3 changed files with 3 additions and 1 deletions
+1
View File
@@ -54,6 +54,7 @@ export class Reader {
} }
} }
this.source.onread?.({ start, end });
const bytesPromise = this.source._read(start, end); const bytesPromise = this.source._read(start, end);
const loadingSegment: LoadingSegment = { start, end, promise: bytesPromise }; const loadingSegment: LoadingSegment = { start, end, promise: bytesPromise };
this.loadingSegments.push(loadingSegment); this.loadingSegments.push(loadingSegment);
+2
View File
@@ -12,6 +12,8 @@ export abstract class Source {
_getSize() { _getSize() {
return this._sizePromise ??= this._retrieveSize(); return this._sizePromise ??= this._retrieveSize();
} }
onread: ((range: { start: number; end: number }) => unknown) | null = null;
} }
/** @public */ /** @public */
-1
View File
@@ -3,6 +3,5 @@
- Add the new audio codecs to muxers - Add the new audio codecs to muxers
- Mov muxer!!! Only mov can hold PCM audio, MP4 cannot - Mov muxer!!! Only mov can hold PCM audio, MP4 cannot
- A stream source?? Or like a callback-driven source - A stream source?? Or like a callback-driven source
- onRead callback for Source
- onHeader, etc callbacks for Matroska - onHeader, etc callbacks for Matroska
- https://github.com/Vanilagy/mp4-muxer/issues/83 tell him it's possible now - https://github.com/Vanilagy/mp4-muxer/issues/83 tell him it's possible now