slmnio / slmngg-sfc

New SLMN.GG website & server
5 stars 8 forks source link

Investigate OBS visibility #32

Closed slmnio closed 2 years ago

slmnio commented 3 years ago

To match other broadcast packages (and to improve the quality) it would be nice if the overlay animated as it was shown.

Since the overlay loads each entity in groups, it is usually not feasible to wait for everything to load from a cold refresh. Therefore, using things like the Page Visibility API (and maybe other things that work with OBS) to detect when the scene (and therefore the page) has been switched to and play an animation.

It would also be good to have it restart an animation, rather than just hiding the page whilst it isn't visible. This is so it can be seen in OBS previews.

JJ1898 commented 3 years ago

OBS exposes some visibility info via a JS object: https://github.com/obsproject/obs-browser/blob/master/README.md which might provide some of the functionality you need for this

slmnio commented 3 years ago

I explored visibility options tonight. There's some issues that make it fairly annoying.

  1. The important event, obsSourceVisibleChanged fires whenever the source is enabled, or when the scene is on output OR the preview. The important part is that it also shows when it is in preview and has no distinction between preview and program. This means we can't trigger an animation since it will play on the preview first, or by not showing the preview (which would be a pain for producers)
  2. The scene change event obsSceneChanged is useful to trigger when scenes are on the program output. It shows the size and name whenever a transition is done, however it comes with some issues:

These questions make it a little tricky to implement a nice universal switching system. We want to trigger a re-animation when the scene is visible AND on the program output. Doing this with visibility on preview/program and the current scene name might be a little tricky. More investigation is required to see if there's a better way of doing it. Looking through the source code, there's no options for program feed only.

zusorio commented 2 years ago

This seems to be resolved by 917fc2beb7fa1a7462a6180fca00ba042c195c77...0981018afec7ec545b0b7d7af65a190c3c1abe5c