Search in sources :

Example 16 with DrawPad

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

the class CameraLayerFullPortWithMp3Activity method initDrawPad.

/**
 * Step1: 开始运行 DrawPad 容器
 */
private void initDrawPad() {
    int padWidth = 544;
    int padHeight = 960;
    // 码率
    int bitrate = 3000 * 1024;
    /**
     * 设置录制时的一些参数.
     */
    drawPadCamera.setRealEncodeEnable(padWidth, padHeight, bitrate, (int) 25, dstPath);
    /**
     * 设置录制处理进度监听.
     */
    drawPadCamera.setOnDrawPadProgressListener(drawPadProgressListener);
    /**
     * 相机前后置.是否设置滤镜.
     */
    drawPadCamera.setCameraParam(false, null, true);
    /**
     * 当手动聚焦的时候, 返回聚焦点的位置,让focusView去显示一个聚焦的动画.
     */
    drawPadCamera.setCameraFocusListener(new doFousEventListener() {

        @Override
        public void onFocus(int x, int y) {
            focusView.startFocus(x, y);
        }
    });
    /**
     * UI界面有效后, 开始开启DrawPad线程, 来预览画面.
     */
    drawPadCamera.setOnViewAvailable(new onViewAvailable() {

        @Override
        public void viewAvailable(DrawPadCameraView v) {
            startDrawPad();
        }
    });
    drawPadCamera.setOnDrawPadErrorListener(new onDrawPadErrorListener() {

        @Override
        public void onError(DrawPad d, int what) {
            Log.e(TAG, "DrawPad容器线程运行出错!!!" + what);
        }
    });
}
Also used : DrawPad(com.lansosdk.box.DrawPad) DrawPadCameraView(com.lansosdk.videoeditor.DrawPadCameraView) DrawPadCameraView.doFousEventListener(com.lansosdk.videoeditor.DrawPadCameraView.doFousEventListener) DrawPadCameraView.onViewAvailable(com.lansosdk.videoeditor.DrawPadCameraView.onViewAvailable) com.lansosdk.box.onDrawPadErrorListener(com.lansosdk.box.onDrawPadErrorListener)

Example 17 with DrawPad

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

the class CameraLayerKTVDemoActivity method initDrawPad.

/**
 * Step1: 开始运行 DrawPad 容器
 */
private void initDrawPad() {
    // 因手机屏幕是16:9;全屏模式,建议分辨率设置为960x544;
    int padWidth = 960;
    int padHeight = 544;
    int bitrate = 3000 * 1024;
    int frameRate = 25;
    drawPadCamera.setRealEncodeEnable(padWidth, padHeight, bitrate, frameRate, dstPath);
    /**
     * 设置进度回调
     */
    drawPadCamera.setOnDrawPadProgressListener(drawPadProgressListener);
    drawPadCamera.setOnDrawPadThreadProgressListener(new onDrawPadThreadProgressListener() {

        @Override
        public void onThreadProgress(DrawPad v, long currentTimeUs) {
            // 如果第二个视频要切换
            if (isChangedVideo) {
                // 重新增加这个图层.
                drawPadCamera.removeLayer(currentLayer);
                currentLayer = null;
                currentLayer = drawPadCamera.addVideoLayer(videoWidth, videoHeight, null);
                drawPadCamera.changeLayerPosition(currentLayer, 0);
                if (vplayer2 != null) {
                    vplayer2.setSurface(new Surface(currentLayer.getVideoTexture()));
                    vplayer2.start();
                } else if (vplayer3 != null) {
                    vplayer3.setSurface(new Surface(currentLayer.getVideoTexture()));
                    vplayer3.start();
                }
                isChangedVideo = false;
            }
        }
    });
    drawPadCamera.setRecordMic(true);
    alphaPixelFilter = new LanSongAlphaPixelFilter();
    beautyFilter = new LanSongBeautyAdvanceFilter();
    // drawPadCamera.setCameraParam(false, beautyFilter,true);  //设置为美颜.
    // 设置是否前置.
    drawPadCamera.setCameraParam(false, alphaPixelFilter, true);
    drawPadCamera.setOnViewAvailable(new onViewAvailable() {

        @Override
        public void viewAvailable(DrawPadCameraView v) {
            startDrawPad();
        }
    });
}
Also used : DrawPad(com.lansosdk.box.DrawPad) LanSongAlphaPixelFilter(com.lansosdk.box.LanSongAlphaPixelFilter) DrawPadCameraView(com.lansosdk.videoeditor.DrawPadCameraView) DrawPadCameraView.onViewAvailable(com.lansosdk.videoeditor.DrawPadCameraView.onViewAvailable) com.lansosdk.box.onDrawPadThreadProgressListener(com.lansosdk.box.onDrawPadThreadProgressListener) Paint(android.graphics.Paint) LanSongBeautyAdvanceFilter(jp.co.cyberagent.lansongsdk.gpuimage.LanSongBeautyAdvanceFilter) Surface(android.view.Surface)

Example 18 with DrawPad

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

