Search in sources :

Example 11 with MediaInfo

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

the class VideoLayerTransformActivity method startPlayVideo.

private void startPlayVideo() {
    mInfo = new MediaInfo(mVideoPath, false);
    if (mInfo.prepare()) {
        mplayer = new MediaPlayer();
        try {
            mplayer.setDataSource(mVideoPath);
        } catch (IOException e) {
            e.printStackTrace();
        }
        mplayer.setOnPreparedListener(new OnPreparedListener() {

            @Override
            public void onPrepared(MediaPlayer mp) {
                // TODO Auto-generated method stub
                initDrawPad();
            }
        });
        mplayer.prepareAsync();
    } else {
        Log.e(TAG, "Null Data Source\n");
        finish();
        return;
    }
}
Also used : MediaInfo(com.lansosdk.videoeditor.MediaInfo) OnPreparedListener(android.media.MediaPlayer.OnPreparedListener) IOException(java.io.IOException) MediaPlayer(android.media.MediaPlayer)

Example 12 with MediaInfo

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

the class MVLayerDemoActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.mvlayer_demo_layout);
    initView();
    mVideoPath = getIntent().getStringExtra("videopath");
    mDrawPadView = (DrawPadView) findViewById(R.id.id_mvlayer_padview);
    mInfo = new MediaInfo(mVideoPath, false);
    if (mInfo.prepare() == false) {
        Log.e(TAG, "视频源文件错误!");
        this.finish();
    }
    // 在手机的默认路径下创建一个文件名,用来保存生成的视频文件,(在onDestroy中删除)
    editTmpPath = SDKFileUtils.newMp4PathInBox();
    dstPath = SDKFileUtils.newMp4PathInBox();
    new Handler().postDelayed(new Runnable() {

        @Override
        public void run() {
            // TODO Auto-generated method stub
            startPlayVideo();
        }
    }, 500);
}
Also used : MediaInfo(com.lansosdk.videoeditor.MediaInfo) CanvasRunnable(com.lansosdk.box.CanvasRunnable) Handler(android.os.Handler)

Example 13 with MediaInfo

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

the class VHeaderConcat method start.

public void start(Context ctx, String videoHeader, String recordVideo) {
    this.recordVideo = recordVideo;
    videoPath = videoHeader;
    mInfo = new MediaInfo(recordVideo);
    if (mInfo.prepare()) {
        int padWidth = mInfo.vWidth;
        int padHeight = mInfo.vHeight;
        if (mInfo.vRotateAngle == 90 || mInfo.vRotateAngle == 270) {
            padWidth = mInfo.vHeight;
            padHeight = mInfo.vWidth;
        }
        editTmpPath = SDKFileUtils.newMp4PathInBox();
        dstPath = SDKFileUtils.newMp4PathInBox();
        /**
         * 片头缩放成 recordVideo的尺寸.
         */
        mDrawPad = new DrawPadVideoExecute(ctx, videoPath, padWidth, padHeight, (int) (mInfo.vBitRate * 1.5f), null, editTmpPath);
        mDrawPad.setUseMainVideoPts(true);
        /**
         * 设置DrawPad处理完成后的监听.
         */
        mDrawPad.setDrawPadCompletedListener(new onDrawPadCompletedListener() {

            @Override
            public void onCompleted(DrawPad v) {
                // TODO Auto-generated method stub
                drawPadCompleted();
            }
        });
        mDrawPad.pauseRecord();
        if (mDrawPad.startDrawPad()) {
            // 开始恢复处理.
            mDrawPad.resumeRecord();
        }
    }
}
Also used : DrawPad(com.lansosdk.box.DrawPad) DrawPadVideoExecute(com.lansosdk.videoeditor.DrawPadVideoExecute) MediaInfo(com.lansosdk.videoeditor.MediaInfo) com.lansosdk.box.onDrawPadCompletedListener(com.lansosdk.box.onDrawPadCompletedListener)

Example 14 with MediaInfo

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

the class VideoOneProcessActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.video_one_do_process_layout);
    mContext = getApplicationContext();
    videoPath = getIntent().getStringExtra("videopath");
    mInfo = new MediaInfo(videoPath);
    if (mInfo.prepare() == false) {
        Toast.makeText(mContext, "当前文件错误!", Toast.LENGTH_LONG).show();
        finish();
    }
    initUI();
}
Also used : MediaInfo(com.lansosdk.videoeditor.MediaInfo)

Example 15 with MediaInfo

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

the class VideoPlayerActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.player_layout);
    textureView = (TextureRenderView) findViewById(R.id.surface1);
    videoPath = getIntent().getStringExtra("videopath");
    TextView tvScreen = (TextView) findViewById(R.id.id_palyer_screenhinit);
    TextView tvVideoRatio = (TextView) findViewById(R.id.id_palyer_videoRatio);
    tvVideoDuration = (TextView) findViewById(R.id.id_palyer_videoduration);
    tvSizeHint = (TextView) findViewById(R.id.id_palyer_videosizehint);
    tvPlayWidget = (TextView) findViewById(R.id.id_palyer_widget);
    // 获取屏幕密度(方法2)
    DisplayMetrics dm = new DisplayMetrics();
    dm = getResources().getDisplayMetrics();
    screenWidth = dm.widthPixels;
    screenHeight = dm.heightPixels;
    String str = "当前屏幕分辨率:";
    str += String.valueOf(screenWidth);
    str += "x";
    str += String.valueOf(screenHeight);
    tvScreen.setText(str);
    mInfo = new MediaInfo(videoPath, false);
    if (mInfo.prepare() == false) {
        showHintDialog();
        isSupport = false;
    } else {
        Log.i(TAG, "info:" + mInfo.toString());
        isSupport = true;
        str = "当前视频分辨率:";
        str += String.valueOf(mInfo.vWidth);
        str += "x";
        str += String.valueOf(mInfo.vHeight);
        tvVideoRatio.setText(str);
        str = "当前视频时长:";
        str += String.valueOf(mInfo.vDuration);
        tvVideoDuration.setText(str);
    }
    textureView.setSurfaceTextureListener(new SurfaceTextureListener() {

        @Override
        public void onSurfaceTextureUpdated(SurfaceTexture surface) {
        // TODO Auto-generated method stub
        }

        @Override
        public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
        }

        @Override
        public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
            return false;
        }

        @Override
        public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
            if (isSupport) {
                // 采用系统本身的MediaPlayer播放
                play(new Surface(surface));
            // startVPlayer(new Surface(surface));  //我们SDK提供的播放器.
            }
        }
    });
}
Also used : MediaInfo(com.lansosdk.videoeditor.MediaInfo) SurfaceTexture(android.graphics.SurfaceTexture) SurfaceTextureListener(android.view.TextureView.SurfaceTextureListener) TextView(android.widget.TextView) DisplayMetrics(android.util.DisplayMetrics) Surface(android.view.Surface)

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