obsproject / obsproject/obs-browser
Animation is paused if source is not visible anywhere
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 904
- Forks
- 267
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 2
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named. Start by reproducing the browser-source animation behavior using the HTML and scene-switching steps in the issue, then trace how OBS Browser handles source visibility and background processing; done means animations and JavaScript continue while the source is not visible, without relying on studio mode, multiview, or a projector.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100