Working code that uses "rtsp" seems to have broken recently

We had working code a few years ago, for a seldom used feature (streaming the camera image from a VIRB 360 camera).

Trying to get it working again, but when I use a URLSession Data task to try and connect to this URL:

rtsp://192.168.0.1/livePreviewStream?maxResolutionVertical=0

I get an error: Code=-1002 "unsupported URL"

I vaguely remember trying to add permissions in the Info.plist for the local network, but it turned out for "http" we didn't need .t (so it got removed).

But now I can't find a reference to it.

Does the above error code look like its related to permissions? If not what?

Thanks for any pointers!

David

Accepted Reply

First up, the URL you posted seems like it’s on the local network, in which case local network privacy is definitely going to be a concern. See the Local Network Privacy FAQ for more on that.

Second, you wrote:

when I use a URLSession data task to try and connect to this URL:

rtsp://192.168.0.1/livePreviewStream?maxResolutionVertical=0

I get an error: Code=-1002 "unsupported URL"

That’s expected. Error -1002 is NSURLErrorUnsupportedURL, which makes sense because URLSession does not have built in support for rtsp URLs. AFAIK it’s never had this support. It’s possible that some other part of your code has added that support using an NSURLProtocol subclass.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • I thoroughly searched the project and can find no protocol extension to handle this. All I can conclude at this time is that the original developers, years ago, discovered themselves that they could not get rtsp to work, but then just left the code they had written in the app. Its just so bizarre!

    Thanks so much for your response!

Add a Comment

Replies

First up, the URL you posted seems like it’s on the local network, in which case local network privacy is definitely going to be a concern. See the Local Network Privacy FAQ for more on that.

Second, you wrote:

when I use a URLSession data task to try and connect to this URL:

rtsp://192.168.0.1/livePreviewStream?maxResolutionVertical=0

I get an error: Code=-1002 "unsupported URL"

That’s expected. Error -1002 is NSURLErrorUnsupportedURL, which makes sense because URLSession does not have built in support for rtsp URLs. AFAIK it’s never had this support. It’s possible that some other part of your code has added that support using an NSURLProtocol subclass.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • I thoroughly searched the project and can find no protocol extension to handle this. All I can conclude at this time is that the original developers, years ago, discovered themselves that they could not get rtsp to work, but then just left the code they had written in the app. Its just so bizarre!

    Thanks so much for your response!

Add a Comment

Its just so bizarre!

Indeed.

It’s possible that some Apple framework added a custom NSURLProtocol subclass to support the rtsp scheme, and your app was using that undocumented feature by accident. I’m not aware of any such infrastructure, but if it did exist it’s likely to have come out of the media layer frameworks, and I don’t know those very well.

If you really want to understand what’s going on, you could take an old build of your app and install it on an old system and see if you can get that to work. If so, some LLDB spelunking should tell you where the protocol is coming from.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"