Skip to content

Commit

Permalink
Throw if WebCodecs are not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
MattiasBuelens committed Sep 16, 2023
1 parent 433b974 commit 3eb7fa7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/video-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ export class BabyVideoElement extends HTMLElement {
this.#canvasContext.fillStyle = "black";
this.#canvasContext.fillRect(0, 0, this.#canvas.width, this.#canvas.height);

if (typeof VideoDecoder !== "function") {
throw new Error(`<baby-video>: This browser does not support WebCodecs.`);
}
this.#videoDecoder = new VideoDecoder({
output: (frame) => this.#onVideoFrame(frame),
error: (error) => console.error("WTF", error)
Expand Down

0 comments on commit 3eb7fa7

Please sign in to comment.