the class CameraSubLayerDemo1Activity method initDrawPad.

/**
 * Step1: 开始运行 DrawPad 容器
 */
private void initDrawPad() {
    int padWidth = 544;
    int padHeight = 960;
    /**
     * 设置录制时的一些参数.
     */
    mDrawPadCamera.setRealEncodeEnable(padWidth, padHeight, 3000 * 1024, (int) 25, dstPath);
    /**
     * 录制的同时,录制外面的声音.
     */
    mDrawPadCamera.setRecordMic(true);
    /**
     * 设置录制处理进度监听.
     */
    mDrawPadCamera.setOnDrawPadProgressListener(drawPadProgressListener);
    /**
     * 相机前后置.是否设置滤镜.
     */
    mDrawPadCamera.setCameraParam(false, null, true);
    /**
     * 当手动聚焦的时候, 返回聚焦点的位置,让focusView去显示一个聚焦的动画.
     */
    mDrawPadCamera.setCameraFocusListener(new doFousEventListener() {

        @Override
        public void onFocus(int x, int y) {
            // TODO Auto-generated method stub
            focusView.startFocus(x, y);
        }
    });
    /**
     * UI界面有效后, 开始开启DrawPad线程, 来预览画面.
     */
    mDrawPadCamera.setOnViewAvailable(new onViewAvailable() {

        @Override
        public void viewAvailable(DrawPadCameraView v) {
            // TODO Auto-generated method stub
            startDrawPad();
        }
    });
    mDrawPadCamera.setOnDrawPadErrorListener(new onDrawPadErrorListener() {

        @Override
        public void onError(DrawPad d, int what) {
            // TODO Auto-generated method stub
            Log.e(TAG, "DrawPad容器线程运行出错!!!" + what);
        }
    });
}
Also used : DrawPad(com.lansosdk.box.DrawPad) DrawPadCameraView(com.lansosdk.videoeditor.DrawPadCameraView) DrawPadCameraView.doFousEventListener(com.lansosdk.videoeditor.DrawPadCameraView.doFousEventListener) DrawPadCameraView.onViewAvailable(com.lansosdk.videoeditor.DrawPadCameraView.onViewAvailable) com.lansosdk.box.onDrawPadErrorListener(com.lansosdk.box.onDrawPadErrorListener)

Example 19 with DrawPad

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

the class CameraSubLayerDemo2Activity method initDrawPad.

/**
 * Step1: 开始运行 DrawPad 容器
 */
private void initDrawPad() {
    int padWidth = 544;
    int padHeight = 960;
    /**
     * 设置录制时的一些参数.
     */
    mDrawPadCamera.setRealEncodeEnable(padWidth, padHeight, 3000 * 1024, (int) 25, dstPath);
    /**
     * 录制的同时,录制外面的声音.
     */
    mDrawPadCamera.setRecordMic(true);
    /**
     * 设置录制处理进度监听.
     */
    mDrawPadCamera.setOnDrawPadProgressListener(drawPadProgressListener);
    /**
     * 相机前后置.是否设置滤镜.
     */
    mDrawPadCamera.setCameraParam(false, new LanSongBlurFilter(), true);
    /**
     * 当手动聚焦的时候, 返回聚焦点的位置,让focusView去显示一个聚焦的动画.
     */
    mDrawPadCamera.setCameraFocusListener(new doFousEventListener() {

        @Override
        public void onFocus(int x, int y) {
            // TODO Auto-generated method stub
            focusView.startFocus(x, y);
        }
    });
    /**
     * UI界面有效后, 开始开启DrawPad线程, 来预览画面.
     */
    mDrawPadCamera.setOnViewAvailable(new onViewAvailable() {

        @Override
        public void viewAvailable(DrawPadCameraView v) {
            // TODO Auto-generated method stub
            startDrawPad();
        }
    });
    mDrawPadCamera.setOnDrawPadErrorListener(new onDrawPadErrorListener() {

        @Override
        public void onError(DrawPad d, int what) {
            // TODO Auto-generated method stub
            Log.e(TAG, "DrawPad容器线程运行出错!!!" + what);
        }
    });
}
Also used : DrawPad(com.lansosdk.box.DrawPad) DrawPadCameraView(com.lansosdk.videoeditor.DrawPadCameraView) DrawPadCameraView.doFousEventListener(com.lansosdk.videoeditor.DrawPadCameraView.doFousEventListener) DrawPadCameraView.onViewAvailable(com.lansosdk.videoeditor.DrawPadCameraView.onViewAvailable) LanSongBlurFilter(jp.co.cyberagent.lansongsdk.gpuimage.LanSongBlurFilter) com.lansosdk.box.onDrawPadErrorListener(com.lansosdk.box.onDrawPadErrorListener)

Example 20 with DrawPad

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

the class ExecuteAllDrawpadActivity method startDrawPad.

/**
 * 从这里开始演示.
 */
