Ijkplayer is a live video frame, based on ffmpeg, support for Android and IOS, there are many integration instructions on the web, but the personal feel is not enough detailed, here in detail on how to integrate Ijkplayer in IOS, even if never touched before, You can also integrate success by doing the following!
First, download Ijkplayer
ijkplayer: Https://github.com/Bilibili/ijkplayer
After the download is complete, unzip the folder internal directory such as:
Second, compiling Ijkplayer
Said to be compiled Ijkplayer, is actually compiled ffmpeg, here we have downloaded ijkplayer , so GitHub on README.md the Build iOS step in the steps are not needed.
The following steps start the step-by-step compilation:
1, open the terminal, CD to the jkplayer-master folder, that is, after downloading the unpacked folder, such as:
Go to this folder
2, the execution command line ./init-ios.sh , this step is to download ffmpeg, time will be a bit longer, patience wait a moment. Such as:
3, in the 2nd step after the download is completed, the implementation is cd ios, to enter the iOS directory, such as:
Go to iOS folder
4. After entering the iOS folder, execute and command in the terminal sequentially, compile the ffmpeg, that is, the ./compile-ffmpeg.sh clean ./compile-ffmpeg.sh all README.md two steps, such as:
Compiling ffmpeg
Compile for a longer time and wait patiently.
Three, packaging IJKMediaFramework.framework Frame
There are two methods of integrating Ijkplayer:
One way to do this is to directly import the project as it is IJKMediaDemo IJKMediaPlayer.xcodeproj done in the project, where it is not introduced, such as:
Import Ijkmediaplayer.xcodeproj
The second method of integration is to package the Ijkplayer into an framework import project for use. Here's how to package IJKMediaFramework.framework it, follow the steps below to start one step at a pace:
1, first open IJKMediaPlayer.xcodeproj the project, location such as:
When opened, this is the case, such as:
The framework engineering to be packaged
2, the project opens after the project scheme, the specific steps such as:
The first step
Step Two
3, set the scheme, select the real machine and the simulator to compile, after the completion of the compilation, into the Finder, such as:
After entering the Finder, you can see the compilation results of two versions of the real machine and simulator, such as:
Files generated after the run
The following is the beginning of merging the real machine and emulator version of the framework, be careful not to merge the wrong, merging this file, such as:
Merge this file in the real machine and emulator files
Open terminal, merge, command line specific format:
lipo -create "真机版本路径" "模拟器版本路径" -output "合并后的文件路径"
After merging, such as:
Merging the generated files
The following are important and need to be replaced with the original after merging IJKMediaFramework IJKMediaFramework . Such as:
Replace the original file with a merge-generated file
In the 1, 22 steps to complete, the green box of the IJKMediaFramework.framework file is the frame we need to copy it out, we need to import the project to use later.
Iv. Integrated Ijkplayer in iOS engineering
Create a new project, import the merged and dependent frameworks IJKMediaFramework.framework , and related dependencies, such as:
Import Framework and Dependency framework
After importing the framework, in the ViewController.m test, first import the IJKMediaFramework.h header file, compile to see if there is nothing wrong, if there is no mistake to explain the integration success.
Then start using the framework in the ViewController.m file IJKMediaFramework for test use, write a simple live video to test, look at the results after the run, and then put the Demo for download.
Hong Kong satellite TV Live screen
At this point, Ijkplayer integration is complete!
Demo Address: Https://coding.net/u/wanglei123/p/ijkplayerDemo/git
Integrated Ijkplayer video Live frame in iOS