Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 & Javascript, iPhone File Upload, Preventing phone from going to sleep

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

like image 952
NadavRub Avatar asked Jul 18 '13 07:07

NadavRub


1 Answers

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.

like image 83
Homer6 Avatar answered Oct 06 '22 01:10

Homer6