MultiThreadDownload icon indicating copy to clipboard operation
MultiThreadDownload copied to clipboard

Speed limitation

Open ghost opened this issue 9 years ago • 4 comments

I need download speed limitation for each or all download tasks, and is able to set in configuration or on downloadRequest init. It is possible?

ghost avatar May 18 '16 07:05 ghost

The lib isn't support speed limitaion for now. Acturally, I haven't thought about it. Do you have some ideas?

Aspsine avatar May 18 '16 08:05 Aspsine

It would be nice to implement this. I have an Ideas but I don't know how to get this done. I saw somewhere multi thread download lib with speed limitation, so it is possible.

ghost avatar May 18 '16 10:05 ghost

I think I made something by calling

DownloadRequest request = new DownloadRequest.Builder()
                            .setTitle(getFileName()+".mp3")
                            .setUri(item.getLink())
                            .setTag(item.getResult().getTag())
                            .setFolder(getDownloadFolder())
                            .setMaxRate(300)//kBps
                            .setTasks(1)//threads
                            .setRateEnabled(true)// default false
                            .build();
    DownloadConfiguration downloadConfiguration = new DownloadConfiguration();
    downloadConfiguration.setMaxThreadNum(10);
    downloadConfiguration.setThreadNum(3);
    downloadConfiguration.setTotalRateLimitEnabled(true);//and this overrides download request if reqvest is false
    downloadConfiguration.setRateLimit(500);// override 
    DownloadManager.getInstance().init(getApplicationContext(), downloadConfiguration);

i'll make sure if its works without bugs

ghost avatar May 19 '16 11:05 ghost

@Demuss did you make it?

pishguy avatar Jul 22 '17 09:07 pishguy