Question

I'm having some issues with video requests handled through a special protocol scheme in a NSURLProtocol subclass. Every other resource (images/text) are getting handled correctly, however, when a video request is sent, I only get a call to 'canInitWithRequest' and no follow up. So, my video resource doesn't get resolved. Now, I've looked around and I found no definite solution for this. Some people use instead an embedded HTTP server, but that seems an overkill. Does anyone know if this is a bug or if not, why is this limitation, is there an workaround for it?

A similar issue: Custom NSURLProtocol class for WebView doesn't work when loading video in HTML5 document , but unfortunately without an answer.

No correct solution

OTHER TIPS

@Meda, I was facing the similar issue. Here what I found and hope it is useful to you. I assume that you are using NSUrlProtocol because you want to intercept the video requests. I was using web view which makes request for video over HTTP. It goes to NSURLProtocol and makes the request. When it receives the data, webView loads the video rendering plugin (looking at the mime type in HTTP header). The plugin needs the data to come as Partial HTTP response (Response code 206). Further, the plugin does not use NSURLProtocol class but uses network layer below it. So requests that plugin makes, do not go thru NSURLProtocol. Considering this, there could be 2 problems in your case. 1. HTTP server you are using may not be supporting partial responses. 2. HTTP server is not reachable directly (Can you access the video from safari or any other
browser on your device?) You can verify both the cases by taking network trace. use tcpdump (available on Mac) to take network trace and see what is happening there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top