I am attempting to grab video feed from an mjpeg stream server. the client is in c#, Unity3D. Whenever I run it, I get a strange image of black and gold bands.
I know this is not a problem with the server because the Processing library IPCapture can get the image just fine.
I attach the below c# code to a plane in Unity3D:
using UnityEngine; using System.Collections;
public class IPCapture : MonoBehaviour {
string url = "http://192.168.0.106:8081/video.mjpg?q=30&fps=33&id=0.7494465354830027&r=1382760993848";
// Use this for initialization
void Start () {
renderer.material.mainTexture = new Texture2D(4, 4, TextureFormat.DXT1, false);
WWW www = new WWW(url);
StartCoroutine(SetTextures(www));
}
public IEnumerator SetTextures(WWW www){
yield return www;
renderer.material.mainTexture = www.texture as Texture2D;
}
// Update is called once per frame
void Update () {
}
}