avonian/soundstage-vr

shared state for videos

Closed this issue · 4 comments

Videos being played on DJ table are currently implemented as client events.
Consequence is, new arrivals don't see any until they change (new video starts playing).

Stage controls using shared properties now. When event is sent, works as before. The state is now present when avatar loads, see createAvatar(obj).
However, stage controls are not initialized at that point, and videos are not preloaded yet. Nothing to play.
I'm not sure what proper solution is.
We may connect to the server after all videos load, this is going to delay entry for no real reason.
More complicated, introduce some callbacks after videos load. Then avatar factory should have access to video loader and install callback to video supposed to be activated.

I'm a little lost as to how the shared properties stuff works and can't entirely make sense of it just looking at the code, but happy to discuss together to see how we can solve it.

NP ping me when you're ready to discuss the code.
So sending/receiving changes to shared properties works just like working with other events, you have already mastered it.
Except shared properties are properties of Client object, and are delivered once client is seen first time, along with all other properties, like name, position, rotation. 'Seen first time' is handled by factory method createAvatar(obj).
Another important difference is that properties are object. Suppose current state is { stageEvent: 'something', altImage: 'yourAvatar' }, and if you send properties { stageEvent: 'somethingElese }, you will override altImage property. Not a big deal for the time being, but something to be taken care of eventually.

done, merged to main branch