Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

xhr's .ondatastream inconsistent with unknown content length

I'm accessing a server that doesn't send the content length for the HTTP request.

On the iPhone, .ondatastream() is called only twice: once with 0, once with 1. Since the content length is unknown I don't expect a progress bar, but it would be nice if this function were called more often so that I can at least update the user interface with the amount downloaded.

On Android, it's called every 1k block, and .progress returns an increasingly large negative number. I see there's a totalSize attribute to the event which is not mentioned in the docs or KitchenSink. With that I can update the interface to show how much has been downloaded, which is just fine. Arguably the .progress field should return 0 until the download has completely, however.

— asked May 9th 2010 by Damien Elmes
  • android
  • bug
  • download
  • iphone
  • ondatastream
  • xhr
1 Comment
  • Hey Damien,

    I'm struggling with a similar issue. Were you able to resolve this. Any help would be appreciated.

    — commented June 9th 2011 by Nishant Menon

0 Answers

The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.