Search in sources :

Example 41 with MediaInfo

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

the class Video2LayoutActivity method initDrawPad.

/**
 * Step1:  init Drawpad  初始化DrawPad
 */
private void initDrawPad() {
    if (mplayerReady && mplayer2Ready) {
        mInfo = new MediaInfo(mVideoPath, false);
        if (mInfo.prepare()) {
            drawPadView.setUpdateMode(DrawPadUpdateMode.ALL_VIDEO_READY, 25);
            drawPadView.setRealEncodeEnable(480, 480, 1200000, (int) mInfo.vFrameRate, editTmpPath);
            drawPadView.setDrawPadSize(480, 480, new onDrawPadSizeChangedListener() {

                @Override
                public void onSizeChanged(int viewWidth, int viewHeight) {
                    startDrawPad();
                }
            });
        }
    }
}
Also used : com.lansosdk.box.onDrawPadSizeChangedListener(com.lansosdk.box.onDrawPadSizeChangedListener) MediaInfo(com.lansosdk.videoeditor.MediaInfo) Paint(android.graphics.Paint)

Example 42 with MediaInfo

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

the class VideoLayerAutoUpdateActivity method initDrawPad.

// Step1: 设置DrawPad 容器的尺寸.并设置是否实时录制容器上的内容.
private void initDrawPad() {
    MediaInfo info = new MediaInfo(mVideoPath, false);
    if (info.prepare()) {
        mDrawPad.setRealEncodeEnable(480, 480, 1000000, (int) info.vFrameRate, dstPath);
        // 25是帧率.
        mDrawPad.setUpdateMode(DrawPadUpdateMode.AUTO_FLUSH, 25);
        mDrawPad.setDrawPadSize(480, 480, new onDrawPadSizeChangedListener() {

            @Override
            public void onSizeChanged(int viewWidth, int viewHeight) {
                startDrawPad();
            }
        });
    }
}
Also used : com.lansosdk.box.onDrawPadSizeChangedListener(com.lansosdk.box.onDrawPadSizeChangedListener) MediaInfo(com.lansosdk.videoeditor.MediaInfo) Paint(android.graphics.Paint)

Example 43 with MediaInfo

use of com.lansosdk.videoeditor.MediaInfo 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 44 with MediaInfo

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

the class VideoSpeedDemoActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.test_layplayer_layout);
    drawPadView = (DrawPadView) findViewById(R.id.id_test_playerview);
    findViewById(R.id.id_test_btn_pause).setOnClickListener(this);
    findViewById(R.id.id_test_btn_speedslow).setOnClickListener(this);
    findViewById(R.id.id_test_btn_speedfast).setOnClickListener(this);
    findViewById(R.id.id_test_btn_speednormal).setOnClickListener(this);
    skProgress = (SeekBar) findViewById(R.id.id_test_seekbar_play);
    skProgress.setOnSeekBarChangeListener(this);
    SeekBar speed = (SeekBar) findViewById(R.id.id_test_seekbar_speed);
    speed.setOnSeekBarChangeListener(this);
    mVideoPath = getIntent().getStringExtra("videopath");
    mInfo = new MediaInfo(mVideoPath, false);
    if (mInfo.prepare()) {
        new Handler().postDelayed(new Runnable() {

            @Override
            public void run() {
                startPlayVideo();
            }
        }, 500);
    }
}
Also used : MediaInfo(com.lansosdk.videoeditor.MediaInfo) SeekBar(android.widget.SeekBar) Handler(android.os.Handler)

Example 45 with MediaInfo

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

the class ViewLayerDemoActivity method initDrawPad.

/**
 * Step1: 设置DrawPad 容器的尺寸.
 * 并设置是否实时录制容器上的内容.
 */
private void initDrawPad() {
    MediaInfo info = new MediaInfo(mVideoPath, false);
    if (info.prepare()) {
        drawPadView.setUpdateMode(DrawPadUpdateMode.AUTO_FLUSH, 25);
        drawPadView.setRealEncodeEnable(480, 480, 1000000, (int) info.vFrameRate, editTmpPath);
        drawPadView.setOnDrawPadProgressListener(new onDrawPadProgressListener() {

            @Override
            public void onProgress(DrawPad v, long currentTimeUs) {
                if (// 在第7秒的时候, 不再显示.
                currentTimeUs > 10 * 1000 * 1000) {
                    hideWord();
                } else if (// 在第三秒的时候, 显示tvWord
                currentTimeUs > 3 * 1000 * 1000) {
                    showWord();
                }
            }
        });
        drawPadView.setDrawPadSize(480, 480, new onDrawPadSizeChangedListener() {

            @Override
            public void onSizeChanged(int viewWidth, int viewHeight) {
                startDrawPad();
            }
        });
    }
}
Also used : DrawPad(com.lansosdk.box.DrawPad) com.lansosdk.box.onDrawPadSizeChangedListener(com.lansosdk.box.onDrawPadSizeChangedListener) MediaInfo(com.lansosdk.videoeditor.MediaInfo) com.lansosdk.box.onDrawPadProgressListener(com.lansosdk.box.onDrawPadProgressListener) Paint(android.graphics.Paint)

Aggregations

MediaInfo (com.lansosdk.videoeditor.MediaInfo)59 Handler (android.os.Handler)12 com.lansosdk.box.onDrawPadSizeChangedListener (com.lansosdk.box.onDrawPadSizeChangedListener)9 Paint (android.graphics.Paint)8 TextView (android.widget.TextView)6 Intent (android.content.Intent)5 View (android.view.View)5 OnClickListener (android.view.View.OnClickListener)5 CanvasRunnable (com.lansosdk.box.CanvasRunnable)5 DrawPad (com.lansosdk.box.DrawPad)5 Bitmap (android.graphics.Bitmap)4 DrawPadView (com.lansosdk.videoeditor.DrawPadView)4 File (java.io.File)3 SurfaceTexture (android.graphics.SurfaceTexture)2 MediaPlayer (android.media.MediaPlayer)2 DisplayMetrics (android.util.DisplayMetrics)2 Surface (android.view.Surface)2 SurfaceTextureListener (android.view.TextureView.SurfaceTextureListener)2 VideoPlayerActivity (com.example.advanceDemo.VideoPlayerActivity)2 DrawPadVideoRunnable (com.lansosdk.box.DrawPadVideoRunnable)2