Use Leadtools.Multimedia.RTSPServer to implement an RTSP Server
Create an instance of the Leadtools.Multimedia.RTSPServer object:
RSTPServer _server = new RTSPServer();
Specify the source folder that will contain the media files that will be streamed:
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.
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:
// 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.
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);
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
When you are done, stop the server and dispose the Leadtools.Multimedia.RTSPServer object:
_server.StopServer(554);
_server.Dispose();
Products |
Support |
Feedback: Use RTSPServer to implement an RTSP Server |
Introduction |
Help Version 19.0.2017.6.16
|