Skip to content

Commit 782647b

Browse files
committed
Correct error messages about bad user media dimensions
1 parent 218512c commit 782647b

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/wrappers/visuals/userMedia.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,10 +443,26 @@ class UserMedia extends Despot {
443443
} else {
444444
rawHeight = this.getVideoHeight();
445445

446-
if (!rawHeight || rawHeight < 1) {
446+
if (rawHeight === undefined) {
447+
throw createError({
448+
message: "Bad dimensions",
449+
explanation: "Raw video height from DOM element cannot be undefined.",
450+
options: this.options,
451+
});
452+
}
453+
454+
if (rawHeight === 0) {
455+
throw createError({
456+
message: "Bad dimensions",
457+
explanation: "Raw video height from DOM element cannot be zero.",
458+
options: this.options,
459+
});
460+
}
461+
462+
if (rawHeight < 1) {
447463
throw createError({
448464
message: "Bad dimensions",
449-
explanation: "Raw video height from DOM element cannot be less than 1!",
465+
explanation: "Raw video height from DOM element cannot be less than 1.",
450466
options: this.options,
451467
});
452468
}

0 commit comments

Comments
 (0)