Skip to content

Commit dca2550

Browse files
author
chenliming
committed
modify...
1 parent b51c53e commit dca2550

21 files changed

+4143
-10
lines changed

LFLiveKit.podspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
Pod::Spec.new do |s|
33

44
s.name = "LFLiveKit"
5-
s.version = "1.4.1"
5+
s.version = "1.5"
66
s.summary = "LaiFeng ios Live. LFLiveKit."
77
s.homepage = "https://github.com/chenliming777"
88
s.license = { :type => "MIT", :file => "FILE_LICENSE" }
99
s.author = { "chenliming" => "chenliming777@qq.com" }
1010
s.platform = :ios, "8.0"
1111
s.ios.deployment_target = "8.0"
1212
s.source = { :git => "https://github.com/LaiFengiOS/LFLiveKit", :tag => "#{s.version}" }
13-
s.source_files = "LFLiveKit/**/*.{h,m}"
13+
s.source_files = "LFLiveKit/**/*.{*}"
1414
s.public_header_files = "LFLiveKit/**/*.h"
1515

1616
s.frameworks = "VideoToolbox", "AudioToolbox","AVFoundation","Foundation","UIKit"
Binary file not shown.

LFLiveKit/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.4.1</string>
18+
<string>1.5</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

LFLiveKit/LFLiveSession.h

+8-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717

1818
typedef void (^ LFRequestComplete)(_Nullable id info,NSError *_Nullable errorMsg);
1919

20+
/// 流类型
21+
typedef NS_ENUM(NSUInteger, LFLiveType){
22+
/// rtmp格式
23+
LFLiveRTMP = 0,
24+
/// tcp 传输flv格式
25+
LFLiveFLV = 1,
26+
};
2027

2128
@class LFLiveSession;
2229
@protocol LFLiveSessionDelegate <NSObject>
@@ -82,7 +89,7 @@ typedef void (^ LFRequestComplete)(_Nullable id info,NSError *_Nullable errorMsg
8289
The designated initializer. Multiple instances with the same configuration will make the
8390
capture unstable.
8491
*/
85-
- (nullable instancetype)initWithAudioConfiguration:(nullable LFLiveAudioConfiguration*)audioConfiguration videoConfiguration:(nullable LFLiveVideoConfiguration*)videoConfiguration NS_DESIGNATED_INITIALIZER;
92+
- (nullable instancetype)initWithAudioConfiguration:(nullable LFLiveAudioConfiguration*)audioConfiguration videoConfiguration:(nullable LFLiveVideoConfiguration*)videoConfiguration liveType:(LFLiveType)liveType NS_DESIGNATED_INITIALIZER;
8693

8794
/** The start stream .*/
8895
- (void)startLive:(nonnull LFLiveStreamInfo*)streamInfo;

LFLiveKit/LFLiveSession.m

+10-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#import "LFHardwareVideoEncoder.h"
1313
#import "LFHardwareAudioEncoder.h"
1414
#import "LFStreamRtmpSocket.h"
15+
#import "LFStreamTcpSocket.h"
1516
#import "LFLiveStreamInfo.h"
1617

1718
#define LFLiveReportKey @"com.youku.liveSessionReport"
@@ -20,6 +21,8 @@ @interface LFLiveSession ()<LFAudioCaptureDelegate,LFVideoCaptureDelegate,LFAudi
2021
{
2122
dispatch_semaphore_t _lock;
2223
}
24+
///流媒体格式
25+
@property (nonatomic, assign) LFLiveType liveType;
2326
///音频配置
2427
@property (nonatomic, strong) LFLiveAudioConfiguration *audioConfiguration;
2528
///视频配置
@@ -62,11 +65,12 @@ @interface LFLiveSession ()
6265
@implementation LFLiveSession
6366

6467
#pragma mark -- LifeCycle
65-
- (instancetype)initWithAudioConfiguration:(LFLiveAudioConfiguration *)audioConfiguration videoConfiguration:(LFLiveVideoConfiguration *)videoConfiguration{
68+
- (instancetype)initWithAudioConfiguration:(LFLiveAudioConfiguration *)audioConfiguration videoConfiguration:(LFLiveVideoConfiguration *)videoConfiguration liveType:(LFLiveType)liveType{
6669
if(!audioConfiguration || !videoConfiguration) @throw [NSException exceptionWithName:@"LFLiveSession init error" reason:@"audioConfiguration or videoConfiguration is nil " userInfo:nil];
6770
if(self = [super init]){
6871
_audioConfiguration = audioConfiguration;
6972
_videoConfiguration = videoConfiguration;
73+
_liveType = liveType;
7074
_lock = dispatch_semaphore_create(1);
7175
}
7276
return self;
@@ -235,7 +239,11 @@ - (LFVideoCapture*)videoCaptureSource{
235239

236240
- (id<LFStreamSocket>)socket{
237241
if(!_socket){
238-
_socket = [[LFStreamRtmpSocket alloc] initWithStream:self.streamInfo];
242+
if(self.liveType == LFLiveRTMP){
243+
_socket = [[LFStreamRtmpSocket alloc] initWithStream:self.streamInfo];
244+
}else if(self.liveType == LFLiveFLV){
245+
_socket = [[LFStreamTcpSocket alloc] initWithStream:self.streamInfo videoSize:self.videoConfiguration.videoSize reconnectInterval:self.reconnectInterval reconnectCount:self.reconnectCount];
246+
}
239247
[_socket setDelegate:self];
240248
}
241249
return _socket;

LFLiveKit/packet/LFFlvPackage.h

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//
2+
// LFFlvPackage.h
3+
// LFLiveKit
4+
//
5+
// Created by 倾慕 on 16/5/2.
6+
// Copyright © 2016年 倾慕. All rights reserved.
7+
//
8+
9+
#import "LFStreamPackage.h"
10+
11+
@interface LFFlvPackage : NSObject<LFStreamPackage>
12+
13+
#pragma mark - Initializer
14+
///=============================================================================
15+
/// @name Initializer
16+
///=============================================================================
17+
- (nullable instancetype)init UNAVAILABLE_ATTRIBUTE;
18+
+ (nullable instancetype)new UNAVAILABLE_ATTRIBUTE;
19+
20+
@end

0 commit comments

Comments
 (0)