Open CyBeRoni opened 3 years ago
The page contains a red bar with text that moves up or down. Only the downward motion should be visible to Program.
2. Create a scene called "Scene", with a browser source in it with the above file and the rest default
3. Create a second scene with no contents
4. Switch between the two scenes. Upon switching to "Scene" the red bar should move down. Upon switching to any other scene, it should (in the background) move up.
5. Observe that with no projector, multi-view and without studio mode, switching back to Scene has the upward animation running as you switch to it, even if you waited for longer than 1 second (the animation duration). The animation is then interrupted by the downward animation triggered by the switch to Scene.
6. Enable Studio Mode and switch again. Observe that when Scene is in the Preview pane, the red bar moves up as expected, and then down again when you switch to it. (If you switch faster than one second, the animation is still interrupted but this is to be expected.)
### Anything else we should know?
It seems that the obsSourceVisibleChanged event also does not fire when using studio mode/etc which I believe is not how people are intending that to be used. I have not verified this however.
This sounds like intended behaviour from the Page Visibility API.
I would agree that this behaviour is intended in an actual browser (laptop battery life and all that) but not in a broadcast setting.
The main reason we respect the Page Visibility API is because it's standardised behaviour, which in my opinion also makes sense in a broadcast setting. Keep in mind a large chunk of our users stream video games while using OBS, and wouldn't want sources using resources unnecessarily when they're not visible.
I'm aware of that, and in fact I see the same issue happening often with video game streamers who have an intermission scene with their chat rendered on it: the chat doesn't update when the scene isn't visible and only restarts when they switch to that scene. Most game streamers don't use studio mode so I'm going to guess this is the same behaviour.
Another problem with this is that it causes the behaviour of the browser source in OBS to be different depending on whether or not you're using studio mode, a multi-view window or a source/scene projector that happens to have the relevant browser source in it.
It is my opinion that while this behaviour might be ok to have enabled by default for the reason you state, it should be able to be opted out of without workarounds.
I wouldn't be against a toggle in the browser source Properties that allows the user to disable the Page Visibility API, it'd just have to be worded very specifically.
I had something similar of an issue. My browser sources just keeps disappearing and they are only visible when I turn on studio mode but not everyone wants to waste their screen space with studio mode. So basically the only alternative to a proper fix I found is by using a plugin called source dock which lets you dock any source or scene in ur obs as a dockable window. Using this, I stacked all the browser sources.
Operating System Info
Windows 10
Other OS
No response
OBS Studio Version
27.0.1
OBS Studio Version (Other)
No response
OBS Studio Log URL
https://obsproject.com/logs/gORv5KITsQ0cWIfn
OBS Studio Crash Log URL
No response
Expected Behavior
The OBS Browser source should always continue to run animations (and js code) even when it is not actually visible anywhere. For example an animation triggered by the scene being switched away from the browser source should continue in the background so that when the source becomes visible again, it is (presumably) finished.
Current Behavior
When not using studio mode, a multiview window or a projector, processing is paused when the browser source becomes invisible. Using studio mode or having a multi-view or a projector containing the source open prevents the behaviour and has animations complete as expected.
A quick google led me to the "--disable-background-timer-throttling" flag to prevent this but that does not work in the current version of OBS at the time of writing.
Steps to Reproduce
function moveDown(){ gsap.to("#move", {y: 200, duration: 1}); }
function moveUp(){ gsap.to("#move", {y: 0, duration: 1}); }
window.addEventListener('obsSceneChanged', function(event) { console.log(event); if (event.detail.name == "Scene"){ moveDown(); } else { moveUp(); } });