This project can customize compilation options in the following ways.
The modified source code is hosted on gitee.
$ git clone https://gitee.com/kikt/ijkplayer_thrid_party.git ijkplayer
or
$ git clone https://cjlspy@dev.azure.com/cjlspy/ijkplayer_for_flutter/_git/ijkplayer_for_flutter ijkplayer
This section mainly refers to the official process. If you know something about ijkplayer, you can skip this section and look directly at the following links in flutter. If this part encounters problems, you can ask questions officially.
I'm macOS here. If you're linux, you can compile the Android part.
IOS compilation can only be completed under macOS.
Windows: Please give up.
This is the compilation option of ffmpeg in ijkplayer. You can modify this part of the code according to your own needs. The configuration here has the greatest impact on the size of the overall library file.
Your mac must have the soft:
- git
- yasm
Later, if you don't need the HTTPS protocol, you can skip all openssl-related initialization and compilation.
- NDK r10e(Do not use higher versions, do not guarantee availability)
- Xcode
- Android SDK
Make sure your git, yasm, are in the environment variable.
Configure andorid SDK and NDK to environment variables.
export ANDROID_SDK=<your sdk path>
export ANDROID_NDK=<your ndk path>
initial:
./init-config.sh
./init-android.sh
./init-android-openssl.sh
compile:
cd android/contrib
./compile-ffmpeg.sh clean
./compile-openssl.sh clean
./compile-openssl.sh all
./compile-ffmpeg.sh all
cd ..
./compile-ijk.sh all
After waiting here, you can copy so files in your corresponding CPU type. Here are the library files that will be applied to the project in the future.
initial:
./init-config.sh
./init-ios.sh
./init-ios-openssl.sh
compile
cd ios
./compile-openssl.sh clean
./compile-ffmpeg.sh clean
./compile-openssl.sh arm64
./compile-openssl.sh x86_64
./compile-openssl.sh i386
./compile-openssl.sh lipo
./compile-ffmpeg.sh arm64
./compile-ffmpeg.sh x86_64
./compile-ffmpeg.sh i386
./compile-ffmpeg.sh lipo
Here's a quick way to use it directly after cleaning.
./compile-common.sh
The next step needs to be done in xcode. Here is Xcode 10.
$ open ios/IJKMediaPlayer/IJKMediaPlayer.xcodeproj
Don't choose the SSL project here.
cd dir in shell.
such as: $ cd ~/Library/Developer/Xcode/DerivedData/IJKMediaPlayer-bpuwtjeeipcfgffpcjhynhwsndig/Build/Products
lipo your device and simulator.
lipo -create Release-iphoneos/IJKMediaFramework.framework/IJKMediaFramework Release-iphonesimulator/IJKMediaFramework.framework/IJKMediaFramework -output IJKMediaFramework
cp IJKMediaFramework Release-iphoneos/IJKMediaFramework.framework
open Release-iphoneos/
The IJKMediaFramework.framework is a folder.
-
Download or clone the project to a separate folder in your flutter project
-
Edit your pubspec.yaml
from
dependencies:
flutter_ijkplayer: ^0.x.x
to
dependencies:
flutter_ijkplayer:
path: ./flutter_ijkplayer
Copy IJKMediaFramework.framework folder into flutter_ijkplayer/iOS
,
and edit your podspec file:
From
to
Copy all ijkplayer so files into flutter_ijkplayer/android/src/main/libs/${CPU}
and replace all.
The project base on 0.8.8 of bilibili/ijkplayer. Before you use it, you need to make sure that your project meets ijkplayer's requirements.
Part of the iOS code in the project comes from https://github.com/jadennn/flutter_ijk, all of which are based on the MIT protocol.
The protocol used in my modified framework code is the same as bilibili/ijkplayer.