Use RTSPServer to implement an RTSP Server

Use Leadtools.Multimedia.RTSPServer to implement an RTSP Server

  1. Create an instance of the Leadtools.Multimedia.RTSPServer object:

    RSTPServer _server = new RTSPServer();

  2. Specify the source folder that will contain the media files that will be streamed:

    c#  
             // assign the source file path to the convert  
             object _server.SetSourceFolder(0, @"c:\RTSPSourceFolder"); 

    The above code tells the server to look in the c:\RTSPSourceFolder folder whenever an RTSP client asks for a file to be streamed.

    We are adding only one source folder, but you can add a second or third folder by changing the index from 0 to 1 and 2.

  3. Specify which server address to use. In here, we will use localhost (127.0.0.1). Change this to the IP address of your computer:

    C#
          // assign the source file path to the convert  
          object _server.TargetAddress = "127.0.0.1"; 
           

    You can also specify the live latency, security settings and default settings for the encoders (which would be used for automatically recompressing the files whose compression does not match the compressions supported by the RTSP server). For best performance, it is recommended that you make sure the files stored in the source folders are already compressed using compression settings compatible with the RTSP Server.

  4. Start the server and listen on the default RTSP port (554). If that port is already used by another server, you can start it on another available port: _server.StartServer(554);

  5. You can now connect with an RTSP client and stream file using this URL (where c:\RTSPSourceFolder\file.ext is a valid media file): rtsp://127.0.0.1/file.ext

  6. When you are done, stop the server and dispose the Leadtools.Multimedia.RTSPServer object:

    _server.StopServer(554); 
        _server.Dispose(); 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Multimedia