obsproject / obs-websocket

Remote-control of OBS Studio through WebSocket
GNU General Public License v2.0
3.92k stars 709 forks source link

Bug: TriggerHotkeyByName causing OBS to stop responding #1001

Open BarRaider opened 2 years ago

BarRaider commented 2 years ago

Operating System Info

Windows 11

Other OS

No response

OBS Studio Version

28.0.0

OBS Studio Version (Other)

No response

obs-websocket Version

5.0.1

OBS Studio Log URL

https://obsproject.com/logs/KWhT6Rm5YwoRSM17

OBS Studio Crash Log URL

No response

Expected Behavior

  1. Calling GetHotkeyList will return a list of unique hotkey names
  2. Calling TriggerHotkeyByName will not cause OBS to freeze

Current Behavior

When calling GetHotkeyList multiple hotkeys are getting the same hotkeyNames. Thus when triggering a hotkey such as ObsBasic.SelectScene it (seemingly) tries to trigger a Scene change for ALL scenes, causing OBS to stop respond (and crash when clicked).

Specifically: GetHotkeyList Is returning the same hotkey names multiple times (see example) thus, when trying to trigger one of those repeated hotkey names with TriggerHotkeyByName it seems to be triggering it for every source/item that has that trigger name.

Proposed Solution: Similarly named hotkeys such as libobs.mute or ObsBasic.SelectScene should have some kind of UNIQUE prefix (maybe the name of the source) indicating who it belongs to, and thus will trigger the correct one (and only one) when calling TriggerHotkeyByName

Steps to Reproduce

  1. Call GetHotkeyList
  2. Expect to get a list of unique hotkey names, instead getting the same name for multiple entries
  3. Call TriggerHotkeyByName with one of the repeated hotkeyNames such as ObsBasic.SelectScene

Anything else we should know?

No response

onyx-and-iris commented 2 years ago

I've also noticed duplicates in GetHotKeyList. Also, not sure if it's related to this issue but sometimes I can run one command but not another. Example, libobs.mute will mute an audio source but libobs.unmute will not unmute it. Or libobs.show_scene_item will show a scene but libobs.hide_scene_item will not hide it.

Fry2412 commented 1 year ago

I can confirm the behavior as described. I came across this issue because I am looking for a solution

MrPowerGamerBR commented 1 year ago

Can confirm the same issue as @onyx-and-iris, I'm trying to hide and unhide a scene item and while hiding works, unhiding does nothing.

I also can confirm that @electricplant's workaround does work, but it is a bit cumbersome to setup multiple assigned hotkeys, especially if you have a lot of items that you want to hide/unhide.

If you don't want a lot of assigned combos to common keys, you can do @electricplant's workaround AND change the keybinds on the scenes JSON to be a key that no one uses (all hotkeys: https://github.com/obsproject/obs-studio/blob/master/libobs/obs-hotkeys.h)

arconom commented 1 year ago

"TriggerHotkeyByName", "libobs.show_scene_item.mediaSourceItem" seems to work, but "TriggerHotkeyByName", "libobs.hide_scene_item.mediaSourceItem" does not

TheBartoMan commented 1 year ago

"TriggerHotkeyByName", "libobs.show_scene_item.mediaSourceItem" seems to work, but "TriggerHotkeyByName", "libobs.hide_scene_item.mediaSourceItem" does not

I second this. None of the hide ones work, but the show ones do. Any ideas? Bad code?

normen commented 1 year ago

OBSBasic.StopRecording is also a dud