obs-browser
obs-browser copied to clipboard
Animation is paused if source is not visible anywhere
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
- Create an HTML file with the following content:
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.7.1/gsap.min.js"></script>
<div style="background: red; font-size: 24pt" id="move">THIS SHOULD MOVE DOWN ONLY</div>
<script type="application/javascript">
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();
}
});
</script>
</body>
The page contains a red bar with text that moves up or down. Only the downward motion should be visible to Program.
- Create a scene called "Scene", with a browser source in it with the above file and the rest default
- Create a second scene with no contents
- 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.
- 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.
- 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.