最近 應用中視頻突然不能播放了,跟蹤日志發現
tv.danmaku.ijk.media.player.IjkMediaPlayer: Error (-10000,0)
一番google加百度。。。
原來 ijkPlayer默認不支持 https 協議的視頻,也就是下面這些提供的默認arm依賴不支持https。
好吧,那就自己來編譯吧!~!~!~
我用的mac電腦,所以blablabla...
1.準備
? ? 下載ijkPlayer源碼,下載地址:github.com/Bilibili/ijkplayer
? ? ?編譯之前 首先查看一下是否安裝了NDK,沒有的請自行安裝,下載地址: ? ? ? ?? https://developer.android.google.cn/ndk/downloads/revision_history.html
? ? ?編譯需要的 NDK 最小版本支持 10e,另外作者貌似還沒有對NDK15支持
? ? ?安裝NDK之后,要記得在.bash_profile配置 export ANDROID_SDK="SDK路徑"? export ANDROID_NDK="NDK路徑"?
2.安裝需要的程序(在終端輸入以下命令)
? 安裝homebrew?
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
? 安裝git
brew install git
? 安裝yasm
brew install yasm
3.配置文件(終端進入ijkPlayer工程根目錄)
有三種文件可供選擇
? If you prefer more codec/format?
cd config
rm module.sh
ln -s module-default.sh module.sh
? If you prefer less codec/format for smaller binary size (include hevc function)
cd config
rm module.sh
ln -s module-lite-hevc.sh module.sh
? If you prefer less codec/format for smaller binary size (by default)?
cd config
rm module.sh
ln -s module-lite.sh module.sh
? ? ? ? 本來想使用第一種配置文件,支持的類型還多一些,但打出來的so文件11M多,太大了,最后選擇了第三種配置文件,打出來so 4M左右.
4.初始化openssl、ffmpeg(根目錄)
./init-android-openssl.sh?
./init-android.sh
5.編譯
? ? ? 切換到android/contrib目錄下(cd android/contrib),執行如下命令 編譯so文件
./compile-openssl.sh clean
./compile-ffmpeg.sh clean ??
./compile-openssl.sh all
./compile-ffmpeg.sh all
? ? ? 其中all 代表所有平臺,如果只想編譯指定的平臺,比如編譯armv5 ,則將all改為armv5
6.生成so
? ? 切換到android目錄下(cd ..),執行如下命令 生成so文件
? ? ./compile-ijk.sh all
? ? ?可更改all為指定版本
生成的so文件可在 ijkplayer/android/ijkplayer/ 下找到
End....