MSDK4.15,M210 RTK V2 采用自定义RTK,mediaFile.fetchFileData方法下载...

Completed

Comments

2 comments

  • smallUniv
    mediaFile.fetchFileData(destDir, name, new DownloadListener<String>() {
    @Override
    public void onStart() {

    }

    @Override
    public void onRateUpdate(long total, long current, long persize) {
    }

    @Override
    public void onRealtimeDataUpdate(byte[] bytes, long l, boolean b) {

    }

    @Override
    public void onProgress(long total, long current) {
    double progress = (current+0.0) / total;
    photoFile.setDownloadProgress(progress);
    //FileLog.i(TAG,name+" "+String.format(" %.3f ",progress)+" "+current+"/"+total);
    }

    @Override
    public void onSuccess(String s) {
    long endTime=System.currentTimeMillis();
    float excTime=(float)(endTime-startTime)/1000;
    System.out.println("执行时间:"+excTime+"s");
    Log.i(TAG,name+" 执行时间: "+excTime);

    photoFile.setDownloading(false);
    photoFile.setDownDone(true);
    Log.i(TAG,"The file has been stored, its path is " + s);
    FileLog.i(TAG,"图像"+photoFile.getName()+"下载到遥控器完成"+"。执行时间:"+excTime+"s");
    //ToastUtils.setResultToToast("The file has been stored, its path is " + s);
    File file = new File(photoFile.url);
    if (file.exists()){
    try {
    long size = getFileSize(file);
    photoFile.setFileSizeRC(size);
    if (size == photoFile.fileSizeUav){
    photoFile.setDownSuccess(true);
    FileLog.i(TAG,"图像"+photoFile.getName()+"下载到遥控器成功");
    }else {
    FileLog.i(TAG,"图像"+photoFile.getName()+"下载到遥控器完成但失败");
    }
    } catch (Exception e) {
    e.printStackTrace();
    }
    }
    }

    @Override
    public void onFailure(DJIError djiError) {
    FileLog.i(TAG,""+(djiError==null?"":djiError.getDescription()));
    photoFile.setDownloading(false);
    FileLog.i(TAG,"图像"+photoFile.getName()+"下载到遥控器完成但失败");
    }
    });
    0
    Comment actions Permalink
  • DJI Developer Support
    可能是图传链路的一些问题导致下载中断或者卡住,也确实没有办法取消下载。你可以试试fetchFileByteData,这个类似于断电续传,可以在上次的停电继续下载。 Link:https://developer.dji.com/api-reference/android-api/Components/Camera/DJIMediaManager_DJIMedia.html#djimediamanager_djimedia_fetchfilebytedata_inline
    0
    Comment actions Permalink

Please sign in to leave a comment.