Question

I have app with embedded http server (using this one)and I need show html5 video in UIWebVIew, my server return video file and some headers (Content-type, content-length, Content-Range and some other), but its not playing. What is need to fix this?

Addition information: audio file for audio tag plays, I check that video also returns well by get it with NSURLConnection and look at headers\responce +md5 sum of returned and original file and by inject and check XMLHttpRequest() result in javascript near video tag insertion (it added with js, not in statical html), html/js code also work well and play video if i don't use inside server

Was it helpful?

Solution 2

Results - NSURLProtocol did't help me too. I found the solution (use cocoaHttpServer instead current) in this question Custom NSURLProtocol class for WebView doesn't work when loading video in HTML5 document and fix for iOs 7.0 (use 127.0.0.1 instead localhost) in this one Can not play local video stream in iOS 7 when airplane mode is on

OTHER TIPS

Great question!

I suspect your problem lies with this line of code, which is found within HTTPConnection -performDefaultRequestHandling::

NSData *data = [NSData dataWithContentsOfURL:url];

This line of code reads the entire contents of the file into memory in one shot. If the file size is greater than the amount of memory you have, your app is killed. Based on your question, I don't suspect that is the case, but this also has other undesirable results.

Most streaming HTML viewers will utilize some sort of range header to support jumping within the video. Since the server is not honoring that header, the client is not getting the data it expects back from its requests. This likely results in the stream being reported as corrupt to the video player.

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