Unity Video Player not synchronized for all players.

Hello,

I am working on a multiplayer game , where as a host I need to play a video on the screen. It works fine for the current players in the room, but when any new player enters the room later then the frame is on 0 only, it is not synchronized with the host video player frame / image texture. I am triggering the function on "RpcTarget.AllBufferedViaServer" as I want new player to see this video when he enters the room.


How can I synchronize the video player on network for new players as well?

Answers

  • Using a buffered RPC should work. You have to wait until it's being called (which should be early but not instantly when you join a room). Are you saying this RPC is not getting called??

    I would possibly use a Custom Room Property. In a key store the server timestamp when the playback started (in server time). Then, whoever joins hopefully has a somewhat correct server timestamp and can play the video at the timestamp that everyone uses.

  • Thanks for responding.

    This is how I am trying to play the video on photon. But for new player , how can I sync that buffer time, which you mentioned as timestamp. Do we have any existing example or any syntax for reference ?  

    [PunRPC]

        public void streamVideo(string a)

        {      

                PlayStreamingClip("video.mp4", videoPlayer, timer , false);

        }

      public void PlayStreamingClip(string videoFile,VideoPlayer videoPlayer, double startTimer, bool looping = true)

        {

    // Basic video player functionality define here

    }

  • We don't have a sample explicitly for this, sorry.

    The CountdownTimer.cs is likely the code that comes closest to this. Have a look at the comments (in code) to get a hang of it and adapt this to your case.

  • Did you solve this ? I am doing a similar thing for my project.