obs-websocket-community-projects / obs-websocket-js

Consumes https://github.com/obsproject/obs-websocket
MIT License
657 stars 95 forks source link

No completion for "TriggerMediaInputAction" request #310

Closed CommandMaker closed 1 year ago

CommandMaker commented 1 year ago

Description

There is no completion on the "TriggerMediaInputAction" mediaAction parameter (type-hinted as string). Add a list of possibilities would be easier when using this request (because the wanted string by OBS is something like this : "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_RESTART")

rodrigograca31 commented 1 year ago

exactly my current problem! it says it takes a ObsMediaInputAction enum but I cant seem to be able to import such enum to use it.

currently this code works:

obs.call("TriggerMediaInputAction", {
    inputName: "media6",
    mediaAction: "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_RESTART",
});

but looks ugly. I was expecting something like

obs.call("TriggerMediaInputAction", {
    inputName: "media6",
    mediaAction: ObsMediaInputAction.RESTART,
});

How do I import ObsMediaInputAction to use? 🤔

I've found a few places where theres all the input actions:

https://github.com/obsproject/obs-websocket/blob/6d4b7c786e59cde6e6a287f81d785f071c158a2d/docs/generated/protocol.json#L451-L509

https://github.com/obsproject/obs-websocket/blob/f4b72b69ce7f9ec6a5fdb1b06971e00d2b091bec/src/eventhandler/EventHandler_MediaInputs.cpp#L30-L35

https://github.com/obsproject/obs-websocket/blob/f4b72b69ce7f9ec6a5fdb1b06971e00d2b091bec/src/requesthandler/RequestHandler_MediaInputs.cpp#L172-L199

https://github.com/obsproject/obs-websocket/blob/ab743c2ee6834ffa49c61f4f600f6a764bb02ef6/src/utils/Obs.h#L80-L172

CommandMaker commented 1 year ago

You need to use the string version. ObsMediaInputAction doesn’t exist in the lib. I’ll make a pr today to add it and fix another little problem