obsproject / obs-browser

CEF-based OBS Studio browser plugin
GNU General Public License v2.0
791 stars 227 forks source link

is there a way to get all scene name even though it is not active? #116

Closed jaotors closed 1 year ago

jaotors commented 6 years ago

Hello, can i get the name of the scene/s even though it is not active?

kuhnchris commented 6 years ago

Hi! Do you mean within javascript or within the plugin's source? There is an event that is triggered during OBS scene change which calls obs_frontend_get_current_scene. From a purely technical side of view there is a "obs_frontend_get_scenes" which returns all scenes in the UI in the OBS Studio sources (UI/api-interface.cpp). If you need access to that via javascript you would need to implement a call to expose this function to the V8 javascript interpretor. You could do that via either a function defined in the javascript and then update it via DispatchJSEvent in obs-browser, or you can statically read it once when you load the plugin and then have it accessable via javascript (see obs-browser-source.cpp and obs-browser-plugin.cpp).

All the best, Chris

Warchamp7 commented 1 year ago

obsstudio.getScenes() would return you the list of scenes, even if the source is not active.

However if the source is not loaded, or has unloaded due to the Shutdown when source not visible, there is no way around that.