Search in sources :

Example 6 with DrawPadView

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

the class PictureSetRealTimeActivity method initDrawPad.

/**
 * Step1: 初始化DrawPad
 */
private void initDrawPad() {
    // 设置为自动刷新模式, 帧率为25
    drawPadView.setUpdateMode(DrawPadUpdateMode.AUTO_FLUSH, 30);
    // 使能实时录制,并设置录制后视频的宽度和高度, 码率, 帧率,保存路径.
    drawPadView.setRealEncodeEnable(480, 480, 1000000, (int) 30, dstPath);
    drawPadView.setOnDrawPadThreadProgressListener(new onDrawPadThreadProgressListener() {

        @Override
        public void onThreadProgress(DrawPad arg0, long arg1) {
            if (arg1 >= 1000 * 1000 && isSwitched == false) {
                bgLayer.switchBitmap(BitmapFactory.decodeFile("/sdcard/a2.jpg"));
                isSwitched = true;
            }
        }
    });
    drawPadView.setOnDrawPadCompletedListener(new DrawPadCompleted());
    drawPadView.setOnDrawPadProgressListener(new DrawPadProgressListener());
    // 设置DrawPad的宽高, 这里设置为480x480,如果您已经在xml中固定大小,则不需要再次设置,
    // 可以直接调用startDrawPad来开始录制.
    drawPadView.setDrawPadSize(480, 480, new onDrawPadSizeChangedListener() {

        @Override
        public void onSizeChanged(int viewWidth, int viewHeight) {
            // TODO Auto-generated method stub
            startDrawPad();
        }
    });
    // 这里仅仅是举例,当界面再次返回的时候,依旧显示图片更新的动画效果,即重新开始DrawPad, 很多时候是不需要这样的场景, 这里仅仅是举例
    drawPadView.setOnViewAvailable(new onViewAvailable() {

        @Override
        public void viewAvailable(DrawPadView v) {
            startDrawPad();
        }
    });
}
Also used : DrawPad(com.lansosdk.box.DrawPad) com.lansosdk.box.onDrawPadSizeChangedListener(com.lansosdk.box.onDrawPadSizeChangedListener) DrawPadView(com.lansosdk.videoeditor.DrawPadView) DrawPadView.onViewAvailable(com.lansosdk.videoeditor.DrawPadView.onViewAvailable) com.lansosdk.box.onDrawPadThreadProgressListener(com.lansosdk.box.onDrawPadThreadProgressListener) com.lansosdk.box.onDrawPadProgressListener(com.lansosdk.box.onDrawPadProgressListener)

Example 7 with DrawPadView

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

the class TextureLayerDemoActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.texturelayer_demo_layout);
    drawPadView = (DrawPadView) findViewById(R.id.id_texturelayer_drawpadview);
    findViewById(R.id.id_texturelayer_testbutton).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            selectFilter();
        }
    });
    new Handler().postDelayed(new Runnable() {

        @Override
        public void run() {
            initDrawPad();
        }
    }, 200);
}
Also used : CanvasRunnable(com.lansosdk.box.CanvasRunnable) OnClickListener(android.view.View.OnClickListener) Handler(android.os.Handler) View(android.view.View) DrawPadView(com.lansosdk.videoeditor.DrawPadView)

Example 8 with DrawPadView

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

the class TwoVideoLayerActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.twovideolayer_demo_layout);
    mVideoPath = getIntent().getStringExtra("videopath");
    mDrawPadView = (DrawPadView) findViewById(R.id.id_twovideolayer_view);
    mInfo = new MediaInfo(mVideoPath, false);
    if (mInfo.prepare() == false) {
        Toast.makeText(TwoVideoLayerActivity.this, "视频源文件错误!", Toast.LENGTH_SHORT).show();
        this.finish();
    }
    playVideo = (LinearLayout) findViewById(R.id.id_twovideolayer_saveplay);
    playVideo.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            if (SDKFileUtils.fileExist(dstPath)) {
                Intent intent = new Intent(TwoVideoLayerActivity.this, VideoPlayerActivity.class);
                intent.putExtra("videopath", dstPath);
                startActivity(intent);
            } else {
                Toast.makeText(TwoVideoLayerActivity.this, "目标文件不存在", Toast.LENGTH_SHORT).show();
            }
        }
    });
    playVideo.setVisibility(View.GONE);
    findViewById(R.id.id_twovideolayer_testbutton).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            if (twoVideoLayer != null) {
                isDisplayed = !isDisplayed;
                twoVideoLayer.setDisplayTexture2(isDisplayed);
            }
        }
    });
    // 在手机的默认路径下创建一个文件名,用来保存生成的视频文件,(在onDestroy中删除)
    editTmpPath = SDKFileUtils.newMp4PathInBox();
    dstPath = SDKFileUtils.newMp4PathInBox();
    new Handler().postDelayed(new Runnable() {

        @Override
        public void run() {
            startPlayVideo();
        }
    }, 500);
}
Also used : MediaInfo(com.lansosdk.videoeditor.MediaInfo) CanvasRunnable(com.lansosdk.box.CanvasRunnable) OnClickListener(android.view.View.OnClickListener) Handler(android.os.Handler) Intent(android.content.Intent) View(android.view.View) TextView(android.widget.TextView) DrawPadView(com.lansosdk.videoeditor.DrawPadView)

