I have a web service that stores the files at http://.mysite.com/content/videos Now all I want to achieve in my android application is to download every videos that user can upload on this server, so i can get a json file from the server to see how many videos are stored and to download the all list locally and than to play it on a loop. Please give me some code examples and ideas to. The idea is building a Signage android client.
Asked
Active
Viewed 2,542 times
0
-
What i want to do is that getting a list of videos from the server and to download it locally and than to play it on video player, only when the downloads have finished first. – Aldo Feb 09 '16 at 09:14
-
there is already tons of answer if you search..what have you tried so far? Nothing because you didnt search? – Kostas Drak Feb 09 '16 at 09:16
-
I did searched, i wrote here to look for better guides. Sorry im just a beginner. If u can help on a better solution or idea would be great. Thanks. – Aldo Feb 09 '16 at 09:19
1 Answers
0
For getting JSON from URL, see my answer here.
After that You can use this library for downloading videos. You can also download them serial (one by one) or parallel.
Usage: Initialize the downloader in Application class:
public XXApplication extends Application{
@Override
public void onCreate() {
super.onCreate();
FileDownloader.init(this);
}
}
Then download like this.
final FileDownloadListener queueTarget = new FileDownloadListener() {
@Override
protected void pending(BaseDownloadTask task, int soFarBytes, int totalBytes) {
}
@Override
protected void connected(BaseDownloadTask task, String etag, boolean isContinue, int soFarBytes, int totalBytes) {
}
@Override
protected void progress(BaseDownloadTask task, int soFarBytes, int totalBytes) {
}
@Override
protected void blockComplete(BaseDownloadTask task) {
}
@Override
protected void retry(final BaseDownloadTask task, final Throwable ex, final int retryingTimes, final int soFarBytes) {
}
@Override
protected void completed(BaseDownloadTask task) {
}
@Override
protected void paused(BaseDownloadTask task, int soFarBytes, int totalBytes) {
}
@Override
protected void error(BaseDownloadTask task, Throwable e) {
}
@Override
protected void warn(BaseDownloadTask task) {
}
};
for (String url : URLS) {
FileDownloader.getImpl().create(url)
.setCallbackProgressTimes(0)
.setListener(queueTarget)
.ready();
}
if(serial){
FileDownloader.getImpl().start(queueTarget, true);
}

Community
- 1
- 1

Asad Haider
- 504
- 1
- 5
- 17