IjkPlayer视频播放

导依赖

implementation 'com.github.leifzhang:IjkLib:0.4.3'

权限




xml布局

 

代码

        IjkMediaPlayer.loadLibrariesOnce(null);
        IjkMediaPlayer.native_profileBegin("libijkplayer.so");

        AndroidMediaController controller=new AndroidMediaController(this,false);
        videoView.setMediaController(controller);
        String url="http://ips.ifeng.com/video19.ifeng.com/video09/2014/06/16/1989823-102-086-0009.mp4";
        videoView.setVideoURI(Uri.parse(url));
        videoView.start();

            //在生命周期中设置 暂停
     @Override
     protected void onPause() {
        super.onPause();
        videoView.pause();
      }

    @Override
    protected void onResume() {
        super.onResume();
        videoView.resume();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        IjkMediaPlayer.native_profileEnd();
    }

你可能感兴趣的:(网络)