fadblock icon indicating copy to clipboard operation
fadblock copied to clipboard

Feature Request: Skip Current Video Segment in Video Player (Ad or Video) via Hotkeys

Open eliezercazares opened this issue 1 year ago • 1 comments

Hello Piraj,

I hope you're doing super good.

I was looking at the repo, and I was wondering if we could call the next block of code via hot keys (i.e. "A" + "S")..

function skipCurrentVideoSegment() {
        videoPlayer.muted = true; // videoPlayer.volume = 0;
        videoPlayer.currentTime = videoPlayer.duration - 0.1;
        videoPlayer.paused && videoPlayer.play()

        // CLICK ON THE SKIP AD BTN
        document.querySelector(".ytp-ad-skip-button")?.click();
        document.querySelector(".ytp-ad-skip-button-modern")?.click();
}

addEventListener("keydown", (event) => {
  if (event.key === "a") {
    keys.a = true;
  }
  if (event.key === "s") {
    keys.s = true;
  }

if(keys.a && keys.s){
  skipCurrentVideoSegment();
}
});

I think doing it this way would at least suppress the current video ad regardless of finding the cssAttributes for an ad or not.

Once the user presses the hotkeys we do this:

    videoPlayer.muted = true; // videoPlayer.volume = 0;
    videoPlayer.currentTime = videoPlayer.duration - 0.1;
    videoPlayer.paused && videoPlayer.play()
    

It can leverage the pain while the extension catches up with new youtube's countermeasures.

Let me know if I can be a help.

eliezercazares avatar Nov 15 '23 17:11 eliezercazares

Update: New version fixes the issues :P

eliezercazares avatar Nov 15 '23 21:11 eliezercazares