Beispiel #1
0
  private void setVideoCover(double time) {

    ivDone.setEnabled(true);
    ivUndo.setEnabled(true);
    flCoverSetted.setVisibility(View.VISIBLE);
    ivCover.setVisibility(View.GONE);
    videoCoverTime = time;
    thumbBmp =
        mMediaPlayer.videScreenCapture(
            videoCoverTime,
            EffectType.EFFECT_VIDEO_DEFAULT_WIDTH,
            EffectType.EFFECT_VIDEO_DEFAULT_WIDTH);
    if (android.os.Build.MODEL.equalsIgnoreCase("GT-N7100")
        || android.os.Build.MODEL.equalsIgnoreCase("GT-I9300")
        || android.os.Build.MODEL.equals("GT-I9220")
        || android.os.Build.MODEL.startsWith("GT-I9100")) {
      Mp4Info info = new Mp4Info(curVideoPath);
      thumbBmp = ZGraphics.rotate(thumbBmp, info.angle, true);
    }
    curAngle = mMediaPlayer.getCurrentOrientation();
    Log.d(TAG, "setVideoCover time = " + time + " curAngle = " + curAngle);
    Bitmap bmp = BitmapUtils.rotate(thumbBmp, (360 - curAngle) % 360, true);
    ivCoverSetted.setImageBitmap(bmp);

    OperateNote operate = new OperateNote();
    operate.operateType = OPERATE_COVER;
    operate.videoPath = curVideoPath;
    operate.angle = curAngle;
    operate.coverTime = videoCoverTime;
    operateNotesList.add(operate);
  }
Beispiel #2
0
  public void revocateRotate() {
    int oritation = mMediaPlayer.getCurrentOrientation();
    Log.i(TAG, "rotation:" + oritation);
    int newOritation = XGLLayer.ORIENTATION_0;
    if (oritation == XGLLayer.ORIENTATION_0) {
      newOritation = XGLLayer.ORIENTATION_90;
    } else if (oritation == XGLLayer.ORIENTATION_270) {
      newOritation = XGLLayer.ORIENTATION_0;
    } else if (oritation == XGLLayer.ORIENTATION_180) {
      newOritation = XGLLayer.ORIENTATION_270;
    } else if (oritation == XGLLayer.ORIENTATION_90) {
      newOritation = XGLLayer.ORIENTATION_180;
    }
    mMediaPlayer.setCurrentOrientatin(newOritation);

    curAngle = mMediaPlayer.getCurrentOrientation();
    Bitmap bmp = BitmapUtils.rotate(thumbBmp, (360 - curAngle) % 360, true);
    ivCoverSetted.setImageBitmap(bmp);

    ivVideoCover.setImageBitmap(BitmapUtils.rotate(videoCoverBmp, (360 - curAngle) % 360, true));
  }
Beispiel #3
0
 @Override
 protected void onDestroy() {
   // TODO Auto-generated method stub
   Log.d(TAG, "onDestory in");
   try {
     if (mMediaPlayer != null) {
       mMediaPlayer.release();
       mEffects.release();
       mMediaPlayer = null;
       mEffects = null;
       isPlayerNeedToPlay = false;
       isPlayerPrepared = false;
     }
     BitmapUtils.releaseBmp(videoCoverBmp);
     BitmapUtils.releaseBmp(thumbBmp);
     BitmapUtils.releaseBmps(mBmps);
   } catch (Exception e) {
     e.printStackTrace();
   }
   super.onDestroy();
 }
Beispiel #4
0
 @Override
 public void OnFinishPlayer(XMediaPlayer player) {
   Log.e(TAG, "OnFinishPlayer");
   ivPlay.setVisibility(View.VISIBLE);
   //			ivPlay.setImageResource(R.drawable.play);
   ivVideoCover.setVisibility(View.VISIBLE);
   if (mMediaPlayer != null) {
     curAngle = mMediaPlayer.getCurrentOrientation();
   }
   ivVideoCover.setImageBitmap(BitmapUtils.rotate(videoCoverBmp, (360 - curAngle) % 360, true));
   //			onClick(rlVideoContent);
 }
Beispiel #5
0
 private void revocateVideoCover(double time) {
   flCoverSetted.setVisibility(View.VISIBLE);
   ivCover.setVisibility(View.GONE);
   videoCoverTime = time;
   thumbBmp =
       mMediaPlayer.videScreenCapture(
           videoCoverTime,
           EffectType.EFFECT_VIDEO_DEFAULT_WIDTH,
           EffectType.EFFECT_VIDEO_DEFAULT_WIDTH);
   curAngle = mMediaPlayer.getCurrentOrientation();
   Bitmap bmp = BitmapUtils.rotate(thumbBmp, (360 - curAngle) % 360, true);
   ivCoverSetted.setImageBitmap(bmp);
 }