Example 9 with DrawPadView

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

the class BitmapLayerFilterDemoActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.bitmaplayer_filter_layout);
    initView();
    drawPadView = (DrawPadView) findViewById(R.id.DrawPad_view);
    // 在手机的默认路径下创建一个文件名,用来保存生成的视频文件,(在onDestroy中删除)
    dstPath = SDKFileUtils.newMp4PathInBox();
    mContext = getApplicationContext();
    findViewById(R.id.id_bitmapfilter_demo_selectbtn).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            selectFilter();
        }
    });
    AdjusterFilter = (SeekBar) findViewById(R.id.id_bitmapfilter_demo_seek1);
    AdjusterFilter.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (mFilterAdjuster != null) {
                mFilterAdjuster.adjust(progress);
            }
        }
    });
    new Handler().postDelayed(new Runnable() {

        @Override
        public void run() {
            initDrawPad();
        }
    }, 200);
}
Also used : SeekBar(android.widget.SeekBar) OnClickListener(android.view.View.OnClickListener) Handler(android.os.Handler) OnSeekBarChangeListener(android.widget.SeekBar.OnSeekBarChangeListener) View(android.view.View) DrawPadView(com.lansosdk.videoeditor.DrawPadView)

Example 10 with DrawPadView

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

the class CanvasLayerDemoActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.canvaslayer_demo_layout);
    mVideoPath = getIntent().getStringExtra("videopath");
    mInfo = new MediaInfo(mVideoPath, false);
    if (mInfo.prepare() == false) {
        Log.e(TAG, " video path is error.finish\n");
        finish();
    }
    mDrawPadView = (DrawPadView) findViewById(R.id.id_canvaslayer_drawpadview);
    playVideo = (LinearLayout) findViewById(R.id.id_canvasLayer_saveplay);
    playVideo.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            if (SDKFileUtils.fileExist(dstPath)) {
                Intent intent = new Intent(CanvasLayerDemoActivity.this, VideoPlayerActivity.class);
                intent.putExtra("videopath", dstPath);
                startActivity(intent);
            } else {
                Toast.makeText(CanvasLayerDemoActivity.this, "目标文件不存在", Toast.LENGTH_SHORT).show();
            }
        }
    });
    playVideo.setVisibility(View.GONE);
    // 在手机的默认路径下创建一个文件名,用来保存生成的视频文件,(在onDestroy中删除)
    editTmpPath = SDKFileUtils.newMp4PathInBox();
    dstPath = SDKFileUtils.newMp4PathInBox();
    new Handler().postDelayed(new Runnable() {

        @Override
        public void run() {
            // TODO Auto-generated method stub
            // showHintDialog();
            startPlayVideo();
        }
    }, 500);
}
Also used : MediaInfo(com.lansosdk.videoeditor.MediaInfo) CanvasRunnable(com.lansosdk.box.CanvasRunnable) OnClickListener(android.view.View.OnClickListener) Handler(android.os.Handler) Intent(android.content.Intent) View(android.view.View) DrawPadView(com.lansosdk.videoeditor.DrawPadView) TextView(android.widget.TextView)

Aggregations

DrawPadView (com.lansosdk.videoeditor.DrawPadView)10 View (android.view.View)8 OnClickListener (android.view.View.OnClickListener)8 Handler (android.os.Handler)7 Intent (android.content.Intent)6 TextView (android.widget.TextView)5 MediaInfo (com.lansosdk.videoeditor.MediaInfo)4 GLSurfaceView (android.opengl.GLSurfaceView)3 CanvasRunnable (com.lansosdk.box.CanvasRunnable)3 Paint (android.graphics.Paint)2 SeekBar (android.widget.SeekBar)2 OnSeekBarChangeListener (android.widget.SeekBar.OnSeekBarChangeListener)2 VideoPlayerActivity (com.example.advanceDemo.VideoPlayerActivity)2 DrawPad (com.lansosdk.box.DrawPad)2 com.lansosdk.box.onDrawPadProgressListener (com.lansosdk.box.onDrawPadProgressListener)2 com.lansosdk.box.onDrawPadSizeChangedListener (com.lansosdk.box.onDrawPadSizeChangedListener)2 DrawPadView.onViewAvailable (com.lansosdk.videoeditor.DrawPadView.onViewAvailable)2 AdapterView (android.widget.AdapterView)1 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)1 HorizontalScrollView (android.widget.HorizontalScrollView)1