问题描述
我在 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_input
和 video_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
鼠标和键输入的任务一样。