diff --git a/.vscode/settings.json b/.vscode/settings.json index 2775218..2092956 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,5 @@ { "cSpell.words": [ - "PILLARBOX", - "PILLARBOXED", "aard", "ardetector", "autodetect", @@ -16,6 +14,7 @@ "csui", "decycle", "disneyplus", + "endregion", "equalish", "fith", "fitw", @@ -24,6 +23,7 @@ "gmail", "guardline", "han", + "haram", "iframe", "imgur", "insta", @@ -34,6 +34,8 @@ "nogrow", "noshrink", "outro", + "PILLARBOX", + "PILLARBOXED", "polyfill", "recursing", "reddit", diff --git a/src/ext/lib/ar-detect/ArDetector.ts b/src/ext/lib/ar-detect/ArDetector.ts index a6282c8..ecc3187 100644 --- a/src/ext/lib/ar-detect/ArDetector.ts +++ b/src/ext/lib/ar-detect/ArDetector.ts @@ -833,8 +833,6 @@ class ArDetector { try{ if(guardLineOut.blackbarFail || guardLineOut.imageFail){ if(this.edgeDetector.findBars(imageData, null, EdgeDetectPrimaryDirection.Horizontal).status === 'ar_known'){ - - if(guardLineOut.blackbarFail){ this.logger.log('info', 'arDetect', `[ArDetect::frameCheck] Detected blackbar violation and pillarbox. Resetting to default aspect ratio.`); this.conf.resizer.setAr({type: AspectRatioType.Automatic, ratio: this.defaultAr}); diff --git a/src/ext/lib/video-data/PageInfo.ts b/src/ext/lib/video-data/PageInfo.ts index 76bd02a..52017cc 100644 --- a/src/ext/lib/video-data/PageInfo.ts +++ b/src/ext/lib/video-data/PageInfo.ts @@ -29,7 +29,7 @@ class PageInfo { logger: Logger; settings: Settings; comms: CommsClient; - videos: VideoData[] = []; + videos: {videoData: VideoData, element: HTMLVideoElement}[] = []; //#endregion //#region misc stuff @@ -113,8 +113,8 @@ class PageInfo { } for (let video of this.videos) { try { - (this.comms.unregisterVideo as any)(video.vdid) - video.destroy(); + (this.comms.unregisterVideo as any)(video.videoData.vdid) + video.videoData.destroy(); } catch (e) { this.logger.log('error', ['debug', 'init'], '[PageInfo::destroy] unable to destroy video! Error:', e); } @@ -135,8 +135,10 @@ class PageInfo { reset() { for(let video of this.videos) { - video.destroy(); + video.videoData.destroy(); + video.videoData = null; } + this.videos = []; this.rescan(RescanReason.MANUAL); } @@ -159,7 +161,7 @@ class PageInfo { getVideos(host) { if (this.settings.active.sites[host]?.DOM?.video?.manual && this.settings.active.sites[host]?.DOM?.video?.querySelectors){ - const videos = document.querySelectorAll(this.settings.active.sites[host].DOM.video.querySelectors); + const videos = document.querySelectorAll(this.settings.active.sites[host].DOM.video.querySelectors) as NodeListOf; if (videos.length) { return videos; @@ -172,9 +174,25 @@ class PageInfo { return this.readOnly ? this.hasVideos : this.videos.length; } - rescan(rescanReason){ - const oldVideoCount = this.videos.length; + /** + * Re-scans the page for videos. Removes any videos that no longer exist from our list + * of videos. Destroys all videoData objects for all the videos that don't have their + * own