Search in sources :

Example 1 with DrawPadTwoVideoExecute

use of com.lansosdk.box.DrawPadTwoVideoExecute in project LanSoEditor_advance by LanSoSdk.

the class ExecuteTwoVideoLayerDemoActivity method testDrawPadExecute.

/**
 * 从这里开始演示.
 */
private void testDrawPadExecute() {
    if (isExecuting)
        return;
    String videoPath2 = "/sdcard/mask.mp4";
    isExecuting = true;
    mDrawPad = new DrawPadTwoVideoExecute(ExecuteTwoVideoLayerDemoActivity.this, videoPath, videoPath2, 544, 960, 2000000, editTmpPath);
    mDrawPad.setUseMainVideoPts(true);
    /**
     * 设置效果视频 是否循环.
     */
    mDrawPad.setEffectVideoLoop(true);
    /**
     * 设置DrawPad处理的进度监听, 回传的currentTimeUs单位是微秒.
     */
    mDrawPad.setDrawPadProgressListener(new onDrawPadProgressListener() {

        @Override
        public void onProgress(DrawPad v, long currentTimeUs) {
            // TODO Auto-generated method stub
            tvProgressHint.setText(String.valueOf(currentTimeUs));
            // 6秒后消失
            if (currentTimeUs > 6000000 && bitmapLayer != null)
                v.removeLayer(bitmapLayer);
            // 3秒的时候,放大一倍.
            if (currentTimeUs > 3000000 && bitmapLayer != null)
                bitmapLayer.setScale(2.0f);
        }
    });
    /**
     * 设置DrawPad完成后的监听.
     */
    mDrawPad.setDrawPadCompletedListener(new onDrawPadCompletedListener() {

        @Override
        public void onCompleted(DrawPad v) {
            // TODO Auto-generated method stub
            tvProgressHint.setText("DrawPadExecute Completed!!!");
            isExecuting = false;
            if (SDKFileUtils.fileExist(editTmpPath)) {
                boolean ret = VideoEditor.encoderAddAudio(videoPath, editTmpPath, SDKDir.TMP_DIR, dstPath);
                if (ret == false) {
                    dstPath = editTmpPath;
                }
            }
            findViewById(R.id.id_video_edit_btn2).setEnabled(true);
        }
    });
    // vDrawPad.setUseMainVideoPts(true);
    mDrawPad.pauseRecordDrawPad();
    /**
     * 开始执行这个DrawPad
     */
    if (mDrawPad.startDrawPad()) {
        addLayers();
    } else {
        Log.e(TAG, "后台容器线程  运行失败,您请检查下是否是路径设置有无, 请用MediaInfo.checkFile执行查看下....");
    }
}
Also used : DrawPad(com.lansosdk.box.DrawPad) DrawPadTwoVideoExecute(com.lansosdk.box.DrawPadTwoVideoExecute) com.lansosdk.box.onDrawPadProgressListener(com.lansosdk.box.onDrawPadProgressListener) com.lansosdk.box.onDrawPadCompletedListener(com.lansosdk.box.onDrawPadCompletedListener)

Aggregations

DrawPad (com.lansosdk.box.DrawPad)1 DrawPadTwoVideoExecute (com.lansosdk.box.DrawPadTwoVideoExecute)1 com.lansosdk.box.onDrawPadCompletedListener (com.lansosdk.box.onDrawPadCompletedListener)1 com.lansosdk.box.onDrawPadProgressListener (com.lansosdk.box.onDrawPadProgressListener)1