Unity Video Player not synchronized for all players.
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on PUN.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
Unity Video Player not synchronized for all players.
Reetika_dev
2022-03-11 04:37:15
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?
Comments
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.
Reetika_dev
2022-03-15 15:56:39
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.
buymeacoffee
2022-06-24 12:41:58
Reetika_dev 2022-03-15T15:56:39+00:00
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
}
Did you solve this ? I am doing a similar thing for my project.
Back to top