基于Mac 下Ijkplayer编译成Android的so库的步
1、准备好SDK+NDK环境,并且配置好环境变量(不多说,自己配置)
NDK版本是有一定的限制,默认支持14一下的版本;
2、编译步骤。具体可以查看官网(https://github.com/Bilibili/ijkplayer)说明。
把源码拷贝到本地
git clone https://github.com/Bilibili/ijkplayer.git ijkplayer-android
cd ijkplayer-android
git checkout -B latest k0.8.8
./init-android.sh
cd android/contrib
./compile-ffmpeg.sh clean
./compile-ffmpeg.sh all
cd ..
./compile-ijk.sh all
执行以上命令成功,则会在 ijkplayer 目录下生成对应CPU的动态库;

3、编译好后,就可以针对把需要的so动态库集成到自己的项目当中使用;
可以使用android/ijkplayer/ijkplayer-example 例子进行项目测试;

设置播放器的xml

集成之后,直接调用就可以播放了
mVideoView = (IjkVideoView) findViewById(R.id.video_view);
/** 普通播放 start **/
mVideoView.setAspectRatio(IRenderView.AR_ASPECT_FIT_PARENT);
mVideoView.setVideoURI(Uri.parse(url5));
mVideoView.start();