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;
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
same as #13520
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.
Beta Was this translation helpful? Give feedback.
All reactions