Beispiel #6
0
  @Override
  public void onClick(View view) {
    // TODO Auto-generated method stub
    switch (view.getId()) {
      case R.id.fl_edit_diary_video:
      case R.id.iv_video_play:
        int status = mMediaPlayer.getStatus();
        if (status == XEffectMediaPlayer.STATUS_UNKNOW
            || status == XEffectMediaPlayer.STATUS_STOP
            || status == XEffectMediaPlayer.STATUS_OPENED) {
          if (status == XEffectMediaPlayer.STATUS_UNKNOW) {
            if (curVideoPath != null) {
              isPlayerPrepared = false;
              mMediaPlayer.open(curVideoPath);
            }
          }
          if (isPlayerPrepared) {
            mMediaPlayer.play();
            //					hidePlayBtn();
            if (startMontageTime > 0.1) {
              mMediaPlayer.seek(startMontageTime);
            }
            ivVideoCover.setVisibility(View.GONE);
          } else {
            isPlayerNeedToPlay = true;
          }
        } else if (mMediaPlayer.getStatus() == XEffectMediaPlayer.STATUS_PALYING) {
          mMediaPlayer.pause();
          //				ivPlay.setImageResource(R.drawable.play);
          ivPlay.setVisibility(View.VISIBLE);
          montageView.postInvalidate();
          //				hidePlayBtn();
        } else if (mMediaPlayer.getStatus() == XEffectMediaPlayer.STATUS_PAUSE) {
          mMediaPlayer.resume();
          ivPlay.setVisibility(View.INVISIBLE);
          //				ivPlay.setImageResource(R.drawable.zanting);
          //				hidePlayBtn();
        }
        break;
      case R.id.iv_edit_video_save:
        montageVideo(curVideoPath, false);
        montageOriginalVideo(curOriginalVideoPath, false);
        // 2014-4-8
        CmmobiClickAgentWrapper.onEvent(
            this, "keep_selection", DiaryEditPreviewActivity.isFromShootting ? "2" : "1");
        break;
      case R.id.iv_edit_video_delete:
        montageVideo(curVideoPath, true);
        montageOriginalVideo(curOriginalVideoPath, true);
        // 2014-4-8
        CmmobiClickAgentWrapper.onEvent(
            this, "cut_selection", DiaryEditPreviewActivity.isFromShootting ? "2" : "1");
        break;
      case R.id.iv_edit_diary_back:
        deleteAllCacheFile();
        finish();
        break;
      case R.id.iv_edit_diary_save:
        modifyDiary();
        break;
      case R.id.iv_edit_diary_undo:
        processUndo();
        break;
      case R.id.fl_edit_video_cover_setted:
        flCoverSetted.setVisibility(View.GONE);
        ivCover.setVisibility(View.VISIBLE);
        thumbBmp = null;
        ivCoverSetted.setImageBitmap(null);
        removeCoverOperate();
        if (operateNotesList.size() == 0) {
          ivDone.setEnabled(false);
        }
        break;
      case R.id.iv_edit_video_cover:
        setVideoCover(mMediaPlayer.getCurrentTime());
        // 2014-4-8
        CmmobiClickAgentWrapper.onEvent(
            this, "cover", DiaryEditPreviewActivity.isFromShootting ? "2" : "1");
        break;
        //		case R.id.video_view:
        //			ivPlay.setVisibility(View.VISIBLE);
        //			hidePlayBtn();
        //			break;
      case R.id.iv_edit_video_rotate:
        changeRotation();
        // 2014-4-8
        CmmobiClickAgentWrapper.onEvent(
            this, "spin", DiaryEditPreviewActivity.isFromShootting ? "2" : "1");
        curAngle = mMediaPlayer.getCurrentOrientation();
        OperateNote operate = new OperateNote();
        operate.operateType = OPERATE_ROTATE;
        operate.videoPath = curVideoPath;
        operate.angle = curAngle;
        operate.coverTime = videoCoverTime;
        operateNotesList.add(operate);

        Bitmap bmp = BitmapUtils.rotate(thumbBmp, (360 - curAngle) % 360, true);
        ivCoverSetted.setImageBitmap(bmp);

        //			if (ivVideoCover.getVisibility() == View.VISIBLE) {
        ivVideoCover.setImageBitmap(
            BitmapUtils.rotate(videoCoverBmp, (360 - curAngle) % 360, true));
        //			}
        break;
    }
  }