diff --git a/src/ext/lib/video-data/PlayerData.ts b/src/ext/lib/video-data/PlayerData.ts index 4c63d8a..bd34ae1 100644 --- a/src/ext/lib/video-data/PlayerData.ts +++ b/src/ext/lib/video-data/PlayerData.ts @@ -65,7 +65,7 @@ class PlayerData { extensionMode: any; dimensions: any; private playerIdElement: any; - private observer: MutationObserver; + private observer: ResizeObserver; //#endregion constructor(videoData) { @@ -141,7 +141,7 @@ class PlayerData { try { if (BrowserDetect.firefox) { - this.observer = new MutationObserver( + this.observer = new ResizeObserver( _.debounce( // don't do this too much: this.onPlayerDimensionsChanged, 250, // do it once per this many ms @@ -154,7 +154,7 @@ class PlayerData { } else { // Chrome for some reason insists that this.onPlayerDimensionsChanged is not a function // when it's not wrapped into an anonymous function - this.observer = new MutationObserver( + this.observer = new ResizeObserver( _.debounce( // don't do this too much: (m,o) => this.onPlayerDimensionsChanged(m,o), 250, // do it once per this many ms @@ -172,7 +172,7 @@ class PlayerData { attributeOldValue: true, }; - this.observer.observe(this.element, observerConf); + this.observer.observe(this.element); } catch (e) { console.error("failed to set observer",e ) } diff --git a/src/ext/lib/video-data/VideoData.ts b/src/ext/lib/video-data/VideoData.ts index 4de39ca..6086930 100644 --- a/src/ext/lib/video-data/VideoData.ts +++ b/src/ext/lib/video-data/VideoData.ts @@ -25,7 +25,7 @@ class VideoData { //#region misc stuff vdid: string; video: any; - observer: MutationObserver; + observer: ResizeObserver; extensionMode: any; userCssClassName: string; validationId: number; @@ -182,7 +182,7 @@ class VideoData { // INIT OBSERVERS try { if (BrowserDetect.firefox) { - this.observer = new MutationObserver( + this.observer = new ResizeObserver( _.debounce( this.onVideoDimensionsChanged, 250, @@ -195,7 +195,7 @@ class VideoData { } else { // Chrome for some reason insists that this.onPlayerDimensionsChanged is not a function // when it's not wrapped into an anonymous function - this.observer = new MutationObserver( + this.observer = new ResizeObserver( _.debounce( (m, o) => { this.onVideoDimensionsChanged(m, o) @@ -211,7 +211,7 @@ class VideoData { } catch (e) { console.error('[VideoData] Observer setup failed:', e); } - this.observer.observe(this.video, observerConf); + this.observer.observe(this.video); // INIT AARD this.arDetector = new ArDetector(this); // this starts Ar detection. needs optional parameter that prevets ardetdctor from starting