-
-
Notifications
You must be signed in to change notification settings - Fork 728
Open
Milestone
Description
Issue type
- Feature request
Description
Currently OBS has those functions available:
- obs_source_send_focus
- obs_source_send_key_click
- obs_source_send_mouse_click
- obs_source_send_mouse_move
- obs_source_send_mouse_wheel
Here is how to send a hotkey to a browser source using obs-libre-macros adapted from #595 :
function send_hotkey_tbs1(source,hotkey_id_name,key_up,key_modifiers)
local key = obs.obs_key_from_name(hotkey_id_name)
local vk = obs.obs_key_to_virtual_key(key)
local event = obs.obs_key_event()
event.native_vkey = vk
event.modifiers = get_modifiers(key_modifiers) -- bit or combination with interact keys
event.native_modifiers = event.modifiers
event.native_scancode = vk
event.text = "" -- it possible to leave it blank, keys are sent
obs.obs_source_send_key_click(source,event,key_up)
end
send_hotkey_tbs1(t.source,"OBS_KEY_Q",false)
send_hotkey_tbs1(t.source,"OBS_KEY_Q",true)
Link to obs-browser
obs-websocket can access Qt keys namespace.
And example for mouse move
function send_mouse_move_tbs(source,x,y,key_modifiers)
local event = obs.obs_mouse_event()
event.modifiers = get_modifiers(key_modifiers)
event.x = x -- top left is [0,0]
event.y = y
obs.obs_source_send_mouse_move(source,event,false) -- do not leave
end
Technical information
- Operating System : Windows, GNU/Linux (Ubuntu 18.04)
- OBS Studio version : on Windows from website, on GNU/Linux from snapcraft and from apt
- obs-websocket version : 4.x current
[EDIT] 2021.3.1 - Fix example & add links
norihiro, csunday95, quentinjeanningros, puenktchen and ne0linesquentinjeanningros and puenktchen