Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android lib ijkplayer load https url

I am using ijkplayer in my android app that I compile using

compile 'tv.danmaku.ijk.media:ijkplayer-java:0.4.5'
compile 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.4.5'

It works perfectly loading http urls but if I try to load https urls I get this error

https protocol not found, recompile FFmpeg with openssl, gnutls, or securetransport enabled.

and can't load my video. I don't know if it makes any difference but the url I am trying to load is a .m3u8 but if it is http works fine.

How can I recompile ffmpeg in this lib?

like image 716
Pedro Ferreira Avatar asked Mar 12 '23 15:03

Pedro Ferreira


1 Answers

Hi Petro i am not proffesional but hope this tutorial would help.

You have to compile ijkplayer with openssl support to open https links, to do that follow this steps:

Grab latest version of IjkPlayer from github:

$ git clone https://github.com/Bilibili/ijkplayer.git

Open just downloaded folder ijkplayer Remove symlinks to module.sh and create symlink to module-lite.sh

$ cd config
$ rm module.sh
$ ln -s module-lite.sh module.sh

Do initialisation of OpenSSL (getting ready to download and compile openssl first)

$ cd ..
$ ./init-android-openssl.sh

Make sure you have pointed for your SDK and NDK path.

(NDK r10e preffered - I am not sure if SDK is needed but just in case i did exported it)

NOTE: make sure you have changed your path properly that is only example of path what i have used.

export ANDROID_SDK="/home/ZiomusGorliczanin/SDK"
export ANDROID_NDK="/home/ZiomusGorliczanin/NDK"

Open IjkPlayer/android/contrib folder and fire up compile-openssl.sh clean and all command (that will compile openssl for all processors).

$ cd android/contrib
$ ./compile-openssl.sh clean
$ ./compile-openssl.sh all

Compilation might take a while 10 min.

Compile FFMpeg with OPENSSL for all processors:

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

Finally compile IjkPlayer with all above as a liblary.

$ cd ..
$ ./compile-ijk.sh all

After all this steps you should have liblaries in those folders (Three *.so files):

ijkplayer/ijkplayer-armv5/src/main/libs
ijkplayer/ijkplayer-armv7a/src/main/libs
ijkplayer/ijkplayer-arm64/src/main/libs
ijkplayer/ijkplayer-x86/src/main/libs

Try to import gradle project to your Android Studio and Run Ijk-Example for testing.

like image 146
Ziomuś Gorliczanin Avatar answered Mar 28 '23 22:03

Ziomuś Gorliczanin