Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query (no problem) #574

Open
PepeParada opened this issue Sep 12, 2024 · 1 comment
Open

Query (no problem) #574

PepeParada opened this issue Sep 12, 2024 · 1 comment

Comments

@PepeParada
Copy link

Hi. I have a specific question. First, the extension is great and works great for me. It makes my life easier.

That said, my question: will it be possible to use URL Rules for Youtube, and differentiate a regular video from a live? I don't know if there is a way to identify a live and a video from the url.

I was thinking about it because in my youtube vanced app (on android), it allows you to set a speed of 1.50x (example) for videos, and another speed (normal) for lives. Which is good because if you enter a live, it will not be set to a fast speed by default.
It occurred to me that maybe something like this can be done on PC with Global Speed.
``
thanks!

p.s.: ah, i usually use yt dlp and i know there is a way to differentiate lives from videos on youtube. but maybe it's just for that function.

@polywock
Copy link
Owner

polywock commented Sep 13, 2024

Hello. Not possible to determine if it's live from the URL, but you can determine it from the page structure.

You can create a javascript URL rule that changes speed to 1x if a video is live, or 2x speed if not.

video = null 
setInterval(() => {
    video = document.querySelector("video.html5-main-video")
}, 5000)

setInterval(() => {
     video = video ?? document.querySelector("video.html5-main-video")
     if (!video) return 
     const isLive = document.querySelector(".ytp-live .ytp-live-badge.ytp-button[disabled]")
     video.playbackRate = isLive ? 1 : 2
}, 500)

However this won't work because Global Speed is aggressive. You also need to create another URL rule that turns off Global Speed if the URL contains "youtube.com".

example.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants