Skip to content

Commit

Permalink
Temporary fix to disable MSE audio. (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
kixelated authored Oct 25, 2023
1 parent e89f292 commit 899f489
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/playback/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
4 changes: 4 additions & 0 deletions lib/playback/mse/segment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 4 additions & 0 deletions lib/playback/mse/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 899f489

Please sign in to comment.