SGPlayer is a powerful media player framework for iOS, macOS, and tvOS. based on AVPlayer and FFmpeg. Support 360° panorama video, VR video. RTMP streaming.
Features
360° panorama video.
Gestures and sensors control vr video.
distortion correction in cardboard mode.
Support iOS, macOS, and tvOS.
H.264 hardware accelerator (VideoToolBox).
RTMP, RTSP streamings.
Background playback mode.
Selected audio track.
Adjust the volume.
Capture video artwork.
Bitcode support.
Simplest callback handle.
Build Instructions (Choose one of the way)
Method 1. Using build script
// iOS
git clone https://github.com/libobjc/SGPlayer.git
cd SGPlayer
sh compile-build.sh iOS
// macOS
git clone https://github.com/libobjc/SGPlayer.git
cd SGPlayer
sh compile-build.sh macOS
// tvOS
git clone https://github.com/libobjc/SGPlayer.git
cd SGPlayer
sh compile-build.sh tvOS
Method 2. Manually build
Step 1 - clone and init submodule.
git clone git@github.com:libobjc/SGPlayer.git
cd SGPlayer
git submodule update --init --recursive
Step 2 - build FFmpeg and add libs to the corresponding directory.
// selected playback core.
self.player.decoder = [SGPlayerDecoder defaultDecoder]; // default config,Together with AVPlayer and FFmpeg.
self.player.decoder = [SGPlayerDecoder AVPlayerDecoder]; // only use AVPlayer
self.player.decoder = [SGPlayerDecoder FFmpegDecoder]; // only use FFmpeg// set the specified format playback core.
self.player.decoder.decodeTypeForMPEG4 = SGDecoderTypeFFmpeg; // use FFmoeg play mp4 files.// open FFmpeg hardware accelerate.
self.player.decoder.hardwareAccelerateEnableForFFmpeg = YES;
// enter cardboard mode
self.player.displayMode = SGDisplayModeBox;
// set background mode.// if allow background mode, you should open 'Background Modes' and check 'Audio' option, and set AVAudioSession Category to AVAudioSessionCategoryPlayback
self.player.backgroundMode = SGPlayerBackgroundModeAutoPlayAndPause; // auto play and pause.
self.player.backgroundMode = SGPlayerBackgroundModeContinue; // continue.