Video sending through PhotonPUN

Hello everyone ! I'm quite new to Photon and I'm currently making a phone app that is basically a game in which you have to send videos on specific themes to the players who are in the same room as you. I built the whole room connection system with the Photon PUN , and now I'm trying to send videos through the network with an RPC (by the way, if there is a better solution for this, please tell me). My problem is about serializing the Unity VideoClip, which is not serializable, and then send as a byte[] to the other clients in the room with the RPC. How should I do this?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Reflection;
public static class DataConverter

public static byte[] SerializeObject(T objectToSerialize)
BinaryFormatter bf = new BinaryFormatter();
MemoryStream mStream = new MemoryStream();
bf.Serialize(mStream, objectToSerialize);
mStream.Position = 0;
return mStream.ToArray();
public static T DeserializeObject(byte[] dataStream)
BinaryFormatter bf = new BinaryFormatter();
MemoryStream mStream = new MemoryStream(dataStream);
mStream.Position = 0;
bf.Binder = new VersionFixer();
T o = (T)bf.Deserialize(mStream);
return o;
sealed class VersionFixer : SerializationBinder
public override Type BindToType(string assemblyName, string typeName)
Type typeToDeserialize = null;

// For each assemblyName/typeName that you want to deserialize to
// a different type, set typeToDeserialize to the desired type.
String assemVer1 = Assembly.GetExecutingAssembly().FullName;
if (assemblyName != assemVer1)
// To use a type from a different assembly version,
// change the version number.
// To do this, uncomment the following line of code.
assemblyName = assemVer1;
// To use a different type from the same assembly,
// change the type name.
// The following line of code returns the type.
typeToDeserialize = Type.GetType(String.Format("{0}, {1}", typeName, assemblyName));
return typeToDeserialize;

I found this bit of code for serializing on the Internet, but I don't understand the VersionFixer part, and anyway, again, the problem is that VideoClip is not Serializable.
Sign In or Register to comment.