Closed Bodertz closed 1 day ago
Thanks for filing the feature request!
Will need some investigation. Can you share what player you're using and on which OS?
By default, ready-player-mode uses either mpv, vlc, ffplay, or mplayer (in that order). Customisable on ready-player-open-playback-commands.
It's using mpv on Linux. I have not tried with vlc, ffplay, mplayer, or any other options if those are supported. The feature I'm requesting here is to be able to go M-x ready-player-pause RET
to pause playback in the supported players.
Thank you. By chance, does your keyboard have a play/pause key and does it work on linux? This isn't a proper solution to this feature request, but at least on macOS if I press the play/pause key on keyboard, mpv pauses playback.
I have a Pause/Break button, but not the media keys, or whatever they're called. Looking in KDE's settings, the "Media Play" key is bound to the action "Play/Pause media playback". I tested with a new shortcut for that action just now (Ctrl-Alt-Shift-D), and pressing that while ready-player was playing an audio file resulted in a YouTube video I had paused in the background starting while ready-player continued to play the file.
Ready-player (or mpv) does not show up in KDE's media player widget. I found this [1] which mentions this [2], which is apparently a way to get it to show up there, but I have not tried installing mpv-mpris yet. Using VLC as the backend, Ctrl-Alt-Shift-D pauses, but doesn't unpause. But that's a bug for VLC or KDE.
[1] https://github.com/mpv-player/mpv/issues/7968 [2] https://github.com/hoyon/mpv-mpris
Just to add, playerctl
might be useful for generic controlling.
https://github.com/altdesktop/playerctl
But mpv might require that plugin to be installed, dont know if other players support it ootb.
mpv needs mpv-mpris mpv-mpris https://github.com/hoyon/mpv-mpris varios distros ship it including alpine linux, nixos etc... https://repology.org/project/mpv-mpris/packages ready-player with mpv mpv-mpris and playertcl would give you a very nice comprehensive and flexible solution with cli for scripting and window manager keybindings and a nice emacs gui for a gui:)
mpv
can be controlled with a built-in (JSON) IPC: https://mpv.io/manual/master/#json-ipc
It is started like:
mpv file.mkv --input-ipc-server=/tmp/mpvsocket
and we can send commands and receive results with socat
:
> echo '{ "command": ["get_property", "playback-time"] }' | socat - /tmp/mpvsocket
{"data":190.482000,"error":"success"}
toggle play/pause:
echo '{ "command": ["cycle", "pause"] }' | socat - /tmp/mpvsocket
=> {"data":null,"request_id":0,"error":"success"}
We can send non-JSON commands:
echo "cycle pause" | socat - /tmp/mpvsocket
but in that case we don't have return values.
A note on Windows:
Unfortunately, it's not as easy to test the IPC protocol on Windows, since Windows ports of socat (in Cygwin and MSYS2) don't understand named pipes. In the absence of a simple tool to send and receive from bidirectional pipes, the echo command can be used to send commands, but not receive replies from the command prompt.
Hi folks. https://github.com/xenodium/ready-player/commit/77d2ce4eec17fda16b7701b8304b1713d340c09a adds a basic mpv implementation for pause/resume. If you have v0.7.1, it should just work if you aren't explicitly setting ready-player-open-playback-commands
. Give it a try.
ready-player-toggle-play-stop
now toggles pauses if supported.
edit: Mentioning ready-player-toggle-play-stop
.
@zauster @Bodertz @vindarel @PlasmaShift @idlip either of you played with the mpv play/pause? If you haven't modified ready-player-open-playback-commands
, it should just do its thing. Does it work for ya?
Hey @xenodium, I can report that it works for me.
Hi @zauster thanks for confirming! Great to hear. Curious, what OS?
Hi @xenodium. Thank you for implementing this!
I also confirm that it works as expected.
I use nixos distro.
I was wondering if there would be a way to suspend and get back the session, just like popup.
Also another feature can be to set ready-music-directory, and be able to search (via find
) all media files.
Edit:
My bad, This can already be used via, pause -> delete-window.
Then second one: ready-player-search-dired-buffer-index
Hi @xenodium. Thank you for implementing this! I also confirm that it works as expected. I use nixos distro.
I'm on macOS and hadn't tested on anything else. Great to hear.
I was wondering if there would be a way to suspend and get back the session, just like popup.
C-c m m
or M-x ready-player-view-player
(toggles in both directions).
Also another feature can be to set ready-music-directory, and be able to search (via find) all media files.
M-x ready-player-load-directory
should just open the directory and start playing. M-x ready-player-search-dired-buffer-index
as you found, gives ya search. This directory is remembered across emacs sessions. M-x ready-player-view-player
will pop you back to it. Same for M-x ready-player-toggle-play-stop
.
Tangentially related, https://github.com/xenodium/ready-player/issues/11 adds seek (mpv only).
@xenodium I use Arch Linux
Thanks all. Looks like the feature's been verified. Gonna go ahead and close this feature request.
Please consider supporting the project to make it sustainable.
Currently, ready-player can play and stop playback, but it cannot pause and resume playback. I think pausing is a useful feature for reasons that can go unstated, but if required, I could provide a use case or user story.