Synchronizing video between players in webgl
Options
Hi all,
I am trying to get a video to start and play for all players at the same time once a button is pushed. Has anyone tried this? What would be the best way to do this?
Thanks so much.
I am trying to get a video to start and play for all players at the same time once a button is pushed. Has anyone tried this? What would be the best way to do this?
Thanks so much.
0
Comments
-
This is possible and a simple trick is to use the ServerTimestamp. When the button is pressed, get the timestamp, add a little delay time to it and set it as "vst" (video start time) in a property. Anyone can read it and calculate (relatively precisely) when the video started.
The ServerTimestamp is per server and not a datetime. It will overrun but as long as you calculate time differences (now - vst) this is fine.1 -
Thank you so much for your response. That does sound good. So I would just call a global that would play the video in the server?0
-
Would it be possible to get a code example of how you would do that?0
-
Please refer to the docs about how to use the APIs.
https://doc.photonengine.com/en-us/pun/current/gameplay/synchronization-and-state0