The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our

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.

Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

How to send videos through the network??

2017-11-24 16:49:29

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.


2017-11-25 13:28:57

Hi, average/expected size of video (MB)?
You should use your web space to upload/download videos.
Via RPC you can pass link to video.

2017-11-26 18:32:54

The average length would be 15 seconds long, so I guess like 175 Mb? How do I use the web space?

2017-11-26 19:49:39

you need place where you can upload/download data (your videos).
175Mb is way too much for 15 sec video (compressed 30 frames 720p video should be below 20Mb).

2017-11-27 19:38:52

Ok but how do I do this? Like, can I use the photon server or do I have to buy a server to do this? And how do I upload videos to the server?

2017-11-28 02:36:42

It has nothing to do with photon.
There are many options and that's why you must do research to understand what will be best for you. You can rent/set up your own web server and read these topics:
or use one of services like Azure Blob Storage:

Back to top