diff --git a/lib/playback/index.ts b/lib/playback/index.ts index 036d57b..842e998 100644 --- a/lib/playback/index.ts +++ b/lib/playback/index.ts @@ -75,6 +75,11 @@ export class Player { throw new Error(`expected CMAF track`) } + if (isAudioTrack(track) && this.#backend instanceof MSE) { + // TODO temporary hack to disable audio in MSE + continue + } + inits.add(track.init_track) tracks.push(track) } diff --git a/lib/playback/mse/segment.ts b/lib/playback/mse/segment.ts index 0cfb767..699cc9f 100644 --- a/lib/playback/mse/segment.ts +++ b/lib/playback/mse/segment.ts @@ -73,6 +73,10 @@ export class Segment { mdat.write(stream) } + if (stream.buffer.byteLength == 0) { + return this.done + } + this.source.initialize(this.init) this.source.append(stream.buffer) diff --git a/lib/playback/mse/source.ts b/lib/playback/mse/source.ts index 22b95ba..e99273b 100644 --- a/lib/playback/mse/source.ts +++ b/lib/playback/mse/source.ts @@ -45,6 +45,10 @@ export class Source { // Append the segment data to the buffer. append(data: Uint8Array | ArrayBuffer) { + if (data.byteLength == 0) { + throw new Error("empty append") + } + this.queue.push({ kind: "data", data: data,