diff --git a/src/ext/lib/video-data/PlayerData.ts b/src/ext/lib/video-data/PlayerData.ts index fabb10f..aa95c32 100644 --- a/src/ext/lib/video-data/PlayerData.ts +++ b/src/ext/lib/video-data/PlayerData.ts @@ -65,6 +65,8 @@ class PlayerData { private observer: ResizeObserver; private ui: any; + + elementStack: any[] = []; //#endregion /** @@ -140,7 +142,6 @@ class PlayerData { return ( ihdiff < 5 && iwdiff < 5 ); } - /** * */ @@ -414,162 +415,188 @@ class PlayerData { } //#endregion - getPlayer() { + /** + * Finds and returns HTML element of the player + */ + getPlayer(options?: {verbose?: boolean}) { const host = window.location.hostname; let element = this.video.parentNode; const videoWidth = this.video.offsetWidth; const videoHeight = this.video.offsetHeight; - const elementQ = []; - const scorePenalty = 10; - const sizePenaltyMultiplier = 0.1; - let penaltyMultiplier = 0; - let score; + let playerCandidate; - try { - if(! element ){ - this.logger.log('info', 'debug', "[PlayerDetect::_pd_getPlayer] element is not valid, doing nothing.", element) - if(this.element) { - const ths = this; - } - this.element = undefined; - this.dimensions = undefined; - return; - } + const elementStack: any[] = [{ + element: this.video, + type: 'video' + }]; - // log the entire hierarchy from