热键忽略了 Linux 上的 Python libvlc 绑定

问题描述

我在 Linux 上使用 python-vlc 绑定控制来自 Python 3.x 的视频时遇到问题。 视频在窗口中播放正常,但热键似乎被忽略。 libvlc 媒体播放器是否处理热键?

我的最小代码

var queryDetails =  @Html.Raw(Json.Serialize(@QueryData));

$.ajax({
    type: 'POST',url: '/Home/SummaryRefresh',data: { queryDetails:queryDetails },success: function (result) {
     
    },error: function (error) {
        alert(error);
    }
});

解决方法

我认为,您认为 video_set_key_inputvideo_set_mouse_input 是解决方案的论点是对这些函数的误解。

来自vlc.py

def video_set_key_input(self,on):
    '''Enable or disable key press events handling,according to the LibVLC hotkeys
    configuration. By default and for historical reasons,keyboard events are
    handled by the LibVLC video widget.
    @note: On X11,there can be only one subscriber for key press and mouse
    click events per window. If your application has subscribed to those events
    for the X window ID of the video widget,then LibVLC will not be able to
    handle key presses and mouse clicks in any case.
    @warning: This function is only implemented for X11 and Win32 at the moment.
    @param on: true to handle key press events,false to ignore them.
    '''
    return libvlc_video_set_key_input(self,on)


def video_set_mouse_input(self,on):
    '''Enable or disable mouse click events handling. By default,those events are
    handled. This is needed for DVD menus to work,as well as a few video
    filters such as "puzzle".
    See L{video_set_key_input}().
    @warning: This function is only implemented for X11 and Win32 at the moment.
    @param on: true to handle mouse click events,false to ignore them.
    '''
    return libvlc_video_set_mouse_input(self,on)

这表明将这些函数设置为 False 只是告诉 vlc 鼠标和按键输入将被忽略并传递给用户应用程序。
为此,您的应用程序必须接受和处理来自指定 X 窗口的鼠标和键输入。

不是,突然按下空格键会暂停视频,就像 vlc 正在执行 accepting and processing 鼠标和键输入的任务一样。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...