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

Context action to add video to mpv playlist/queue #132

Open
Kladki opened this issue Feb 14, 2025 · 4 comments
Open

Context action to add video to mpv playlist/queue #132

Kladki opened this issue Feb 14, 2025 · 4 comments

Comments

@Kladki
Copy link

Kladki commented Feb 14, 2025

Is your feature request related to a problem? Please describe.
When I am watching a video, sometimes I see another video that I would like to watch afterwards. I cannot do this easily at the moment, as I would either have to use ff2mpv to open a new mpv instance, then pause the video, and then unpause it once the video i am currently watching is over, or I would have to shift-drag the URL from Firefox to MPV, which is not only unreliable on wayland, but also isn't possible if you're already on the page for the video.

Describe the solution you'd like
Either add a context action to add a video to the mpv queue, or make "play in mpv" context action add the video to the queue if there is already an mpv instance started by the extension running.

Describe alternatives you've considered
See the first section

@woodruffw
Copy link
Owner

Hi @Kladki, thanks for the feature request. I've thought a bit about this, and I think it would be architecturally challenging to do: adding to an MPV playlist requires an active (meaning not stateless) connection with an MPV instance, which would complicate the native client side of this extension significantly.

The good news is that you can probably do this without changing the extension, by patching your own native client to add the received URL to a playlist rather than spawning a new MPV. However the upstream native client will probably never do this, since it'd be a significant behavioral change.

TL;DR: this is possible but requires native client changes that I don't plan on making. A third-party native client or locally patched one could do it.

@pgrosslicht
Copy link

I just set this up for myself, the trick is to use umpv, a script that comes with mpv that emulates this exact behaviour. umpv will either launch a new player if there is none yet, or add it to the queue of the existing player.
I've used ff2mpv-rust and created the config file in ~/.config/ff2mpv-rust.json looking like {"player_command": "umpv"} and it worked. Unfortunately this also adds some hard coded arguments that umpv would try to add to the queue as well, so in command.rs I've also removed those three lines and done, works perfectly 🎉

@woodruffw
Copy link
Owner

Nice! @pgrosslicht would you consider adding a section to the Customization tricks about that? I think this would be great to have some stable docs on for others to follow.

@Kladki
Copy link
Author

Kladki commented Feb 28, 2025

Unfortunately this also adds some hard coded arguments that umpv would try to add to the queue as well, so in command.rs I've also removed those three lines and done, works perfectly

I have made a pull request to fix this.

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

3 participants