- Home /
Video call in Unity?
Is it possible to make two computers engage in a video call (across a network)?
I'm working on a project to design a virtual campus (Where players/students can design their avatars, attend lectures, talk with friends,.. etc). A part of it is where a professor can do a realtime online video streaming - resembling a lecture, another is where two students can chat with each other via video call.
So, my question is: Is this possible? And if it is, can you give my any guidelines on what to do/learn? I've already applied some tutorials on how to make a basic MMO, and on capturing video from a webcam & displaying it on a game object. But I can't seem to merge them together.
Your help is much appreciated :)
EDIT: 8 March. I've managed to write a script to transfer the data from the webcam over the network. It gives a blank page on the receiver's end, but it's something :)
#pragma strict
var webcamTexture : WebCamTexture;
var data : Color32[];
function OnServerInitialized() {
webcamTexture = WebCamTexture();
renderer.material.mainTexture = webcamTexture;
webcamTexture.Play();
data = new Color32[webcamTexture.width * webcamTexture.height];
}
function Update () {
webcamTexture.GetPixels32 (data);
}
function OnConnectedToServer() {
networkView.RPC ("WebcamStream", RPCMode.Others, data, webcamTexture);
webcamTexture.Play();
}
@RPC
function WebcamStream (data : Color32 [], webcamTexture: WebCamTexture) {
var newwebcamTexture: WebCamTexture = webcamTexture;
renderer.material.mainTexture = newwebcamTexture;
var newdata: Color32[] = data;
webcamTexture.GetPixels32 (newdata);
}
Answer by Landern · Feb 05, 2013 at 01:57 PM
Unity does have a system for web cam's, please look at the documentation WebCamTexture.
Edit: Read the rest of your question. You will have to transmit the frames after say encoding them as a byte array or some other form to the connected users, decode it back and create a texture, rinse repeat. You will want to use in particular the GetPixel/GetPixels/GetPixel32 functions/methods of the WebCamTexture class.
Can you please elaborate how to do this? I'm not very good in coding :)
This post is 4 years old many things has been deprecated.Post your question if you have problem in video calling unity.
Your answer
![](https://koobas.hobune.stream/wayback/20220613092202im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Can Unity play live streamed video and audio sources continuously? 1 Answer
Streaming in Unity - Poor performance issue. 1 Answer
Is it possible to display inside your game a mirror of the desktop behind the game you are running? 1 Answer
Can I download videos at runtime? 3 Answers
how to send live audio from mobile to desktop app via wifi 1 Answer