Hi,
I'm trying to develop a simple client for the RTSP protocol. I'm only interested in exchanging messages such as OPTIONS, DESCRIBE, SETUP, etc. with the server, not actually streaming any media.
Because RTSP is similar to HTTP, I hoped I could use an NSURLSession to talk to the server if I provided a protocol handler for RTSP. So I created a class that extends NSURLProtocol, implemented the +canInitWithRequest method, and registered the class with [NSURLProtocol registerClass:]. Then I put a breakpoint in my canInitWithRequest method and tried to send a dataTask to an rtsp:// URL.
The result is simply an error message "unsupported URL". I'm totally confused by this result, because my canInitWithRequest method was never even called. I expected that it would be, regardless of what ever else happened.
Can someone explain why this is? Also, is it even possible to do what I want to do, without writing a bunch of low-level socket code to talk to the server? I'm willing to write the socket code if I have to, but I was hoping to find a shortcut (and if I have to write the socket code, I don't care whether or not it is integrated with the URL loading system).
Thanks,
Frank