From 2461bdc781344e1c2a4c297ca928ae60325de645 Mon Sep 17 00:00:00 2001 From: Kristjan SCHMIDT <35647502+KristjanESPERANTO@users.noreply.github.com> Date: Wed, 29 Dec 2021 12:12:50 +0100 Subject: [PATCH] Check if frameDuration is a number --- src/WebMWriter.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/WebMWriter.js b/src/WebMWriter.js index e2fc1c8..16010d6 100644 --- a/src/WebMWriter.js +++ b/src/WebMWriter.js @@ -775,7 +775,12 @@ throw new Error("Missing required frameDuration or frameRate setting"); } } - + + // frameDuration value has to be a number, otherwise there is unusual behavior without an error message + if (options.frameDuration && typeof options.frameDuration !== "number") { + throw new Error("frameDuration value has to be a number. But it's a " + typeof options.frameDuration); + } + // Avoid 1.0 (lossless) because it creates VP8L lossless frames that WebM doesn't support options.quality = Math.max(Math.min(options.quality, 0.99999), 0);