-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there any way to add touch swipe gestures to mpv? #6434
Comments
It's not possible out of the box. But it's not impossible, either. A user script has access to all of the information it would need to implement a gesture recognition system. |
When you say user script, are you talking about |
No, I meant a lua script that tracks mouse movement and performs gesture recognition. |
Oh. I have zero clue how to use that so I guess I'll just wait in case it ever gets approved and gets implemented in the future. |
require 'mp.options' local options = { read_options(options,'touchscreen-seek') function touch_seek() if pos == 'left' then end function get_mouse_area() if mouse_x < winX/3 then end function toggle_fullscreen() if screen_stat == 'yes' then mp.set_property('fullscreen', screen_stat) end mp.add_key_binding(nil, "touchscreen-seek", touch_seek) |
I have the same requirement to play on a Windows tablet. Copy and store as scripts/touchscreen-seek.lua Step value can be defined in script-opts/touchscreen-seek.conf, the default value is 5s. Define in input.conf Hope it can help you. |
Hi, thanks @imufly for your script! Instead of calling function toggle_pause()
local pause = mp.get_property_native("pause")
mp.set_property_native("pause", not pause)
end |
Is there a way to distinguish between mouse and touchscreen events, or handle multiple fingers? Looking at the OSC source code, it handles mouse events through input events like MOUSE_BTN* and MOUSE_MOVE. Currently there are no separate input keys for touch events, but the same mouse events are sent for touches as well. In order to be able to properly handle touchscreen gestures from Lua scripts, we would need:
A conventional way to implement this is to send separate events for touches (perhaps even depending on the number of fingers). Probably mouse events should also be sent so as not to break legacy configurations. Touch event handlers should be able to say whether to suppress the synthesized mouse events. A simpler way would be to always send mouse events, but have a way for the event handler to access whether the event was actually generated by a mouse or a touchscreen, and in the latter case access the number and position of the fingers. |
Found a user script that does something similar and wanted to share it here: https://github.com/omeryagmurlu/mpv-gestures |
|
mpv version and platform
Windows 10, The latest build from https://mpv.srsfckn.biz/
Reproduction steps
Open a video and try to swipe.
Expected behavior
Some navigation happens
Actual behavior
Nothing
I just want to know if there's a way to configure MPV to recognize swipe gestures for example swiping up and down to adjust the volume and swipe left and right to navigate forward and backward in the playback.
The text was updated successfully, but these errors were encountered: