开发前准备:
1、使用Cocoapod导入LFLiveKit框架
2、合并IJKMediaPlayer库,Release版本和Debug版本
3、MAC配置nginx+rtmp模块推流服务器,参照地址:https://blog.csdn.net/grl18840839630/article/details/80683080
推流实现:
#import "LiveActionViewController.h"
#import <LFLiveKit.h>
#import <AVFoundation/AVFoundation.h>
@interface LiveActionViewController ()<LFLiveSessionDelegate>
@property (nonatomic,strong) LFLiveSession *session;
@end
@implementation LiveActionViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self beatutyfaceBtn];
//录制端
[self requestAccessForVidoe];
[self requestAudio];
[self startLive];
}
- (void)beatutyfaceBtn{
UIButton *actionBtn = [UIButton buttonWithType:UIButtonTypeSystem];
actionBtn.backgroundColor = [UIColor redColor];
[actionBtn setTitle:@"开始直播" forState:UIControlS