AKVideoImageView
This class was created because I wasn't satisfied with standard Apple AVPlayer during creating a video background for one of my apps. AVPlayer doesn't let the phone to go to sleep mode. Also, you can't insensibly start a video from the first frame when app enters background. This class solves these problems, and in the end, you have a perfect solution for making gorgeous video backgrounds for your apps.
FeaturesAbility to dynamically switch videos
Auto set the first frame of video to have seamless transition when app returns from background
Minimal memory footprint
Good performance
Ability to use mp4 files as video source
InstallationManuallyJust add AKVideoImageView.h and AKVideoImageView.m files to your project.
CocoaPodsAdd the following line to your Podfile.
pod 'AKVideoImageView', '~> 1.0'Then run pod install.
UsageCompressing your video fileBefore starting using this class, you need to properly compress video.
Here is an example of libx264 compression options on OS X system using ffmpeg utility:
ffmpeg -i input.mov -vcodec libx264 -level 3.1 -pix_fmt yuv420p -threads 1 -preset placebo -crf 19 -tune film -x264opts colorprim=bt709:transfer=bt709:colormatrix=bt709:fullrange=off output.mp4
In your view controller: