以编程方式暂停视频播放器mpv [英] Pause programmatically video player mpv
本文介绍了以编程方式暂停视频播放器mpv的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道是否可以将消息发送到Linux上正在运行的进程吗?
I would like to know if there is a way to send a message to a running process on linux ?
例如,是否可以通过编程方式暂停"使用mpv
启动的视频.
For example, is it possible to programmatically "pause" a video launched with mpv
.
推荐答案
要远程控制(例如从另一个终端会话中)mpv
,您也可以使用选项启动它
To control mpv
remotely (eg from another terminal session) you can also start it with the option
--input-ipc-server=/tmp/mpvsocket
并通过发出如下命令来控制它:
and control it by issuing commands like this:
echo '{ "command": ["set_property", "pause", true] }' | socat - /tmp/mpvsocket
有关(许多)更多详细信息,请参见man mpv
.
See man mpv
for (many) more details.
另请参见mpv --list-properties
edit2:我发现切换"暂停/播放的最简单方法是
edit2: The most simple way I've found to "toggle" pause/play is
{"command": ["cycle", "pause"]}
这篇关于以编程方式暂停视频播放器mpv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文