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:
parent
884db1c5e3
commit
2025547d33
@ -33,6 +33,9 @@ class VideoData {
|
|||||||
|
|
||||||
async onVideoLoaded() {
|
async onVideoLoaded() {
|
||||||
if (!this.videoLoaded) {
|
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.logger.log('info', 'init', '%c[VideoData::onVideoLoaded] ——————————— Initiating phase two of videoData setup ———————————', 'color: #0f9');
|
||||||
|
|
||||||
this.videoLoaded = true;
|
this.videoLoaded = true;
|
||||||
@ -52,6 +55,10 @@ class VideoData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
videoUnloaded() {
|
||||||
|
this.videoLoaded = false;
|
||||||
|
}
|
||||||
|
|
||||||
async injectBaseCss() {
|
async injectBaseCss() {
|
||||||
try {
|
try {
|
||||||
await this.pageInfo.injectCss(`
|
await this.pageInfo.injectCss(`
|
||||||
|
@ -146,7 +146,8 @@ class Resizer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this.video.videoWidth || !this.video.videoHeight) {
|
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)
|
this.logger.log('info', 'debug', '[Resizer::setAr] <rid:'+this.resizerId+'> trying to set ar. New ar:', ar)
|
||||||
|
Loading…
Reference in New Issue
Block a user