public void action() {
    Uri uri = mItem.getUri();

    if (uri == null) {
      showToast("Please select a valid video file first");

      return;
    }

    mItem.stopVideoView();

    int segmentFrom = mItem.getSegmentFrom();
    int segmentTo = mItem.getSegmentTo();

    Intent intent = new Intent();
    intent.setClass(this, ComposerCutCoreActivity.class);

    Bundle b = new Bundle();
    b.putString("srcMediaName1", mItem.getMediaFileName());
    intent.putExtras(b);
    b.putString("dstMediaPath", mItem.genDstPath(mItem.getMediaFileName(), "segment"));
    intent.putExtras(b);
    b.putLong("segmentFrom", segmentFrom);
    intent.putExtras(b);
    b.putLong("segmentTo", segmentTo);
    intent.putExtras(b);
    b.putString("srcUri1", uri.getString());
    intent.putExtras(b);

    startActivity(intent);
  }
Пример #2
0
  public void setMediaUri(com.intel.inde.mp.Uri uri) {
    int visibility = (uri == null) ? View.INVISIBLE : View.VISIBLE;

    if (mEnableSegmentPicker) {
      mSegmentSelector.setVisibility(visibility);
    }

    mDeleteButton.setVisibility(visibility);
    mTitleText.setVisibility(visibility);
    mDurationText.setVisibility(visibility);
    mVideoView.setVisibility(visibility);

    if (uri == null) {
      mediaFileName = null;

      mVideoDuration = 0;
      mVideoPosition = 0;

      postInvalidate();

      return;
    }

    try {
      mMediaInfo.setUri(uri);
    } catch (Exception ex) {
      throw new IllegalArgumentException("Unsupported media file format");
    }

    mVideoDuration = mMediaInfo.getDurationInMicroSec();
    mVideoPosition = (mVideoDuration / 2);

    mVideoView.setVideoURI(Uri.parse(uri.getString()));

    String duration = Format.duration(mVideoDuration / 1000);

    mTitleText.setText(mediaFileName);
    mDurationText.setText(duration);

    mSegmentSelector.setStartPosition(0);
    mSegmentSelector.setEndPosition(100);

    showPreview(10);
  }