Android Ijkplayer compile and import iJKPlayer-EXAMPLE example

2023-01-21   ES  

  • IJKPlayer is the open source video playback framework of Bilibili. IJKPlayer is a lightweight Android/iOS video player based on FFMPEG. FFMPEG is the world’s leading multimedia framework. It can decod, encodes, transcodes, reuse, reuse, flow, flow, filter and play most video formats. It provides a complete solution for recording, conversion, and fluidized sound videos. It contains very advanced audio/video decoding library libavcodec. In order to ensure high transplantability and encoding quality, many CODEs in LibavCodec are developed from scratch.
  • official document address:https://github.com/bilibili/ijkplayer
  • Introduce the package, call its API to simply implement video playback
    在这里插入图片描述
  • But there are many formats that are not supported, such as M3U8, and videos of HTTPS links cannot be played (reporting Protocol Not Found). At this time, Ijkplayer needs to be compiled.

# Fill in your own path here 
 export Android_sdk =/Home/ZZQ/Software/Androidsdk 
 export android_ndk =/Home/ZZQ/Software/Android-NDK-R10e 
 export path = $ PATH: $ Android_sdk/Tools: $ Android_ndk
  • Use after savingsource /etc/profileMake it effective.
  • 4. Pull the IJKPlayer code to configure some attributes; the first solution (relatively common) selected here.
git clone https://github.com/Bilibili/ijkplayer ijkplayer-android
cd ijkplayer-android
git checkout -B latest k0.8.8
cd config
ln -s module-default.sh module.sh
  • 5. Initialization and compilation. This step is mainly to pick up FFMPEG and compile code. It takes a few hours slowly, and it may fail to pick up FFMPEG midway and re -execute.
./init-android.sh
cd android/contrib
./compile-ffmpeg.sh clean
./compile-ffmpeg.sh all
cd ..
./compile-ijk.sh all
  • Compilation complete

  • After importing the above example, I found that I still ca n’t play HTTPS videos. After checking the information, I did n’t run the script about OpenSSL.
  • 1. Initialize (I won’t go into details in the previous steps)
 ./init-android.sh

 ./init-android-openssl.sh
  • 2. Clean up and compile
cd android/contrib
./compile-openssl.sh clean
./compile-openssl.sh all

./compile-ffmpeg.sh clean 
./compile-ffmpeg.sh all

cd ..
./compile-ijk.sh all

  • 1. Use Android Studio to open Android/IJKPlayer, wait for Android Studio to automatically configure it, run iJKPlayer-EXAMPLE, etc. After the program is successfully installed on the phone, it can be tested.
  • 2. Use. The use of IJKPlayer is basically the same as the MediaPlayer usage with the system.
  • Examples are basically like this.
    在这里插入图片描述

  • ErrorYou need the NDKr10e or later; The solution is that NDK uses a low version, download address:https://developer.android.com/ndk/downloads/older_releases.html, it is best to download the corresponding R10E version (https://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip
  • ./libavutil/timer.h:38:31: Fatal error: linux/perf_event.h: no such file or directory; the solution ismodule-default.shFile last addexport COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-linux-perf", because the attribute is reset, the compilation steps must start after joining.
  • Report error Could not resolve com.android.support:appcompat-v7:23.0.1 or please install the Android support repository from the Android SDK Manager.

    When I learned from API 26, SUPPORT LIBRARIES needs to be downloaded from Google’s Maven warehouse, so you need to add the following configuration in allProjects in the build.gradle

 maven { url "https://maven.google.com" }

source

Random Posts

javaee: Use BCRYPT to verify the login password without

About Android-Ultra-Pull-TO-Refresh refresh and pull up and load more LXN

Software Test Classic Quotes —- Jian Qi’s Wisdom/Take its incense

Hongmeng OS application development -page layout tablelayout

Mac OS, Environment