-
Notifications
You must be signed in to change notification settings - Fork 99
-
I've been successfully controlling OBS using obs-websocket-js and it works fantastically well. However, I have no idea how to retrieve values from OBS using code. I've looked everywhere and there are no examples of syntax. Functions like GetTextGDIPlusProperties are there, but how do I use them?
This is how I'm currently using the obs-websocket-js to send commands...
const obs = new OBSWebSocket();
obs.connect({
address: "localhost:4444"
});
obs.send("SetCurrentScene", {
"scene-name": "titles"
});
Any help would be most appreciated!
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
.send function calls return a Promise that resolve when obs-websocket answers to the request. Therefore the data can be accessed by
.then on promise chain:
// SetCurrentScene returns an empty object on resolve, so while you can use the callback to know when scene has been set, Get works as a better example: obs.send("GetCurrentScene").then((data) => { console.log(data.name); // Current scene name });
Alternatively there's also async/await syntax:
// Generally should be in a async function like // async function checkCurrentScene() { const data = await obs.send("GetCurrentScene"); console.log(data.name); // Current scene name
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment