diff --git a/src/ext/conf/ExtConfPatches.js b/src/ext/conf/ExtConfPatches.js index 4c2ff52..b14c719 100644 --- a/src/ext/conf/ExtConfPatches.js +++ b/src/ext/conf/ExtConfPatches.js @@ -241,6 +241,17 @@ const ExtensionConfPatch = [ } } } + }, { + forVersion: '4.4.1.1', + sites: { + "www.disneyplus.com": { + DOM: { + player: { + periodicallyRefreshPlayerElement: true, + } + } + }, + } } ]; diff --git a/src/ext/conf/ExtensionConf.js b/src/ext/conf/ExtensionConf.js index f014e23..e9f99c0 100644 --- a/src/ext/conf/ExtensionConf.js +++ b/src/ext/conf/ExtensionConf.js @@ -1083,6 +1083,13 @@ whatsNewChecked: true, }, css: 'video {\n width: 100% !important;\n height: 100% !important;\n}', }, + "www.disneyplus.com": { + DOM: { + player: { + periodicallyRefreshPlayerElement: true, + } + } + }, "imgur.com": { mode: -1, autoar: -1, diff --git a/src/ext/lib/video-data/PlayerData.js b/src/ext/lib/video-data/PlayerData.js index 950466d..168ce55 100644 --- a/src/ext/lib/video-data/PlayerData.js +++ b/src/ext/lib/video-data/PlayerData.js @@ -45,6 +45,13 @@ class PlayerData { this.dimensions = undefined; this.overlayNode = undefined; + this.periodicallyRefreshPlayerElement = false; + try { + this.periodicallyRefreshPlayerElement = this.settings.active.sites[window.location.host].DOM.player.periodicallyRefreshPlayerElement; + } catch (e) { + // no biggie — that means we don't have any special settings for this site. + } + // this happens when we don't find a matching player element if (!this.element) { this.invalid = true; @@ -98,19 +105,19 @@ class PlayerData { } try { - const ths = this; - this.observer = new MutationObserver((m,o) => this.onPlayerDimensionsChanged(m,o,ths)); + const ths = this; + this.observer = new MutationObserver((m,o) => this.onPlayerDimensionsChanged(m,o,ths)); - const observerConf = { - attributes: true, - // attributeFilter: ['style', 'class'], - attributeOldValue: true, - }; - - this.observer.observe(this.element, observerConf); - } catch (e) { - console.error("failed to set observer",e ) - } + const observerConf = { + attributes: true, + // attributeFilter: ['style', 'class'], + attributeOldValue: true, + }; + + this.observer.observe(this.element, observerConf); + } catch (e) { + console.error("failed to set observer",e ) + } // legacy mode still exists, but acts as a fallback for observers and is triggered less // frequently in order to avoid too many pointless checks this.legacyChangeDetection(); @@ -120,6 +127,9 @@ class PlayerData { while (!this.halted) { await this.sleep(1000); try { + if (this.periodicallyRefreshPlayerElement) { + this.forceRefreshPlayerElement(); + } if (this.checkPlayerSizeChange()) { this.videoData.resizer.restore(); } diff --git a/src/ext/lib/video-data/VideoData.js b/src/ext/lib/video-data/VideoData.js index d343f6d..beccc6f 100644 --- a/src/ext/lib/video-data/VideoData.js +++ b/src/ext/lib/video-data/VideoData.js @@ -2,6 +2,7 @@ import Debug from '../../conf/Debug'; import PlayerData from './PlayerData'; import Resizer from '../video-transform/Resizer'; import ArDetector from '../ar-detect/ArDetector'; +import AspectRatio from '../../../common/enums/aspect-ratio.enum'; class VideoData { @@ -300,6 +301,11 @@ class VideoData { if (this.invalid) { return; } + + if (ar.type === AspectRatio.Fixed || ar.type === AspectRatio.FitHeight || ar.type === AspectRatio.FitHeight) { + this.player.forceRefreshPlayerElement(); + } + this.resizer.setAr(ar, lastAr); }