int video_payload = 0; // usuallly 96 for H264 video which is the first dynamic payload type // Constructor public RTSPClient(String url) { this.url = url; // Use URI to extract hostname and port Uri uri = new Uri(url); // Connect to a RTSP Server tcp_socket = new Rtsp.RtspTcpTransport(uri.Host, (uri.IsDefaultPort?554:uri.Port)); if (tcp_socket.Connected == false) { Console.WriteLine("Error - did not connect"); return; } // Connect a RTSP Listener to the TCP Socket (or other Stream) to send messages and listen for replies rtsp_client = new Rtsp.RtspListener(tcp_socket); rtsp_client.MessageReceived += Rtsp_client_MessageReceived; rtsp_client.DataReceived += Rtsp_client_DataReceived; rtsp_client.Start(); // start reading messages from the server // Send OPTIONS // In the Received Message handler we will send DESCRIBE, SETUP and PLAY Rtsp.Messages.RtspRequest options_message = new Rtsp.Messages.RtspRequestOptions(); options_message.RtspUri = new Uri(url); rtsp_client.SendMessage(options_message); }
int video_payload = 0; // usuallly 96 for H264 video which is the first dynamic payload type #endregion Fields #region Constructors // Constructor public RTSPClient(String url) { this.url = url; // Use URI to extract hostname and port Uri uri = new Uri(url); // Connect to a RTSP Server tcp_socket = new Rtsp.RtspTcpTransport(uri.Host, (uri.IsDefaultPort?554:uri.Port)); if (tcp_socket.Connected == false) { Console.WriteLine("Error - did not connect"); return; } // Connect a RTSP Listener to the TCP Socket (or other Stream) to send messages and listen for replies rtsp_client = new Rtsp.RtspListener(tcp_socket); rtsp_client.MessageReceived += Rtsp_client_MessageReceived; rtsp_client.DataReceived += Rtsp_client_DataReceived; rtsp_client.Start(); // start reading messages from the server // Send OPTIONS // In the Received Message handler we will send DESCRIBE, SETUP and PLAY Rtsp.Messages.RtspRequest options_message = new Rtsp.Messages.RtspRequestOptions(); options_message.RtspUri = new Uri(url); rtsp_client.SendMessage(options_message); }