Change a source's visibility when an event happens?

WaleighWallace

New Member
Is there a plug-in/way in the API to turn a source's visibility on and off through code? I know you can connect to services like Streamlabs to have code respond when an alert like a new subscriber hits, but can you connect external programs to OBS to affect sources on the current screen. Or even across all screens?

The .json files for the scenes can be found in ...\AppData\Roaming\obs-studio\basic\scenes, but even if I directly edit the visibility of a source from true to false, it won't update (probably the json files only being referenced when initializing).

Since the main source I'm trying to work on is a browser source, my current solution is to write a webpage that mirrors the browser source when I want and changes to a transparent image/something else when the code is triggered. But I thought this could apply to other sources like webcams.
 

upgradeQ

Member
Is there a plug-in/way in the API to turn a source's visibility on and off through code? I know you can connect to services like Streamlabs to have code respond when an alert like a new subscriber hits, but can you connect external programs to OBS to affect sources on the current screen. Or even across all screens?

The .json files for the scenes can be found in ...\AppData\Roaming\obs-studio\basic\scenes, but even if I directly edit the visibility of a source from true to false, it won't update (probably the json files only being referenced when initializing).

Since the main source I'm trying to work on is a browser source, my current solution is to write a webpage that mirrors the browser source when I want and changes to a transparent image/something else when the code is triggered. But I thought this could apply to other sources like webcams.
There is some scripts which do that, e.g: on scene change, on recording started,on streaming stop etc. See documentation for scripting and frontend event. You can also download obs-websocket plugin which provides websocket API for OBS Studio.
 
Top