Integrated Ijkplayer video Live frame in iOS
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, press The following can also be integrated success!
One. Download Ijkplayer
ijkplayer: Https://github.com/Bilibili/ijkplayer
After the download is complete, unzip the folder internal directory such as:
Ijkplayer-master folder contents. png two. 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 extracted folder, such as:
Go to this folder
2. Execute command line ./init-ios.sh , this step is to download ffmpeg, the time will be a little longer, patience wait a moment. For example:
3. After the download is completed in the 2nd step, execute, that is, cd ios go to 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. PackagingIJKMediaFramework.frameworkFramework
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. Here's how to package it IJKMediaFramework.framework , follow the steps below to start one step at a pace:
- First open
IJKMediaPlayer.xcodeproj the project, location such as:
When opened, this is the case, such as:
The framework project to be packaged. png
2. When the project is opened, set up the scheme of the project, the specific steps such as:
First step. png
Step two. png
3. After setting the scheme, select the real machine and the simulator to compile, after compiling, enter 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:
The files that are generated after the run. png
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. png
Open terminal, merge, command line specific format:
lipo -create "真机版本路径" "模拟器版本路径" -output "合并后的文件路径"
After merging, such as:
Merge the generated files. png
The following is important, you need to use the merged to IJKMediaFramework replace the original IJKMediaFramework , such as, I hope you can read:
Replace the original file with the merge-generated file. png
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.
Four. 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. png
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
Reprinted from: HTTP://WWW.JIANSHU.COM/P/1F06B27B3AC0;
Integrated Ijkplayer video Live frame in iOS