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();
}
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();
}
});
}
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);
}
});
}
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);
}
});
}
Aggregations