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);
}
});
}
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();
}
});
}
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);
}
});
}
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);
}
});
}
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执行查看下....");
}
}
Aggregations