- Home /
 
Live streaming with rtsp
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(); 
 }
 
              Does www class receive data from RTSP? Have somebody tried that?
Hi @Gael51
I am trying to achieve something very similar. Were you able to solve your problem?
Answer by Wajdi-azar · Dec 14, 2013 at 03:08 PM
try this one
rtsp://r5---sn-cg07lues.c.youtube.com/CiILENy73wIaGQn57h6aVHewzBMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp
Answer by sholistudios · Sep 22, 2014 at 08:38 AM
Hi, If you are able to hear the audio, but not able to see the video, then, the problem is in this line of your code
 videoGUItex.pixelInset = new Rect(Screen.width / 2, -Screen.height / 2, 0, 0);
 
               The Rect values are set wrongly. It should be
 videoGUItex.pixelInset = new Rect(-Screen.width / 2, -Screen.height / 2, Screen.width, Screen.height);
 
               I hope it helps.
Your answer
 
             Follow this Question
Related Questions
Decode H.264 stream and display in Unity 0 Answers
Can you stream audio from the web through Unity? 0 Answers
How to display a live streaming video in Unity? 0 Answers
360 cam live streaming questions 0 Answers