Un-initalize videoData on illegal video dimensions ($

When youtube changes between two videos, video dimensions briefly become 0x0. This is super duper illegal and sometimes causes the behaviour described in issue #125. Setting VideoData.videoLoaded to false fixes this.
This commit is contained in:
Tamius Han 2021-01-12 23:28:17 +01:00
parent 884db1c5e3
commit 2025547d33
2 changed files with 9 additions and 1 deletions

View File

@ -33,6 +33,9 @@ class VideoData {
async onVideoLoaded() {
if (!this.videoLoaded) {
if (this.video.videoWidth && this.video.videoHeight) {
return; // onVideoLoaded is a lie in this case
}
this.logger.log('info', 'init', '%c[VideoData::onVideoLoaded] ——————————— Initiating phase two of videoData setup ———————————', 'color: #0f9');
this.videoLoaded = true;
@ -52,6 +55,10 @@ class VideoData {
}
}
videoUnloaded() {
this.videoLoaded = false;
}
async injectBaseCss() {
try {
await this.pageInfo.injectCss(`

View File

@ -146,7 +146,8 @@ class Resizer {
}
if (!this.video.videoWidth || !this.video.videoHeight) {
this.logger.log('warning', 'debug', '[Resizer::setAr] <rid:'+this.resizerId+'> Video has no width or no height. This is not allowed. Aspect ratio will not be set.');
this.logger.log('warning', 'debug', '[Resizer::setAr] <rid:'+this.resizerId+'> Video has no width or no height. This is not allowed. Aspect ratio will not be set, and videoData will be uninitialized.');
this.conf.videoUnloaded();
}
this.logger.log('info', 'debug', '[Resizer::setAr] <rid:'+this.resizerId+'> trying to set ar. New ar:', ar)