TaggedException: Invalid transport header in rtsp

Topics: Question
Aug 30 at 6:51 PM
Hi Everyone!

After reading a useful article on codeproject i would like to use net7mma for reading live stream from an ip camera.

I have the following code:
class Program
    {
        static RtspClient client;
        static void Main(string[] args)
        {
            string url = "rtsp://foo.bar.org:554/profile1";
            string userName = "myusername";
            string password = "mypassword";

            client = new RtspClient(url,RtspClient.ClientProtocolType.Udp);
            client.Credential = new System.Net.NetworkCredential(userName, password);
            client.AuthenticationScheme = System.Net.AuthenticationSchemes.Basic;
            client.OnConnect += Client_OnConnect;
            client.OnResponse += Client_OnResponse;
            client.Connect();
            Console.ReadKey();

        }
       
        private static void Client_OnResponse(RtspClient sender, RtspMessage request, RtspMessage response)
        {
       
            Console.WriteLine("client on response event fired");
        }

        private static void Client_OnConnect(RtspClient sender, object args)
        {
            if (client.IsConnected)
            {
                Console.WriteLine("connected");

                if (!sender.IsPlaying)
                {
                    sender.SocketReadTimeout = sender.SocketReadTimeout + 30000;
                    sender.StartPlaying();
                }
            }
                
            }
        }

    }
Connection is successful, but on sender.StartPlaying() i receive the following exception:
  • InnerException {"Cannot setup media, Invalid Transport Header in Rtsp Response: RTP/AVP;unicast;destination=255.255.255.255;source=foo.bar.org;client_port=10000-10001;server_port=20038-20039;ssrc=5d39bb44"} System.Exception {Media.Common.TaggedException<Media.Rtsp.RtspClient>}
Can you please explain what is missing and how to fix it.

Many thanks.