示例#1
0
 private void renderVideo() {
   File exportFile = mMPM.getExportMediaFile();
   boolean compress = mSettings.getBoolean("pcompress", false); // compress
   boolean doOverwrite = true;
   try {
     MediaDesc mdExported = mMPM.doExportMedia(exportFile, compress, doOverwrite);
     jobSucceeded(mdExported.path);
   } catch (Exception e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
     jobFailed(e, 0, e.getMessage());
   }
 }
  private void exportProjectFiles() {
    try {
      File fileProjectSrc =
          MediaProjectManager.getExternalProjectFolder(mMPM.mProject, mMPM.getContext());
      ArrayList<File> fileList = new ArrayList<File>();
      String mZipFileName = buildZipFilePath(fileProjectSrc.getAbsolutePath());

      // if not enough space
      if (mMPM.checkStorageSpace() > 0) {
        return;
      }

      String[] mMediaPaths = mMPM.mProject.getMediaAsPathArray();

      // add videos
      for (String path : mMediaPaths) {
        fileList.add(new File(path));
      }

      // add thumbnails
      fileList.addAll(Arrays.asList(fileProjectSrc.listFiles()));

      // add database file
      fileList.add(getDatabasePath("sm.db"));

      FileOutputStream fos = new FileOutputStream(mZipFileName);
      ZipOutputStream zos = new ZipOutputStream(fos);

      exportProjectFiles(zos, fileList.toArray(new File[fileList.size()]));

      zos.close();

      onExportProjectSuccess(mZipFileName);
    } catch (IOException ioe) {
      Timber.e(ioe, "Error creating zip file:");
    }
  }