Skip to main content
February 4, 2014
Question

Air URLRequestHeader Range

  • February 4, 2014
  • 1 reply
  • 336 views

     Hi all,

I have developing a file  downloader by using Adobe Air.When ı paused or closed  the  application and open it again i want to resume download from where it closed or paused.For that i used

URLRequestHeader  like this

////////////////////////

  var req:URLRequest  = new URLRequest(fileLink);

                                        var requestHeaders:URLRequestHeader          = new URLRequestHeader("Range", "bytes=" + offset + "-");

                                        req.requestHeaders.push(requestHeaders);

                                        urlStream.load(req);

/////////////////////////

But it doesnt resume from offset value.it  append  bytes from beggining of file.Any help to resume properly ?

This topic has been closed for replies.

1 reply

Participant
February 8, 2014

Hi Kudret,

First, can you verify that the file is written on disk and not kept only in RAM while download progress.

If yes, can you try this way, it works for me on mobile and desktop :

this.onDiskFile = this.downloadsDirFile.resolvePath(this.onDiskFileNameString); 

var ur:URLRequest = new URLRequest(this.onlineFileURLString); 

if (this.onDiskFile.exists)

    ur.requestHeaders.push(new URLRequestHeader("Range", "bytes=" + this.onDiskFile.size + "-"));

ur.cacheResponse = false;

ur.useCache = false;

ur.followRedirects = false;