protected void installXuggler(ActionRequest actionRequest, ActionResponse actionResponse)
      throws Exception {

    ProgressTracker progressTracker =
        new ProgressTracker(actionRequest, WebKeys.XUGGLER_INSTALL_STATUS);

    progressTracker.addProgress(ProgressStatusConstants.DOWNLOADING, 15, "downloading-xuggler");
    progressTracker.addProgress(ProgressStatusConstants.COPYING, 70, "copying-xuggler-files");

    progressTracker.initialize();

    String jarName = ParamUtil.getString(actionRequest, "jarName");

    try {
      XugglerUtil.installNativeLibraries(jarName, progressTracker);

      JSONObject jsonObject = JSONFactoryUtil.createJSONObject();

      jsonObject.put("success", Boolean.TRUE);

      writeJSON(actionRequest, actionResponse, jsonObject);
    } catch (Exception e) {
      JSONObject jsonObject = JSONFactoryUtil.createJSONObject();

      jsonObject.put("exception", e.getMessage());
      jsonObject.put("success", Boolean.FALSE);

      writeJSON(actionRequest, actionResponse, jsonObject);
    }

    progressTracker.finish();
  }
  @Override
  public boolean isSupported(String mimeType) {
    if (_videoMimeTypes.contains(mimeType) && XugglerUtil.isEnabled()) {
      return true;
    }

    return false;
  }
  private void _generateVideo(FileVersion sourceFileVersion, FileVersion destinationFileVersion)
      throws Exception {

    if (!XugglerUtil.isEnabled() || _hasVideo(destinationFileVersion)) {
      return;
    }

    InputStream inputStream = null;

    File[] previewTempFiles = new File[_PREVIEW_TYPES.length];

    File videoTempFile = null;

    try {
      if (sourceFileVersion != null) {
        copy(sourceFileVersion, destinationFileVersion);

        return;
      }

      File file = null;

      if (!hasPreviews(destinationFileVersion) || !hasThumbnails(destinationFileVersion)) {

        if (destinationFileVersion instanceof LiferayFileVersion) {
          try {
            LiferayFileVersion liferayFileVersion = (LiferayFileVersion) destinationFileVersion;

            file = liferayFileVersion.getFile(false);
          } catch (UnsupportedOperationException uoe) {
          }
        }

        if (file == null) {
          inputStream = destinationFileVersion.getContentStream(false);

          videoTempFile = FileUtil.createTempFile(destinationFileVersion.getExtension());

          FileUtil.write(videoTempFile, inputStream);

          file = videoTempFile;
        }
      }

      if (!hasPreviews(destinationFileVersion)) {
        String tempFileId =
            DLUtil.getTempFileId(
                destinationFileVersion.getFileEntryId(), destinationFileVersion.getVersion());

        for (int i = 0; i < _PREVIEW_TYPES.length; i++) {
          previewTempFiles[i] = getPreviewTempFile(tempFileId, _PREVIEW_TYPES[i]);
        }

        try {
          _generateVideoXuggler(destinationFileVersion, file, previewTempFiles);
        } catch (Exception e) {
          _log.error(e, e);
        }
      }

      if (!hasThumbnails(destinationFileVersion)) {
        try {
          _generateThumbnailXuggler(
              destinationFileVersion,
              file,
              PropsValues.DL_FILE_ENTRY_PREVIEW_VIDEO_HEIGHT,
              PropsValues.DL_FILE_ENTRY_PREVIEW_VIDEO_WIDTH);
        } catch (Exception e) {
          _log.error(e, e);
        }
      }
    } catch (NoSuchFileEntryException nsfee) {
      if (_log.isDebugEnabled()) {
        _log.debug(nsfee, nsfee);
      }
    } finally {
      StreamUtil.cleanUp(inputStream);

      _fileVersionIds.remove(destinationFileVersion.getFileVersionId());

      for (int i = 0; i < previewTempFiles.length; i++) {
        FileUtil.delete(previewTempFiles[i]);
      }

      FileUtil.delete(videoTempFile);
    }
  }