Search in sources :

Example 6 with DrawPadCameraView

use of com.lansosdk.videoeditor.DrawPadCameraView in project LanSoEditor_advance by LanSoSdk.

the class CameraLayerFullPortWithMp3Activity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // 全屏模式下, 隐藏底部的虚拟按键.
    LanSongUtil.hideBottomUIMenu(this);
    mContext = getApplicationContext();
    if (LanSongUtil.checkRecordPermission(getBaseContext()) == false) {
        Toast.makeText(getApplicationContext(), "当前无权限,请打开权限后,重试!!!", Toast.LENGTH_LONG).show();
        finish();
    }
    setContentView(R.layout.camera_fullport_mp3_layout);
    drawPadCamera = (DrawPadCameraView) findViewById(R.id.id_fullrecord_padview);
    initView();
    btnRecord.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (drawPadCamera != null) {
                /**
                 * 这里只是暂停和恢复录制, 可以录制多段,但不可以删除录制好的每一段,
                 * 如果你要分段录制,并支持回删,则可以采用SegmentStart和SegmentStop;
                 */
                if (drawPadCamera.isRecording()) {
                    drawPadCamera.pauseRecord();
                } else {
                    /**
                     * 把用户选择好的歌曲,设置到drawpad容器中, 开始录制.
                     */
                    String music = CopyFileFromAssets.copyAssets(getApplicationContext(), "c_li_c_li_2m8s.mp3");
                    audioLine = drawPadCamera.setRecordExtraMp3(music, true);
                    drawPadCamera.startRecord();
                }
            }
        }
    });
    dstPath = SDKFileUtils.newMp4PathInBox();
    // 开始录制.
    initDrawPad();
}
Also used : OnClickListener(android.view.View.OnClickListener) ImageView(android.widget.ImageView) View(android.view.View) DrawPadCameraView(com.lansosdk.videoeditor.DrawPadCameraView) TextView(android.widget.TextView) FaceView(com.example.advanceDemo.view.FaceView) FocusImageView(com.example.advanceDemo.view.FocusImageView) DrawPadView(com.lansosdk.videoeditor.DrawPadView)

Example 7 with DrawPadCameraView

use of com.lansosdk.videoeditor.DrawPadCameraView 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 8 with DrawPadCameraView

use of com.lansosdk.videoeditor.DrawPadCameraView 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 9 with DrawPadCameraView

use of com.lansosdk.videoeditor.DrawPadCameraView 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)

Aggregations

DrawPadCameraView (com.lansosdk.videoeditor.DrawPadCameraView)9 DrawPadCameraView.onViewAvailable (com.lansosdk.videoeditor.DrawPadCameraView.onViewAvailable)7 DrawPad (com.lansosdk.box.DrawPad)5 DrawPadCameraView.doFousEventListener (com.lansosdk.videoeditor.DrawPadCameraView.doFousEventListener)5 com.lansosdk.box.onDrawPadErrorListener (com.lansosdk.box.onDrawPadErrorListener)4 View (android.view.View)2 TextView (android.widget.TextView)2 DrawPadView (com.lansosdk.videoeditor.DrawPadView)2 Paint (android.graphics.Paint)1 DisplayMetrics (android.util.DisplayMetrics)1 MotionEvent (android.view.MotionEvent)1 Surface (android.view.Surface)1 OnClickListener (android.view.View.OnClickListener)1 OnTouchListener (android.view.View.OnTouchListener)1 ImageView (android.widget.ImageView)1 FaceView (com.example.advanceDemo.view.FaceView)1 FocusImageView (com.example.advanceDemo.view.FocusImageView)1 VideoFocusView (com.example.advanceDemo.view.VideoFocusView)1 VideoProgressView (com.example.advanceDemo.view.VideoProgressView)1 LanSongAlphaPixelFilter (com.lansosdk.box.LanSongAlphaPixelFilter)1