8

Use-case

  1. HTML5 WebSite @ iPhone is used to upload Big Video files ( from the gallery )
  2. Big files take considerable time to upload
  3. iPhone get into sleep mode within ~15 seconds
  4. While in sleep mode formdata/multipart upload is paused

Having the above in mind, it is not practical to upload big files using an iPhone website.

I must have this implemented using a WebSite.

Using a WebSite ( and not an App ) Is there any way to

  1. Prevent the phone from going to sleep while uploading
  2. Keep JavaScript/Upload running while the phone is sleeping

Any help will be appreciated

NadavRub
  • 2,520
  • 27
  • 63

1 Answers1

1

UPDATE: This article appears to be more relevant.

You should chunk the video and hash each chunk using the HTML5 File API. Mobile devices have a lot of errors during transmissions. If a chunk fails, you'll need to request it again. This may not seem like an issue if you're going over SSL or TLS, however, it actually is an issue. The failure rates are really high if you don't chunk the video (because it has to start all over again and the probability of failure during such a large file is quite high).

Also, take a peek at this video. It will further explain some details of transmission patterns of radios in mobile devices. There are further references at the end of the talk for even more details.

As for how to bypass the UIWebView behaviour, you may want to try intercepting the HTTP request and writing Objective C code to manage the uploading. See this article for implementation details.

Lastly, I'm not sure how successful you'll be with a UIWebView only implementation (ie. not writing Objective C). UIWebView seems to be aggressive (and inconsistent) about how much memory it lets you consume before it forcibly closes your web page.

Community
  • 1
  • 1
Homer6
  • 15,034
  • 11
  • 61
  • 81
  • I have no problem with the clunked upload, this is already working for me. The only problem I have is with the device switching to sleep mode causing the upload to be suspended, Please note that, I can't use App/Obj-C for that, only HTML5/JavaScript – NadavRub Jul 18 '13 at 07:58
  • [The article](http://stackoverflow.com/questions/12844598/send-custom-headers-with-uiwebview-loadrequest) deals with an Obj-C solution, I need a solution with HTML5/Javascript – NadavRub Jul 18 '13 at 08:05
  • I meant the article at the top of the solution. It was the last link that I added. It explains how this is very different in iOS 6 from iOS 5. – Homer6 Jul 18 '13 at 08:07
  • 1
    [The article](http://www.idownloadblog.com/2012/06/13/ios-6-safari-media-uploads/) explains about uploading on iOS6, I have file upload working already, the only problem is that it is paused when the phone goes to sleep, and, that it doesn't seem possible to prevent the phone from going to sleep using JScript/HTML5 – NadavRub Jul 18 '13 at 09:39