akiirui / mpv-handler

A protocol handler for mpv. Use mpv and yt-dlp to play video and music from the websites.
MIT License
262 stars 22 forks source link

x-scheme-handler to open mpv-handler doesn't work in plasma-6 #59

Closed abishekmuthian closed 1 month ago

abishekmuthian commented 2 months ago

Thank you for your hard work in creating mpv-handler.

x-scheme-handler to open mpv-handler doesn't work in plasma-6 (due to possible upstream issue) and so it requires adding the scheme directly to the handlers.json in Firefox profiles folder.

"mpv": {
    "action": 2,
    "handlers": [
        { "name": "mpv", "path": "/home/abishek/.local/bin/mpv-handler" }
    ]
    }
akiirui commented 2 months ago

Firefox? Maybe this issue isn't plasma related.

Try searching network.protocol-handler.expose.mpv and network.protocol-handler.expose.mpv-debug in about:config. Click "add mark" of the results, select type to Boolean, and set these to false.

See #55

abishekmuthian commented 2 months ago

Thank you, I did try the flags you mentioned in #55 earlier but not sure whether it was in the same combinations. Anyways the current config in the handlers.json works and I will continue to use.

I will close this issue for now.

akiirui commented 2 months ago

You can try it in other browser, if they have same issue on Plasma, reopen this issue. Thanks.

abishekmuthian commented 2 months ago

Sorry I forgot to mention that I already tried in Chromium and it didn't open mpv just becomes a query for google search.

Screenshot_20240913_211355

I guess this indeed is a plasma error and so I'll keep it open to see if anyone else face this issue.

akiirui commented 2 months ago

Try xdg-open <URL> in the console?

DeltaCopy commented 2 months ago

When I tested on Arch with Plasma 6.1.5 I had to copy the binary mpv-handler over to /usr/bin

Inside Firefox it kept redirecting me to a search query.

I had to append the URL with an extra "/" Example: mpv://play/aHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g_dj1HZ2tuMmY1ZS1JVQ/

akiirui commented 2 months ago

@DeltaCopy Try xdg-open mpv://play/aHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g_dj1HZ2tuMmY1ZS1JVQ

DeltaCopy commented 2 months ago

@DeltaCopy Try xdg-open mpv://play/aHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g_dj1HZ2tuMmY1ZS1JVQ

Yes that works, mpv launches and the video plays.

After clearing out the Firefox cache it started working, and no longer need to append the extra "/"

akiirui commented 2 months ago

Yes that works, mpv launches and the video plays.

After clearing out the Firefox cache it started working, and no longer need to append the extra "/"

Hmm, I don't know what caused this, will it work properly in chromium now?

If it works with xdg-open (it uses kde-open in Plasma, in extra/kde-cli-tools) then it's not a Plasma issue.

DeltaCopy commented 2 months ago

I agree that this isn't a Plasma issue. Chromium works as well after clearing the cache.

image

I think @abishekmuthian needs to clear the cache out of both browsers and retry.

akiirui commented 2 months ago

Please try userscript v2024.09.27. Some users reported that "target = _blank" causes the issue.

abishekmuthian commented 1 month ago

Apologies for the delayed reply, xdg-open on terminal worked from the start, chromium doesn't work after clearing cache. Firefox continues to work as intended (with manually added scheme as mentioned in OP).

akiirui commented 1 month ago

Apologies for the delayed reply, xdg-open on terminal worked from the start, chromium doesn't work after clearing cache. Firefox continues to work as intended (with manually added scheme as mentioned in OP).

Ok, I'll test this in a VM sometime.

akiirui commented 1 month ago

Sorry, I can't reproduce this issue on my plasma installation.

All are works fine. And firefox doesn't require any configuration. Please check your configs or update your applications. Or create a new system user to test these (To avoid problems caused by old configuration) Done.

akiirui commented 1 month ago

I don't know how you installed mpv-handler. If you installed it manually, did you add $HOME/.local/bin to the environment variable PATH (https://wiki.archlinux.org/title/Environment_variables#Per_user)? If you configure it only in per session or shell, plasma will not be able to read the relevant values. (such as set PATH in ~/.bashrc or ~/.zshrc)

If you can't add it, you can also try to modify mpv-handler.desktop and mpv-handler-debug.desktop. Change Exec=mpv-handler %u to Exec=/home/abishek/.local/bin/mpv-handler %u%

abishekmuthian commented 1 month ago

I had added it manually and the mpv-handler path is correctly set. Thank you for your time in testing the plasma integration, Issue might be at my end. Since it works flawlessly in FF with my custom scheme I haven't explored further on why it doesn't work with Chromium. I will come back if there's more concrete data to share.

Thank you all for your great work.