Play video in multiplayer room

Options

Below are the video script, when I joining with others player in a same room, and I play the video in a screen, but it only can view in my own side and the others player can't view it.

It that Photon Pun 2 support this function?

Or I need to make some changes in the script. Please help me, thank you.


// Examples of VideoPlayer function
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
//using UnityEditor;
using UnityEngine.Video;
using SFB;
using System;

public class Video : MonoBehaviour
{
  public void OnFileSelectButtonDown() 
  {

    string [] FilePath = OpenFile(); 
    var vp = GetComponent<VideoPlayer>();

    if (vp.isPlaying) 
      vp.Stop();




    vp.url = "file://" + FilePath[0]; 

    vp.Play();

  }

  public string [] OpenFile()
  {
    //string [] FilePath;

    var extensions = new[] 
    {
      new ExtensionFilter("Movie Files", "mp4", "mov", "avi"),

    };


    var FilePath = StandaloneFileBrowser.OpenFilePanel("Select Movie File", "", extensions, true);

    return FilePath;

  }

}


Answers

  • Tobias
    Options

    You could (e.g.) send an event to tell others to show the video, too. This would be the "networking" part of playing a video for everyone in a room...

  • Lingkail
    Options

    Sorry... I still cannot get it. Is it means that I need to implement the RaiseEvent method in it?

  • Tobias
    Options

    Sorry for the late reply.

    You need to somehow signal the action to everyone in the room. Via the network.

    Pressing a button is still something you do locally in Unity, even if you added PUN or any other networking solution. It does not sync everything magically.

    The few things you need to signal to others need to be added into your code and the receivers of such events need to react accordingly.