ijkPlayer编译支持https的so文件-Android

Android社区 收藏文章

最近 应用中视频突然不能播放了,跟踪日志发现

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....

相关标签

扫一扫

在手机上阅读