private void startDrawPad() {
    if (isExecuting)
        return;
    isExecuting = true;
    /**
     * @param ctx
     * @param padwidth 容器宽度/生成视频的宽度
     * @param padheight 容器高度/生成视频的高度
     * @param framerate  生成视频的帧率
     * @param bitrate   生成视频的码率
     * @param dstPath   生成视频保存的完整路径 .mp4结尾.
     */
    mDrawPad = new DrawPadAllExecute(mContext, 480, 480, 25, 1000 * 1000, dstPath);
    /**
     * 设置错误监听
     */
    mDrawPad.setDrawPadErrorListener(new onDrawPadErrorListener() {

        @Override
        public void onError(DrawPad d, int what) {
            mDrawPad.stopDrawPad();
            Log.e(TAG, "后台容器线程 运行失败,您请检查下是否码率分辨率设置过大,或者联系我们!...");
        }
    });
    /**
     * 设置DrawPad处理的进度监听, 回传的currentTimeUs单位是微秒.
     */
    mDrawPad.setDrawPadProgressListener(new onDrawPadProgressListener() {

        @Override
        public void onProgress(DrawPad v, long currentTimeUs) {
            tvProgressHint.setText(String.valueOf(currentTimeUs));
            if (currentTimeUs > 18 * 1000 * 1000) {
                // 18秒的时候停止.
                mDrawPad.stopDrawPad();
            } else if (currentTimeUs > 15 * 1000 * 1000) {
                // 显示第4个图层.
                showFourLayer();
            } else if (currentTimeUs > 8 * 1000 * 1000 && videoLayer2 == null) {
                // 8秒的时候增加一个视频图层
                showThreeLayer(currentTimeUs);
            } else if (currentTimeUs > 3 * 1000 * 1000 && bmpLayer == null) {
                // 3秒的时候, 增加图片图层
                showSecondLayer(currentTimeUs);
            }
        }
    });
    /**
     * 设置DrawPad完成后的监听.
     */
    mDrawPad.setDrawPadCompletedListener(new onDrawPadCompletedListener() {

        @Override
        public void onCompleted(DrawPad v) {
            tvProgressHint.setText("DrawPadExecute Completed!!!");
            isExecuting = false;
            findViewById(R.id.id_video_edit_btn2).setEnabled(true);
        }
    });
    /**
     * 开始执行这个DrawPad
     */
    if (mDrawPad.startDrawPad()) {
        // 增加背景图片
        mDrawPad.addBitmapLayer(BitmapFactory.decodeResource(getResources(), R.drawable.pad_bg), null);
        // 增加第一个视频
        videoLayer1 = mDrawPad.addVideoLayer(videoPath, null);
    } else {
        Log.e(TAG, "后台容器线程  运行失败,您请检查下是否是路径设置有无, 请用MediaInfo.checkFile执行查看下....");
    }
}
Also used : DrawPad(com.lansosdk.box.DrawPad) com.lansosdk.box.onDrawPadErrorListener(com.lansosdk.box.onDrawPadErrorListener) com.lansosdk.box.onDrawPadProgressListener(com.lansosdk.box.onDrawPadProgressListener) com.lansosdk.box.onDrawPadCompletedListener(com.lansosdk.box.onDrawPadCompletedListener) Paint(android.graphics.Paint) DrawPadAllExecute(com.lansosdk.box.DrawPadAllExecute)

Aggregations

DrawPad (com.lansosdk.box.DrawPad)28 com.lansosdk.box.onDrawPadProgressListener (com.lansosdk.box.onDrawPadProgressListener)16 com.lansosdk.box.onDrawPadSizeChangedListener (com.lansosdk.box.onDrawPadSizeChangedListener)10 Paint (android.graphics.Paint)9 com.lansosdk.box.onDrawPadCompletedListener (com.lansosdk.box.onDrawPadCompletedListener)9 com.lansosdk.box.onDrawPadThreadProgressListener (com.lansosdk.box.onDrawPadThreadProgressListener)9 com.lansosdk.box.onDrawPadErrorListener (com.lansosdk.box.onDrawPadErrorListener)7 DrawPadCameraView (com.lansosdk.videoeditor.DrawPadCameraView)5 DrawPadCameraView.onViewAvailable (com.lansosdk.videoeditor.DrawPadCameraView.onViewAvailable)5 MediaInfo (com.lansosdk.videoeditor.MediaInfo)5 DrawPadCameraView.doFousEventListener (com.lansosdk.videoeditor.DrawPadCameraView.doFousEventListener)4 com.lansosdk.box.onDrawPadOutFrameListener (com.lansosdk.box.onDrawPadOutFrameListener)3 DrawPadVideoExecute (com.lansosdk.videoeditor.DrawPadVideoExecute)3 Bitmap (android.graphics.Bitmap)2 DrawPadView (com.lansosdk.videoeditor.DrawPadView)2 DrawPadView.onViewAvailable (com.lansosdk.videoeditor.DrawPadView.onViewAvailable)2 DialogInterface (android.content.DialogInterface)1 Surface (android.view.Surface)1 OnClickListener (android.view.View.OnClickListener)1 DrawPadAllExecute (com.lansosdk.box.DrawPadAllExecute)1