obsproject / obs-browser

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

[BUG] window.obsstudio does not emit events when not visible anywhere #216

Closed Livastyle closed 1 year ago

Livastyle commented 4 years ago

Platform

Operating system and version: Windows 10 Pro OBS Studio version: 25.0.4

Expected Behavior

obsstudio.onVisibilityChange and obsstudio.onActiveChange emits when source becomes invisible, inactive or similar.

Current Behavior

obsstudio.onVisibilityChange and obsstudio.onActiveChange do not emit as long the source it not visible at all.

visible in terms of any of the following cases:

if the source is visible in any of these cases, it emits the events as expected. as example, onActiveChange emits with false as long it is at least visible in some way.

if it is not visible, then it does not emit any events. as soon it becomes visible, it then emits the events immediatly.

Steps to Reproduce

1 Studio Mode disabled, browser source Properties window not open:

As soon I select a different scene, the browser source just pauses until it becomes visible again. Result: window.obsstudio.onActiveChange doesn't emit and the HTML files has no time to react as soon I select the scene again, the event emits twice, first with false, then immediately with true

2 Studio Mode disabled, browser source Properties window open:

Now, since the properties window is open, the browser source is visible there as result, the event emits and the HTML reacts to it

3 Studio Mode disabled, Window Projector of Browser Source:

same as with the properties window - its visible somewhere so it acts properly (emits events etc)

Additional information

if the source is not visible anywhere and the source gets put active on program onActiveChange => false onActiveChange => true would emit directly after each other which causes visual glitches when CSS animations react to it for example, when a CSS declaration would set an element to opacity:0; for invisible and opacity:1; transition:opacity 1000ms; for visible.

the element would be opacity:1 for 1-2 frames, then either its set to opacity:0; and back to opacity:1; together with transition or simply nothing would happen.

There is a checkbox "Shutdown source when not visible" which I did not tick (!!) yet it shows exactly that behavior

Warchamp7 commented 1 year ago

I'm doing some tidying up on the repo, please re-open this if it is still an issue as I am not currently able to reproduce.