Description
Hi!
I expected SetSceneItemEnabled
to receive "sourceName
" (or "sceneItemName
") but we need to use sceneItemId: 11
which is a "random" number that is not human friendly and theres no way to know it.
previously we used:
obs.send("SetSceneItemProperties", {
"scene-name": "browsers",
item: "warning",
visible: true,
});
this was self explanatory, on the scene browsers
set the item warning
as visible.
now with OBS 28 and obs-websocket-js 5:
obs.call("SetSceneItemEnabled", {
sceneName: "browsers",
sceneItemId: 11,
sceneItemEnabled: true,
});
which works perfectly well but sceneItemId
is unknown to us "users".... are we supposed to guess it?
I had to use obs.on("SceneItemSelected", (data) => callback(data));
to find out it was 11
and then figured out theres code to get that ID programatically... one could do:
obs.call("GetSceneItemId", {
sceneName: "browsers",
sourceName: "warning",
})
.then((data) => {
console.log(data.sceneItemId);
obs.call("SetSceneItemEnabled", {
sceneName: "browsers",
sceneItemId: data.sceneItemId,
sceneItemEnabled: true,
});
});
but this makes the code way bigger compared with the original... also a bit repetitive... because first we find an ID then we set that ID enabled
to true
what about supporting something like sceneItemName
that way we could address a given item by a human readable name instead of a "random" ID. Something like:
obs.call("SetSceneItemEnabled", {
sceneName: "browsers",
sceneItemName: "warning",
sceneItemEnabled: true,
});
I'm not even sure where that ID comes from and I'm guessing it might even change over time... (if the user removes/adds items)
P.S. Not sure if this is a problem with the JS version or with the protocol it self....? Should I open an issue on OBS GitHub?
Versions Used (if applicable):
- obs-websocket-js version: obs-websocket-js@5.0.1
- obs-websocket plugin version: none
- obs-studio version: OBS Studio - 28.0.1 (linux)
- node version: v17.9.1