Go directly to the theme, iJkPlayer needs to be configured to use.
Ijkplayer builds, packages, and HTTPS support for ijkPlayer There are iOS_ xiao Gang’s iOS live ijkplayer integration and simple use (play). This article goes into more detail, and while the developer’s environment configuration for iJkPlayer should normally be just one brew install yasm, it’s a good guide in case you need it.
If you don’t want to configure, want to see the effect in advance, save time, you can directly download the framework I put on Github —ijkplayer-framework
The following is a summary of the problems I encountered, and to start from scratch, I recommend reading the article above or other tutorials online. There are many, and I won’t summarize them
Executing this step results in an error, as follows.
./compile-ffmpeg.sh all
Copy the code
AS libavcodec/arm/aacpsdsp_neon.o
./libavutil/arm/asm.S:50:9: error: unknown directive
.arch armv7-a
^
make: *** [libavcodec/arm/aacpsdsp_neon.o] Error 1
make: *** Waiting for unfinished jobs....
Copy the code
You need to delete armv7 from compile-ffmpeg.sh as follows:
Also is to
FF_ALL_ARCHS_IOS8_SDK="armv7 arm64 i386 x86_64"
Copy the code
Instead of
FF_ALL_ARCHS_IOS8_SDK="arm64 i386 x86_64"
Copy the code
I have tested whether I need to delete all armv7, I only deleted the armv7 line in the picture above, and the compilation passed. So it shouldn’t be necessary.
Then re-execute the ffmpeg compilation command:
./compile-ffmpeg.sh all
Copy the code
#### Compilation errors need to comment out the reference code for both files. H and config.h. If the error is not detected by clicking on the avconfig.h and config.h files, then you need to go directly to the file directory
Select Reveal in Log to locate avconfig.h
# include "armv7/avconfig.h"
The same goes for config.h
# include "armv7/config.h"
After the Framework is packaged and added to the project, you need to test whether the Framework works
Environment:
Xcode 10.1 swift, 4.2
The sample code
Video source just go online, this is the url I found
/ / / / / / PlayerViewController swift ProjectFramework / / / / Created by Bart Simpson on 2018/11/16. / / Copyright © 2018 simpsons. All rights reserved. // import UIKit import IJKMediaFramework class PlayerViewController: UIViewController { var player:IJKFFMoviePlayerController! override funcviewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = UIColor.white
showVideo()
// Do any additional setup after loading the view.
}
func showVideo() {letOptions = ijkffOptions.bydefault () // Video source addresslet url = URL.init(string: "http://ivi.bupt.edu.cn/hls/cctv1hd.m3u8") / / initializes the player, playing online video or live (RTMP) player = IJKFFMoviePlayerController. Init (contentURL: url, with: options) / / play page view wide high adaptiveletautoresize = UIView.AutoresizingMask.flexibleWidth.rawValue | UIView.AutoresizingMask.flexibleHeight.rawValue player.view.autoresizingMask = UIView.AutoresizingMask(rawValue: Autoresize) player.view.frame = self.view.bounds player.scalingMode =.aspectFittrue/ / open automatically play self. View. AutoresizesSubviews =trueself.view.addSubview(player.view) } override func viewWillAppear(_ animated: Bool) {super. ViewWillAppear (animated) / / start playing self. Player. PrepareToPlay ()} override func viewWillDisappear (_ animated: Bool) {super.viewwillDisappear (animated) // Close player self.player.shutdown()}}Copy the code