Minor fixes

This commit is contained in:
Tamius Han 2019-09-03 23:49:22 +02:00
parent 59df28029f
commit 66bcc40fb4
4 changed files with 89 additions and 85 deletions

View File

@ -62,7 +62,7 @@ class CommsClient {
if (message.cmd === "set-ar") {
this.pageInfo.setAr({type: message.arg, ratio: message.customArg}, message.playing);
} else if (message.cmd === 'set-alignment') {
this.pageInfo.setvideoAlignment(message.arg, message.playing);
this.pageInfo.setVideoAlignment(message.arg, message.playing);
this.pageInfo.restoreAr();
} else if (message.cmd === "set-stretch") {
this.pageInfo.setStretchMode(message.arg, message.playing);

View File

@ -195,9 +195,13 @@ class PageInfo {
} else {
this.logger.log('info', 'videoRescan', "[PageInfo::rescan] found new video candidate:", video, "NOTE:: Video initialization starts here:\n--------------------------------\n")
try {
v = new VideoData(video, this.settings, this);
v.initArDetection();
this.videos.push(v);
} catch (e) {
this.logger.log('error', 'debug', "rescan error: failed to initialize videoData. Skipping this video.",e);
}
this.logger.log('info', 'videoRescan', "END VIDEO INITIALIZATION\n\n\n-------------------------------------\nvideos[] is now this:", this.videos,"\n\n\n\n\n\n\n\n")
}
@ -275,8 +279,8 @@ class PageInfo {
var ths = this;
this.rescanTimer = setTimeout(function(){
ths.rescanTimer = null;
this.urlCheckTimer = setTimeout(function(){
ths.urlCheckTimer = null;
ths.ghettoUrlCheck();
ths = null;
}, this.settings.active.pageInfo.timeouts.urlCheck)
@ -418,16 +422,16 @@ class PageInfo {
}
}
setvideoAlignment(videoAlignment, playingOnly) {
setVideoAlignment(videoAlignment, playingOnly) {
if (playingOnly) {
for(var vd of this.videos) {
if (vd.isPlaying()) {
vd.setvideoAlignment(videoAlignment)
vd.setVideoAlignment(videoAlignment)
}
}
} else {
for(var vd of this.videos) {
vd.setvideoAlignment(videoAlignment)
vd.setVideoAlignment(videoAlignment)
}
}
}

View File

@ -6,6 +6,7 @@ import ArDetector from '../ar-detect/ArDetector';
class VideoData {
constructor(video, settings, pageInfo){
this.vdid = (Math.random()*100).toFixed();
this.logger = pageInfo.logger;
this.arSetupComplete = false;
this.video = video;
@ -14,7 +15,6 @@ class VideoData {
this.pageInfo = pageInfo;
this.extensionMode = pageInfo.extensionMode;
this.vdid = (Math.random()*100).toFixed();
this.userCssClassName = `uw-fuck-you-and-do-what-i-tell-you_${this.vdid}`;
@ -244,8 +244,8 @@ class VideoData {
this.resizer.setPanMode(mode);
}
setvideoAlignment(videoAlignment) {
this.resizer.setvideoAlignment(videoAlignment);
setVideoAlignment(videoAlignment) {
this.resizer.setVideoAlignment(videoAlignment);
}
restoreAr(){

View File

@ -15,6 +15,7 @@ if(Debug.debug) {
class Resizer {
constructor(videoData) {
this.resizerId = (Math.random(99)*100).toFixed(0);
this.conf = videoData;
this.logger = videoData.logger;
this.video = videoData.video;
@ -37,7 +38,6 @@ class Resizer {
this.videoAlignment = this.settings.getDefaultVideoAlignment(window.location.hostname); // this is initial video alignment
this.destroyed = false;
this.resizerId = (Math.random(99)*100).toFixed(0);
if (this.settings.active.pan) {
this.canPan = this.settings.active.miscSettings.mousePan.enabled;
@ -194,8 +194,8 @@ class Resizer {
this.conf.destroy();
}
// // pause AR on basic stretch, unpause when using other mdoes
// fir sine reason unpause doesn't unpause. investigate that later
// pause AR on basic stretch, unpause when using other modes
// for sine reason unpause doesn't unpause. investigate that later
try {
if (this.stretcher.mode === Stretch.Basic) {
this.conf.arDetector.pause();
@ -218,7 +218,7 @@ class Resizer {
this.conf.destroy();
}
if (stretchFactors.error === 'illegal_video_dimensions') {
this.loggger.log('error', 'debug', `[Resizer::setAr] <rid:${this.resizerId}> Illegal video dimensions found. We will pause everything.`)
this.logger.log('error', 'debug', `[Resizer::setAr] <rid:${this.resizerId}> Illegal video dimensions found. We will pause everything.`)
}
return;
}
@ -300,7 +300,7 @@ class Resizer {
this.restore();
}
setvideoAlignment(videoAlignment) {
setVideoAlignment(videoAlignment) {
this.videoAlignment = videoAlignment;
this.restore();
}