You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that in the js script, it seems to use define-section to obtain input, but this command is marked as deprecated. I would like to know if there are other ways to capture user keyboard and mouse input.
I tried to emulate the execution logic of JavaScript in a C plugin, but I did not receive the MPV_EVENT_CLIENT_MESSAGE event. I'm not sure if I've missed something, and I hope someone can point out any mistakes or provide other useful information.
#include<mpv/client.h>#include<stdio.h>MPV_EXPORTintmpv_open_cplugin(mpv_handle*handle)
{
printf("Hello world from C plugin '%s'!\n", mpv_client_name(handle));
mpv_command(handle, (constchar*[]){"define-section", "mpv_input_js",
"a\n", "default", NULL});
mpv_command(handle, (constchar*[]){"enable-section", "mpv_input_js",
"allow-hide-cursor+allow-vo-dragging", NULL});
while (1)
{
mpv_event*event=mpv_wait_event(handle, -1);
printf("Got event: %d\n", event->event_id);
if (event->event_id==MPV_EVENT_SHUTDOWN)
break;
if (event->event_id==MPV_EVENT_CLIENT_MESSAGE)
{
printf("key event: %d\n", event->event_id);
}
}
return0;
}
The text was updated successfully, but these errors were encountered:
@avih Could you please help me or give some advice? I'm stuck with this problem for a long time, or is it not possible to get the user's input in the c plugin?
If this problem can be solved, it would be possible to use deno to run js scripts, which would solve all the current problems with js scripts, e.g. performance, network requests, reading and writing to files, etc. #13608 (comment)
I don't know how to help you, sorry. But here are some data points:
Your section looks empty. There won't be any notifications unless the section has some bindings in it (and the bindings need to explicitly target your client id).
You really shouldn't use deprecated functiuons in your code. I don't know what the alternative is, or even if there is an (good) alternative. Not everything you want to do is necessarily possible.
In this case, maybe the keybind command could help, but I don't know how to unbind it (other than rebinding the key to ignore), or how it behaves with regards to the different sections.
I noticed that in the js script, it seems to use define-section to obtain input, but this command is marked as deprecated. I would like to know if there are other ways to capture user keyboard and mouse input.
I tried to emulate the execution logic of JavaScript in a C plugin, but I did not receive the MPV_EVENT_CLIENT_MESSAGE event. I'm not sure if I've missed something, and I hope someone can point out any mistakes or provide other useful information.
The text was updated successfully, but these errors were encountered: