Hello,
I have a problem, I want to display a live video in a window but I have no video with the code below.
I tried with the example of Unity: http://www.unity3d.com/webplayers/Movie/sample.ogg
that works very well.
Have an idea or it is not possible? I have to use another way to use the live streaming?
// My code
//the GUI texture
private GUITexture videoGUItex;
//the Movie texture
private MovieTexture mTex;
//the AudioSource
private AudioSource movieAS;
//the movie name inside the resources folder
public string movieName;
private string url= "rtsp://my_AdresseIp";
//WWW
private WWW myWWW;
void Awake()
{
}
//On Script Start
void Start()
{
//get the attached GUITexture
videoGUItex = this.GetComponent<GUITexture>();
//get the attached AudioSource
movieAS = this.GetComponent<AudioSource>();
myWWW = new WWW(url);
//load the movie texture from the resources folder
mTex = myWWW.movie; //(MovieTexture)Resources.Load(movieName);
//set the AudioSource clip to be the same as the movie texture audio clip
movieAS.clip = mTex.audioClip;
//anamorphic fullscreen
videoGUItex.pixelInset = new Rect(Screen.width / 2, -Screen.height / 2, 0, 0);
//set the videoGUItex.texture to be the same as mTex
videoGUItex.texture = mTex;
//Plays the movie
mTex.Play();
//plays the audio from the movie
movieAS.Play();
}