Merge pull request #666 from ljoonal/invidious-embed-fix

Fix the videoRoot to also work on invidious embeds
This commit is contained in:
Ajay Ramachandran 2021-03-04 23:44:10 -05:00 committed by GitHub
commit 26197d4ff9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1529,7 +1529,7 @@ function getSegmentsMessage(sponsorTimes: SponsorTime[]): string {
function addHotkeyListener(): boolean {
let videoRoot = document.getElementById("movie_player") as HTMLDivElement;
if (onInvidious) videoRoot = document.getElementById("player-container") as HTMLDivElement;
if (onInvidious) videoRoot = (document.getElementById("player-container") ?? document.getElementById("player")) as HTMLDivElement;
if (!videoRootsWithEventListeners.includes(videoRoot)) {
videoRoot.addEventListener("keydown", hotkeyListener);