I finally figured out, how I can stream my webcam, but I'm getting not the best performance. In low resolutions it's working fine, but as soon as I turn the resolution up, the performance gets worse. I think Unity can't handle the decoding in that quality and speed so that the game is getting slowed down. Here is my Code :
Texture2D screenshot = new Texture2D(Screen.width, Screen.height, TextureFormat.ARGB32, false); screenshot.ReadPixels(new Rect(0,0,Screen.width,Screen.height),0,0); screenshot.Apply(); ws.Send(System.Convert.ToBase64String(screenshot.EncodeToJPG(quality)));
Hopefully there is something to improve.