ijkplayer的编译

最近公司准备上班一个直播项目,做下前期准备,在知乎上转了半天看到大神介绍Bilibili开源的播放器可以支持,抱着学习的态度观摩一下。

ijkplayer

Video player based on ffplay
项目地址:https://github.com/Bilibili/ijkplayer

我的编译环境

  • Mac OS X 10.11.4 (15E65)
  • Android
    • NDK r10e(推荐)
    • Android Studio 2.1
    • Gradle 2.0.0

编译前的准备

1
2
3
4
5
6
7
# install homebrew, git, yasm
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install git
brew install yasm
# add these lines to your ~/.bash_profile or ~/.profile
# export ANDROID_SDK=<your sdk path>
# export ANDROID_NDK=<your ndk path>

Note:.bash_profile在~(即home)目录下,可以通过sudo ls命令查看。如果原先没有”.bash_profile”文件,可以使用touch ~/.bash_profile新建。使用文本打开open -e ~/.bash_profile。MAC上NDK和SDK的配置参考这个地址配置如图
sdk_ndk_path_config

Android 编译

1
2
3
4
5
6
7
8
9
10
11
12
git clone https://github.com/Bilibili/ijkplayer.git ijkplayer-android
cd ijkplayer-android
git checkout -B latest k0.5.1

./init-android.sh

cd android/contrib
./compile-ffmpeg.sh clean
./compile-ffmpeg.sh all

cd ..
./compile-ijk.sh all

遇到的问题

  1. homebrew Error:Cannot write to /usr//Cellar
    解决方法sudo chown -R $USER /usr/<your user name> 参考地址

  2. NDK配置问题,建议使用NDKr10e,参考上面的配置