obsproject / obs-browser

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

Request: State getters for current js bindings #38

Closed SReject closed 4 years ago

SReject commented 8 years ago

Along with the js bindings that get called when a change occurs, it'd be handy to, arbitrarily, be able to get the current scene's name and BrowserSource visibility state:

window.obsstudio.activeScene()
// as function returns string
// Returns the currently active scene's name.

window.obsstudio.isVisible()
// as function returns boolean
// Returns true if the browser source is visible
Simran-B commented 7 years ago

Related to this, I wonder if a Scene and Visibility change occur when the browser source initializes. If so, then you can simple store the values on your end and read the current state from there (needs to be updated on further events).

WizardCM commented 4 years ago

You can get the current scene's name via window.obsstudio.getCurrentScene() and the visibility using document.visibilityState (the Page Visibility API).