Issue
I am working on daily motion video downloader android application, I have got the downloading link https://proxy-25.sg1.dailymotion.com/sec(dBG4yhTDGt8s-xJL9sczH_7xepHY7fASsEf--yb2hurT6QGlS77UybPsDxeGgwnIJAX0byvcREo9Wni-vBKPqA)/video/773/458/493854377_mp4_h264_aac_ld.mp4 but still downloading's does not stats and I am getting this exception:
W/System.err: java.lang.IllegalStateException: closed
W/System.err: at okio.RealBufferedSource.read(RealBufferedSource.java:44)
W/System.err: at okio.Buffer.writeAll(Buffer.java:1053)
W/System.err: at okio.RealBufferedSource.readUtf8(RealBufferedSource.java:188)
W/System.err: at com.androidnetworking.common.ANRequest.parseNetworkError(ANRequest.java:671)
W/System.err: at com.androidnetworking.utils.Utils.getErrorForServerResponse(Utils.java:226)
W/System.err: at com.androidnetworking.internal.InternalRunnable.executeDownloadRequest(InternalRunnable.java:110)
W/System.err: at com.androidnetworking.internal.InternalRunnable.run(InternalRunnable.java:58)
W/System.err: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
W/System.err: at com.androidnetworking.core.PriorityThreadFactory$1.run(PriorityThreadFactory.java:47)
W/System.err: at java.lang.Thread.run(Thread.java:919)
Code
private void download() {
String url = "https://proxy-25.sg1.dailymotion.com/sec"
+ "(dBG4yhTDGt8s-xJL9sczH_7xepHY7fASsEf--yb2hurT6QGlS77UybPsDxeGgwnIJAX0byvcREo9Wni"
+ "-vBKPqA)/video/773/458/493854377_mp4_h264_aac_ld.mp4";
File folder = new File(Environment.getExternalStoragePublicDirectory("") + "/DownloadFiles");
File f = new File(folder + File.separator + "status");
AndroidNetworking.download(url, f.getAbsolutePath(), "video" + ".mp4")
.setTag("tag")
.setPriority(Priority.MEDIUM)
.build()
.setDownloadProgressListener(new DownloadProgressListener() {
@Override
public void onProgress(long bytesDownloaded, long totalBytes) {
Log.d("downloading", "downloaded:" + bytesDownloaded + " total:" + totalBytes);
}
}).startDownload(new DownloadListener() {
@Override
public void onDownloadComplete() {
}
@Override
public void onError(ANError anError) {
Log.d("error", "error" + anError);
}
});
}
Solution
Try to add Cookies for current Video session
because Dailymotion video M3u8/Mp4 Link not work without Cookies for current session
Answered By - Hannan Shahid
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.