Maintaining keyboard control when calling external command in elinks

232 views Asked by At

Currently, using a method described here, I am able to stream YouTube videos without using X windows/Flash. My primary text-based browser is elinks, and you can call external programs and pass to it your currently selected link by adding this to your elinks.conf file:

set document.uri_passing.youtube = 'ytmplay.sh %c'
bind 'main' 'F10' = 'link-external-command'

This currently works, but unlike calling `ytmplay.sh YOUTUBE_URL' directly from the console, I cannot actually control mplayer, and can only stop the video if I force-terminate mplayer. Does anyone know how I can maintain control of mplayer when calling it through elinks external commands/URI passing?

1

There are 1 answers

0
Piotr Martyniuk On

I would suggest using mpv as it has IPC protocol. I use following script to run YT url with mpv:

#!/bin/bash
$(which mpv) --input-ipc-server=/tmp/soc_mpv "$@"

Then I can control MPV with the following:

#!/bin/sh
# play
echo '{ "command": ["set", "pause", "no"] }' | socat - /tmp/soc_mpv
#!/bin/sh
# pause
echo '{ "command": ["set", "pause", "yes"] }' | socat - /tmp/soc_mpv