MichaelHuyp / LFLiveKit

LaiFeng IOS Live Kit,H264 and AAC Hard coding,support GPUImage Beauty, rtmp transmission,weak network lost frame,Dynamic switching rate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status  License MIT  CocoaPods  Support  platform 

LFLiveKit

LFLiveKit is a opensource RTMP streaming SDK for iOS.

Features

  • Background recording
  • Support horizontal vertical recording
  • Support Beauty Face With GPUImage
  • Support H264+AAC Hardware Encoding
  • Drop frames on bad network
  • Dynamic switching rate
  • Audio configuration
  • Video configuration
  • RTMP Transport
  • Switch camera position
  • Audio Mute
  • Support Send Buffer
  • Swift Support
  • FLV package and send

Installation

CocoaPods

# To integrate LFLiveKit into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
pod 'LFLiveKit'

# Then, run the following command:
$ pod install

Architecture:

capture: LFAudioCapture and  LFVideoCapture
encode:  LFHardwareAudioEncoder and LFHardwareVideoEncoder
publish: LFStreamRtmpSocket

Usage:

Objective-C

- (LFLiveSession*)session {
    if (!_session) {
        _session = [[LFLiveSession alloc] initWithAudioConfiguration:[LFLiveAudioConfiguration defaultConfiguration] videoConfiguration:[LFLiveVideoConfiguration defaultConfiguration]];
        _session.preView = self;
        _session.delegate = self;
    }
    return _session;
}
	
- (void)startLive {	
	LFLiveStreamInfo *streamInfo = [LFLiveStreamInfo new];
	streamInfo.url = @"your server rtmp url";
	[self.session startLive:streamInfo];
}

- (void)stopLive {
	[self.session stopLive];
}

//MARK: - CallBack:
- (void)liveSession:(nullable LFLiveSession *)session liveStateDidChange: (LFLiveState)state;
- (void)liveSession:(nullable LFLiveSession *)session debugInfo:(nullable LFLiveDebug*)debugInfo;
- (void)liveSession:(nullable LFLiveSession*)session errorCode:(LFLiveSocketErrorCode)errorCode;
	

Swift

// import LFLiveKit in [ProjectName]-Bridging-Header.h
import <LFLiveKit.h> 

//MARK: - Getters and Setters
lazy var session: LFLiveSession = {
    let audioConfiguration = LFLiveAudioConfiguration.defaultConfiguration()
    let videoConfiguration = LFLiveVideoConfiguration.defaultConfigurationForQuality(LFLiveVideoQuality.Low3, landscape: false)
    let session = LFLiveSession(audioConfiguration: audioConfiguration, videoConfiguration: videoConfiguration)
        
    session?.delegate = self
    session?.preView = self.view
    return session!
}()

//MARK: - Event
func startLive() -> Void { 
    let stream = LFLiveStreamInfo()
    stream.url = "your server rtmp url";
    session.startLive(stream)
}

func stopLive() -> Void {
    session.stopLive()
}

//MARK: - Callback
func liveSession(session: LFLiveSession?, debugInfo: LFLiveDebug?) 
func liveSession(session: LFLiveSession?, errorCode: LFLiveSocketErrorCode)
func liveSession(session: LFLiveSession?, liveStateDidChange state: LFLiveState)

License

LFLiveKit is released under the MIT license. See LICENSE for details.

About

LaiFeng IOS Live Kit,H264 and AAC Hard coding,support GPUImage Beauty, rtmp transmission,weak network lost frame,Dynamic switching rate

License:MIT License


Languages

Language:Objective-C 78.6%Language:Objective-C++ 10.0%Language:C++ 6.3%Language:Swift 4.6%Language:Ruby 0.5%