Search in sources :

Example 1 with DrawPadBitmapRunnable

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

the class ExecuteCanvasLayerActivity method testDrawPadExecute.

private void testDrawPadExecute() {
    if (isExecuting)
        return;
    isExecuting = true;
    /**
     * 设置宽高,时长, 帧率,码率, 目标文件路径
     * 这里设置的的时长是5秒钟.
     */
    mDrawPad = new DrawPadBitmapRunnable(getApplicationContext(), 480, 480, 5 * 1000, 25, 1000 * 1024, dstPath);
    mDrawPad.setDrawPadProgressListener(new onDrawPadProgressListener() {

        // currentTimeUs是当前时间戳,单位是微妙,可以根据时间戳/(MediaInfo.vDuration*1000000)来得到当前进度百分比.
        @Override
        public void onProgress(DrawPad v, long currentTimeUs) {
            // TODO Auto-generated method stub
            tvProgressHint.setText(String.valueOf(currentTimeUs));
        }
    });
    /**
     * 处理完毕后的监听
     */
    mDrawPad.setDrawPadCompletedListener(new onDrawPadCompletedListener() {

        @Override
        public void onCompleted(DrawPad v) {
            // TODO Auto-generated method stub
            tvProgressHint.setText("DrawPadExecute Completed!!!");
            isExecuting = false;
            if (SDKFileUtils.fileExist(dstPath)) {
                findViewById(R.id.id_video_edit_btn2).setEnabled(true);
            }
        }
    });
    mDrawPad.setDrawpadOutFrameListener(480, 480, 1, new onDrawPadOutFrameListener() {

        @Override
        public void onDrawPadOutFrame(DrawPad v, Object obj, int type, long ptsUs) {
        // TODO Auto-generated method stub
        }
    });
    startDrawPad();
}
Also used : DrawPadBitmapRunnable(com.lansosdk.box.DrawPadBitmapRunnable) com.lansosdk.box.onDrawPadOutFrameListener(com.lansosdk.box.onDrawPadOutFrameListener) DrawPad(com.lansosdk.box.DrawPad) com.lansosdk.box.onDrawPadProgressListener(com.lansosdk.box.onDrawPadProgressListener) com.lansosdk.box.onDrawPadCompletedListener(com.lansosdk.box.onDrawPadCompletedListener)

Aggregations

DrawPad (com.lansosdk.box.DrawPad)1 DrawPadBitmapRunnable (com.lansosdk.box.DrawPadBitmapRunnable)1 com.lansosdk.box.onDrawPadCompletedListener (com.lansosdk.box.onDrawPadCompletedListener)1 com.lansosdk.box.onDrawPadOutFrameListener (com.lansosdk.box.onDrawPadOutFrameListener)1 com.lansosdk.box.onDrawPadProgressListener (com.lansosdk.box.onDrawPadProgressListener)1