Ubuntu版本号:12.04.1 LTS
NDK版本号:ndk-r10e
Android studio版本号:2.2.1
Gradele版本号:2.14.1
ijkplayer源码下载:https://github.com/Bilibili/ijkplayer
1)编译环境所需要的软件安装
sudo apt-get install git
sudo apt-get instal yasm
sudo apt-get install make
2)NDK环境变量配置
本人是在安装了Ubuntu虚拟机,下载NDK:https://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip
NDK版本特别注意了,本人 尝试了ndk-r10e和ndk-r13都没有编译成功,最后选择ndk-r10e编译成功
修改/etc/profile 在文件的最后加上以下
export ANDROID_NDK=/home/grid/software/android-ndk-r10e
然后
source /etc/profile
3)ijkplayer编译
git clone https://github.com/Bilibili/ijkplayer.git ijkplayer-android
cd ijkplayer-android
git checkout -B latest k0.6.2
./init-android.sh
cd android/contrib
./compile-ffmpeg.sh clean
./compile-ffmpeg.sh all
cd ..
./compile-ijk.sh all
4)导入android studio
本人是在Windows下开发Android项目的,所以将编译好的demo程序导出的window系统中
demo项目路径在 ijkplayer-android/android/ijkplayer,其中ijkplayer就是项目名称
导出成功后在ijkplayer目录下运行gradle命令,然后打开Android studio,File-->Open-->项目路径即可
运行后可以直接选MP4文件视频进行播放