Compare commits

..

34 Commits

Author SHA1 Message Date
chenliming a805106ed2 编译不过呀pod 2016-10-21 14:47:39 +08:00
chenliming e1b8812b25 编译问题 2016-10-21 14:44:53 +08:00
chenliming a130058c5d ... 2016-10-21 14:34:49 +08:00
chenliming 3f804634c5 添加build脚本 2016-10-21 14:26:54 +08:00
chenliming 8b39f68a48 update version 2016-10-20 21:16:49 +08:00
chenliming 1d7b1f7073 添加demo 2016-10-20 21:15:49 +08:00
chenliming 47f35058f3 update version 2016-10-12 20:06:02 +08:00
chenliming a1a7e9aeea fix audioCapture crash 2016-10-12 16:22:49 +08:00
chenliming fabae8ddd8 update version 2016-10-09 10:53:38 +08:00
chenliming 12e1066cae update version 2016-10-08 18:37:42 +08:00
chenliming 05ca0f4f4b update version 2016-10-08 17:05:33 +08:00
chenliming 9e536d2291 add status refresh 2016-10-08 17:02:21 +08:00
chenliming 7bb976d4ae fix bug https://github.com/LaiFengiOS/LFLiveKit/issues/108 2016-10-08 16:09:23 +08:00
chenliming 934d3f29ad changed to async 2016-10-08 14:34:36 +08:00
chenliming 87b3244ba5 fix bug https://github.com/LaiFengiOS/LFLiveKit/issues/105 2016-10-08 14:33:02 +08:00
小歪~~~ 23824e2b74 Merge pull request #104 from hannseman/master
Fixes deadlock in #100
2016-10-08 14:24:25 +08:00
Hannes Ljungberg 71d68c3e6e Fix deadlock by not checking for isRunning and stopping unit in callback. 2016-10-03 09:51:53 +02:00
小歪~~~ d9887180c3 Merge pull request #103 from ScottieLee/dev
Reset compression session when encoding error occurs
2016-09-30 11:38:33 +08:00
LiSi 30eac1282c Reset compression session when encoding error occurs 2016-09-30 10:51:36 +08:00
小歪~~~ 77d6a5b85b Merge pull request #92 from kciter/patch-1
Add syntax highlighting
2016-09-21 16:03:16 +08:00
chenliming 73c9adeb71 fix bug https://github.com/LaiFengiOS/LFLiveKit/issues/96 2016-09-21 16:00:13 +08:00
Lee Sun-Hyoup 7dcda23bf4 Add syntax highlighting 2016-09-17 16:58:01 +09:00
chenliming aa4f259edc save video to local for mp4 2016-09-14 09:15:55 +08:00
chenliming bc5dcef3b7 修改bug 2016-09-12 15:00:26 +08:00
chenliming 782b0c3c71 fix bug https://github.com/LaiFengiOS/LFLiveKit/issues/87 2016-09-12 14:46:33 +08:00
chenliming 34a2fdd3e2 update version 2016-09-07 20:52:23 +08:00
chenliming ae128ab66b modify dealloc bug 2016-09-07 20:51:29 +08:00
chenliming cb164ed1fe fix bug https://github.com/LaiFengiOS/LFLiveKit/issues/78#issuecomment-244348216 2016-09-02 19:43:49 +08:00
chenliming c40b99c19a fix bug https://github.com/LaiFengiOS/LFLiveKit/issues/76 2016-09-02 17:02:20 +08:00
chenliming 2a48333a9a 默认丢帧 2016-09-01 18:44:42 +08:00
chenliming 3c0c2eecb8 fix bug https://github.com/LaiFengiOS/LFLiveKit/issues/75 2016-09-01 14:21:24 +08:00
chenliming 442f04124d fix bug https://github.com/LaiFengiOS/LFLiveKit/issues/74 2016-09-01 14:14:04 +08:00
chenliming c03bd61f37 modify travis 2016-08-31 14:11:25 +08:00
chenliming 161c0acd68 modify readme 2016-08-31 14:10:06 +08:00
324 changed files with 3201 additions and 788 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
language: objective-c
osx_image: xcode7
xcode_project: LFLiveKit/LFLiveKit.xcodeproj
xcode_project: FrameWork/LFLiveKit.xcodeproj
xcode_scheme: LFLiveKit
script:
- xctool -project LFLiveKit/LFLiveKit.xcodeproj -scheme 'LFLiveKit' -configuration Release -sdk iphonesimulator -arch i386 build
- xctool -project FrameWork/LFLiveKit.xcodeproj -scheme 'LFLiveKit' -configuration Release -sdk iphonesimulator -arch i386 build
+1 -1
View File
@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.2.4.3</string>
<string>2.4.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
+349 -21
View File
@@ -6,7 +6,70 @@
objectVersion = 46;
objects = {
/* Begin PBXAggregateTarget section */
84D003751DB8FE1000560583 /* LFLiveKitFramework-universal */ = {
isa = PBXAggregateTarget;
buildConfigurationList = 84D003761DB8FE1000560583 /* Build configuration list for PBXAggregateTarget "LFLiveKitFramework-universal" */;
buildPhases = (
84D0037B1DB8FE1C00560583 /* ShellScript */,
);
dependencies = (
84D0037A1DB8FE1800560583 /* PBXTargetDependency */,
);
name = "LFLiveKitFramework-universal";
productName = "LFLiveKitFramework-universal";
};
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
8495F66F1DB8F14600542124 /* LFLiveKitFramework.h in Headers */ = {isa = PBXBuildFile; fileRef = 8495F66D1DB8F14600542124 /* LFLiveKitFramework.h */; settings = {ATTRIBUTES = (Public, ); }; };
8495F6731DB8F1EE00542124 /* LFAudioCapture.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5851D768B6E00752B56 /* LFAudioCapture.h */; };
8495F6741DB8F1EE00542124 /* LFVideoCapture.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5871D768B6E00752B56 /* LFVideoCapture.h */; };
8495F6751DB8F1EE00542124 /* LFAVEncoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B58B1D768B6E00752B56 /* LFAVEncoder.h */; };
8495F6761DB8F1EE00542124 /* LFMP4Atom.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B58D1D768B6E00752B56 /* LFMP4Atom.h */; };
8495F6771DB8F1EE00542124 /* LFNALUnit.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5901D768B6E00752B56 /* LFNALUnit.h */; };
8495F6781DB8F1EE00542124 /* LFVideoEncoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5911D768B6E00752B56 /* LFVideoEncoder.h */; };
8495F6791DB8F1EE00542124 /* LFAudioEncoding.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5931D768B6E00752B56 /* LFAudioEncoding.h */; };
8495F67A1DB8F1EE00542124 /* LFH264VideoEncoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5941D768B6E00752B56 /* LFH264VideoEncoder.h */; };
8495F67B1DB8F1EE00542124 /* LFHardwareAudioEncoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5961D768B6E00752B56 /* LFHardwareAudioEncoder.h */; };
8495F67C1DB8F1EE00542124 /* LFHardwareVideoEncoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5981D768B6E00752B56 /* LFHardwareVideoEncoder.h */; };
8495F67D1DB8F1EE00542124 /* LFVideoEncoding.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B59A1D768B6E00752B56 /* LFVideoEncoding.h */; };
8495F67E1DB8F1EE00542124 /* LFLiveAudioConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B59C1D768B6E00752B56 /* LFLiveAudioConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; };
8495F67F1DB8F1EE00542124 /* LFLiveVideoConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B59E1D768B6E00752B56 /* LFLiveVideoConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; };
8495F6801DB8F1EE00542124 /* LFGPUImageBeautyFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5A11D768B6E00752B56 /* LFGPUImageBeautyFilter.h */; };
8495F6811DB8F1EE00542124 /* LFGPUImageEmptyFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5A31D768B6E00752B56 /* LFGPUImageEmptyFilter.h */; };
8495F6831DB8F1EE00542124 /* LFLiveSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5A61D768B6E00752B56 /* LFLiveSession.h */; settings = {ATTRIBUTES = (Public, ); }; };
8495F6841DB8F1EE00542124 /* LFAudioFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5A91D768B6E00752B56 /* LFAudioFrame.h */; settings = {ATTRIBUTES = (Public, ); }; };
8495F6851DB8F1EE00542124 /* LFFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5AB1D768B6E00752B56 /* LFFrame.h */; settings = {ATTRIBUTES = (Public, ); }; };
8495F6861DB8F1EE00542124 /* LFLiveDebug.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5AD1D768B6E00752B56 /* LFLiveDebug.h */; settings = {ATTRIBUTES = (Public, ); }; };
8495F6871DB8F1EE00542124 /* LFLiveStreamInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5AF1D768B6E00752B56 /* LFLiveStreamInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
8495F6881DB8F1EE00542124 /* LFVideoFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5B11D768B6E00752B56 /* LFVideoFrame.h */; settings = {ATTRIBUTES = (Public, ); }; };
8495F6891DB8F1EE00542124 /* LFStreamingBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5B41D768B6E00752B56 /* LFStreamingBuffer.h */; };
8495F68A1DB8F1EE00542124 /* LFStreamRTMPSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5B61D768B6E00752B56 /* LFStreamRTMPSocket.h */; };
8495F68B1DB8F1EE00542124 /* LFStreamSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5B81D768B6E00752B56 /* LFStreamSocket.h */; };
8495F68C1DB8F1EE00542124 /* NSMutableArray+LFAdd.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5B91D768B6E00752B56 /* NSMutableArray+LFAdd.h */; };
8495F68D1DB8F27000542124 /* LFAudioCapture.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5861D768B6E00752B56 /* LFAudioCapture.m */; };
8495F68E1DB8F27000542124 /* LFVideoCapture.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5881D768B6E00752B56 /* LFVideoCapture.m */; };
8495F68F1DB8F27000542124 /* LFAVEncoder.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B58C1D768B6E00752B56 /* LFAVEncoder.mm */; };
8495F6901DB8F27000542124 /* LFMP4Atom.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B58E1D768B6E00752B56 /* LFMP4Atom.m */; };
8495F6911DB8F27000542124 /* LFVideoEncoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5921D768B6E00752B56 /* LFVideoEncoder.m */; };
8495F6921DB8F27000542124 /* LFH264VideoEncoder.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5951D768B6E00752B56 /* LFH264VideoEncoder.mm */; };
8495F6931DB8F27000542124 /* LFHardwareAudioEncoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5971D768B6E00752B56 /* LFHardwareAudioEncoder.m */; };
8495F6941DB8F27000542124 /* LFHardwareVideoEncoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5991D768B6E00752B56 /* LFHardwareVideoEncoder.m */; };
8495F6951DB8F27000542124 /* LFLiveAudioConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B59D1D768B6E00752B56 /* LFLiveAudioConfiguration.m */; };
8495F6961DB8F27000542124 /* LFLiveVideoConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B59F1D768B6E00752B56 /* LFLiveVideoConfiguration.m */; };
8495F6971DB8F27000542124 /* LFGPUImageBeautyFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5A21D768B6E00752B56 /* LFGPUImageBeautyFilter.m */; };
8495F6981DB8F27000542124 /* LFGPUImageEmptyFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5A41D768B6E00752B56 /* LFGPUImageEmptyFilter.m */; };
8495F6991DB8F27000542124 /* LFLiveSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5A71D768B6E00752B56 /* LFLiveSession.m */; };
8495F69A1DB8F27000542124 /* LFAudioFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5AA1D768B6E00752B56 /* LFAudioFrame.m */; };
8495F69B1DB8F27000542124 /* LFFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5AC1D768B6E00752B56 /* LFFrame.m */; };
8495F69C1DB8F27000542124 /* LFLiveDebug.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5AE1D768B6E00752B56 /* LFLiveDebug.m */; };
8495F69D1DB8F27000542124 /* LFLiveStreamInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5B01D768B6E00752B56 /* LFLiveStreamInfo.m */; };
8495F69E1DB8F27000542124 /* LFVideoFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5B21D768B6E00752B56 /* LFVideoFrame.m */; };
8495F69F1DB8F27000542124 /* LFStreamingBuffer.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5B51D768B6E00752B56 /* LFStreamingBuffer.m */; };
8495F6A01DB8F27000542124 /* LFStreamRtmpSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5B71D768B6E00752B56 /* LFStreamRtmpSocket.m */; };
8495F6A11DB8F27000542124 /* NSMutableArray+LFAdd.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5BA1D768B6E00752B56 /* NSMutableArray+LFAdd.m */; };
84D0036F1DB8F88F00560583 /* LFNALUnit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B58F1D768B6E00752B56 /* LFNALUnit.cpp */; };
84D8B4BF1D757EB800752B56 /* VideoToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D8B4BE1D757EB800752B56 /* VideoToolbox.framework */; };
84D8B4C11D757EBE00752B56 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D8B4C01D757EBE00752B56 /* AudioToolbox.framework */; };
84D8B4C31D757EC400752B56 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D8B4C21D757EC400752B56 /* AVFoundation.framework */; };
@@ -32,26 +95,26 @@
84D8B5CC1D768B6E00752B56 /* LFHardwareVideoEncoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5981D768B6E00752B56 /* LFHardwareVideoEncoder.h */; };
84D8B5CD1D768B6E00752B56 /* LFHardwareVideoEncoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5991D768B6E00752B56 /* LFHardwareVideoEncoder.m */; };
84D8B5CE1D768B6E00752B56 /* LFVideoEncoding.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B59A1D768B6E00752B56 /* LFVideoEncoding.h */; };
84D8B5CF1D768B6E00752B56 /* LFLiveAudioConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B59C1D768B6E00752B56 /* LFLiveAudioConfiguration.h */; };
84D8B5CF1D768B6E00752B56 /* LFLiveAudioConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B59C1D768B6E00752B56 /* LFLiveAudioConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; };
84D8B5D01D768B6E00752B56 /* LFLiveAudioConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B59D1D768B6E00752B56 /* LFLiveAudioConfiguration.m */; };
84D8B5D11D768B6E00752B56 /* LFLiveVideoConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B59E1D768B6E00752B56 /* LFLiveVideoConfiguration.h */; };
84D8B5D11D768B6E00752B56 /* LFLiveVideoConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B59E1D768B6E00752B56 /* LFLiveVideoConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; };
84D8B5D21D768B6E00752B56 /* LFLiveVideoConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B59F1D768B6E00752B56 /* LFLiveVideoConfiguration.m */; };
84D8B5D31D768B6E00752B56 /* LFGPUImageBeautyFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5A11D768B6E00752B56 /* LFGPUImageBeautyFilter.h */; };
84D8B5D41D768B6E00752B56 /* LFGPUImageBeautyFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5A21D768B6E00752B56 /* LFGPUImageBeautyFilter.m */; };
84D8B5D51D768B6E00752B56 /* LFGPUImageEmptyFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5A31D768B6E00752B56 /* LFGPUImageEmptyFilter.h */; };
84D8B5D61D768B6E00752B56 /* LFGPUImageEmptyFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5A41D768B6E00752B56 /* LFGPUImageEmptyFilter.m */; };
84D8B5D71D768B6E00752B56 /* LFLiveKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5A51D768B6E00752B56 /* LFLiveKit.h */; };
84D8B5D81D768B6E00752B56 /* LFLiveSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5A61D768B6E00752B56 /* LFLiveSession.h */; };
84D8B5D71D768B6E00752B56 /* LFLiveKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5A51D768B6E00752B56 /* LFLiveKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
84D8B5D81D768B6E00752B56 /* LFLiveSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5A61D768B6E00752B56 /* LFLiveSession.h */; settings = {ATTRIBUTES = (Public, ); }; };
84D8B5D91D768B6E00752B56 /* LFLiveSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5A71D768B6E00752B56 /* LFLiveSession.m */; };
84D8B5DA1D768B6E00752B56 /* LFAudioFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5A91D768B6E00752B56 /* LFAudioFrame.h */; };
84D8B5DA1D768B6E00752B56 /* LFAudioFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5A91D768B6E00752B56 /* LFAudioFrame.h */; settings = {ATTRIBUTES = (Public, ); }; };
84D8B5DB1D768B6E00752B56 /* LFAudioFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5AA1D768B6E00752B56 /* LFAudioFrame.m */; };
84D8B5DC1D768B6E00752B56 /* LFFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5AB1D768B6E00752B56 /* LFFrame.h */; };
84D8B5DC1D768B6E00752B56 /* LFFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5AB1D768B6E00752B56 /* LFFrame.h */; settings = {ATTRIBUTES = (Public, ); }; };
84D8B5DD1D768B6E00752B56 /* LFFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5AC1D768B6E00752B56 /* LFFrame.m */; };
84D8B5DE1D768B6E00752B56 /* LFLiveDebug.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5AD1D768B6E00752B56 /* LFLiveDebug.h */; };
84D8B5DE1D768B6E00752B56 /* LFLiveDebug.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5AD1D768B6E00752B56 /* LFLiveDebug.h */; settings = {ATTRIBUTES = (Public, ); }; };
84D8B5DF1D768B6E00752B56 /* LFLiveDebug.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5AE1D768B6E00752B56 /* LFLiveDebug.m */; };
84D8B5E01D768B6E00752B56 /* LFLiveStreamInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5AF1D768B6E00752B56 /* LFLiveStreamInfo.h */; };
84D8B5E01D768B6E00752B56 /* LFLiveStreamInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5AF1D768B6E00752B56 /* LFLiveStreamInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
84D8B5E11D768B6E00752B56 /* LFLiveStreamInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5B01D768B6E00752B56 /* LFLiveStreamInfo.m */; };
84D8B5E21D768B6E00752B56 /* LFVideoFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5B11D768B6E00752B56 /* LFVideoFrame.h */; };
84D8B5E21D768B6E00752B56 /* LFVideoFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5B11D768B6E00752B56 /* LFVideoFrame.h */; settings = {ATTRIBUTES = (Public, ); }; };
84D8B5E31D768B6E00752B56 /* LFVideoFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5B21D768B6E00752B56 /* LFVideoFrame.m */; };
84D8B5E41D768B6E00752B56 /* LFStreamingBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5B41D768B6E00752B56 /* LFStreamingBuffer.h */; };
84D8B5E51D768B6E00752B56 /* LFStreamingBuffer.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5B51D768B6E00752B56 /* LFStreamingBuffer.m */; };
@@ -62,7 +125,20 @@
84D8B5EA1D768B6E00752B56 /* NSMutableArray+LFAdd.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5BA1D768B6E00752B56 /* NSMutableArray+LFAdd.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
84D003791DB8FE1800560583 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 84D8B3871D7574D600752B56 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 8495F66A1DB8F14600542124;
remoteInfo = LFLiveKitFramework;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
8495F66B1DB8F14600542124 /* LFLiveKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = LFLiveKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
8495F66D1DB8F14600542124 /* LFLiveKitFramework.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LFLiveKitFramework.h; sourceTree = "<group>"; };
8495F66E1DB8F14600542124 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
84D8B3901D7574D600752B56 /* LFLiveKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = LFLiveKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
84D8B4BE1D757EB800752B56 /* VideoToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = VideoToolbox.framework; path = System/Library/Frameworks/VideoToolbox.framework; sourceTree = SDKROOT; };
84D8B4C01D757EBE00752B56 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
@@ -122,6 +198,13 @@
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
8495F6671DB8F14600542124 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
84D8B38C1D7574D600752B56 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@@ -137,6 +220,15 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
8495F66C1DB8F14600542124 /* LFLiveKitFramework */ = {
isa = PBXGroup;
children = (
8495F66D1DB8F14600542124 /* LFLiveKitFramework.h */,
8495F66E1DB8F14600542124 /* Info.plist */,
);
path = LFLiveKitFramework;
sourceTree = "<group>";
};
84D8B3861D7574D600752B56 = {
isa = PBXGroup;
children = (
@@ -148,7 +240,9 @@
84D8B4C21D757EC400752B56 /* AVFoundation.framework */,
84D8B4C01D757EBE00752B56 /* AudioToolbox.framework */,
84D8B4BE1D757EB800752B56 /* VideoToolbox.framework */,
8495F66C1DB8F14600542124 /* LFLiveKitFramework */,
84D8B3911D7574D600752B56 /* Products */,
9ABACAFFC334034AA0115426 /* Frameworks */,
);
sourceTree = "<group>";
};
@@ -156,6 +250,7 @@
isa = PBXGroup;
children = (
84D8B3901D7574D600752B56 /* LFLiveKit.framework */,
8495F66B1DB8F14600542124 /* LFLiveKit.framework */,
);
name = Products;
sourceTree = "<group>";
@@ -272,9 +367,49 @@
path = publish;
sourceTree = "<group>";
};
9ABACAFFC334034AA0115426 /* Frameworks */ = {
isa = PBXGroup;
children = (
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
8495F6681DB8F14600542124 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
8495F6861DB8F1EE00542124 /* LFLiveDebug.h in Headers */,
8495F6881DB8F1EE00542124 /* LFVideoFrame.h in Headers */,
8495F6871DB8F1EE00542124 /* LFLiveStreamInfo.h in Headers */,
8495F6851DB8F1EE00542124 /* LFFrame.h in Headers */,
8495F6841DB8F1EE00542124 /* LFAudioFrame.h in Headers */,
8495F67F1DB8F1EE00542124 /* LFLiveVideoConfiguration.h in Headers */,
8495F67E1DB8F1EE00542124 /* LFLiveAudioConfiguration.h in Headers */,
8495F6831DB8F1EE00542124 /* LFLiveSession.h in Headers */,
8495F66F1DB8F14600542124 /* LFLiveKitFramework.h in Headers */,
8495F6731DB8F1EE00542124 /* LFAudioCapture.h in Headers */,
8495F6741DB8F1EE00542124 /* LFVideoCapture.h in Headers */,
8495F6751DB8F1EE00542124 /* LFAVEncoder.h in Headers */,
8495F6761DB8F1EE00542124 /* LFMP4Atom.h in Headers */,
8495F6771DB8F1EE00542124 /* LFNALUnit.h in Headers */,
8495F6781DB8F1EE00542124 /* LFVideoEncoder.h in Headers */,
8495F6791DB8F1EE00542124 /* LFAudioEncoding.h in Headers */,
8495F67A1DB8F1EE00542124 /* LFH264VideoEncoder.h in Headers */,
8495F67B1DB8F1EE00542124 /* LFHardwareAudioEncoder.h in Headers */,
8495F67C1DB8F1EE00542124 /* LFHardwareVideoEncoder.h in Headers */,
8495F67D1DB8F1EE00542124 /* LFVideoEncoding.h in Headers */,
8495F6801DB8F1EE00542124 /* LFGPUImageBeautyFilter.h in Headers */,
8495F6811DB8F1EE00542124 /* LFGPUImageEmptyFilter.h in Headers */,
8495F6891DB8F1EE00542124 /* LFStreamingBuffer.h in Headers */,
8495F68A1DB8F1EE00542124 /* LFStreamRTMPSocket.h in Headers */,
8495F68B1DB8F1EE00542124 /* LFStreamSocket.h in Headers */,
8495F68C1DB8F1EE00542124 /* NSMutableArray+LFAdd.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
84D8B38D1D7574D600752B56 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
@@ -282,27 +417,27 @@
84D8B5DE1D768B6E00752B56 /* LFLiveDebug.h in Headers */,
84D8B5CF1D768B6E00752B56 /* LFLiveAudioConfiguration.h in Headers */,
84D8B5DA1D768B6E00752B56 /* LFAudioFrame.h in Headers */,
84D8B5E01D768B6E00752B56 /* LFLiveStreamInfo.h in Headers */,
84D8B5D11D768B6E00752B56 /* LFLiveVideoConfiguration.h in Headers */,
84D8B5DC1D768B6E00752B56 /* LFFrame.h in Headers */,
84D8B5D71D768B6E00752B56 /* LFLiveKit.h in Headers */,
84D8B5D81D768B6E00752B56 /* LFLiveSession.h in Headers */,
84D8B5E21D768B6E00752B56 /* LFVideoFrame.h in Headers */,
84D8B5BB1D768B6E00752B56 /* LFAudioCapture.h in Headers */,
84D8B5E61D768B6E00752B56 /* LFStreamRTMPSocket.h in Headers */,
84D8B5C11D768B6E00752B56 /* LFMP4Atom.h in Headers */,
84D8B5D31D768B6E00752B56 /* LFGPUImageBeautyFilter.h in Headers */,
84D8B5BF1D768B6E00752B56 /* LFAVEncoder.h in Headers */,
84D8B5E01D768B6E00752B56 /* LFLiveStreamInfo.h in Headers */,
84D8B5C51D768B6E00752B56 /* LFVideoEncoder.h in Headers */,
84D8B5D11D768B6E00752B56 /* LFLiveVideoConfiguration.h in Headers */,
84D8B5D51D768B6E00752B56 /* LFGPUImageEmptyFilter.h in Headers */,
84D8B5C71D768B6E00752B56 /* LFAudioEncoding.h in Headers */,
84D8B5DC1D768B6E00752B56 /* LFFrame.h in Headers */,
84D8B5E91D768B6E00752B56 /* NSMutableArray+LFAdd.h in Headers */,
84D8B5CC1D768B6E00752B56 /* LFHardwareVideoEncoder.h in Headers */,
84D8B5BD1D768B6E00752B56 /* LFVideoCapture.h in Headers */,
84D8B5D71D768B6E00752B56 /* LFLiveKit.h in Headers */,
84D8B5E81D768B6E00752B56 /* LFStreamSocket.h in Headers */,
84D8B5D81D768B6E00752B56 /* LFLiveSession.h in Headers */,
84D8B5C41D768B6E00752B56 /* LFNALUnit.h in Headers */,
84D8B5CA1D768B6E00752B56 /* LFHardwareAudioEncoder.h in Headers */,
84D8B5CE1D768B6E00752B56 /* LFVideoEncoding.h in Headers */,
84D8B5E21D768B6E00752B56 /* LFVideoFrame.h in Headers */,
84D8B5E41D768B6E00752B56 /* LFStreamingBuffer.h in Headers */,
84D8B5C81D768B6E00752B56 /* LFH264VideoEncoder.h in Headers */,
);
@@ -311,6 +446,25 @@
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
8495F66A1DB8F14600542124 /* LFLiveKitFramework */ = {
isa = PBXNativeTarget;
buildConfigurationList = 8495F6701DB8F14600542124 /* Build configuration list for PBXNativeTarget "LFLiveKitFramework" */;
buildPhases = (
8495F6661DB8F14600542124 /* Sources */,
8495F6671DB8F14600542124 /* Frameworks */,
8495F6681DB8F14600542124 /* Headers */,
8495F6691DB8F14600542124 /* Resources */,
84D0037D1DB9023F00560583 /* ShellScript */,
);
buildRules = (
);
dependencies = (
);
name = LFLiveKitFramework;
productName = LFLiveKitFramework;
productReference = 8495F66B1DB8F14600542124 /* LFLiveKit.framework */;
productType = "com.apple.product-type.framework";
};
84D8B38F1D7574D600752B56 /* LFLiveKit */ = {
isa = PBXNativeTarget;
buildConfigurationList = 84D8B3981D7574D600752B56 /* Build configuration list for PBXNativeTarget "LFLiveKit" */;
@@ -318,7 +472,6 @@
84D8B38B1D7574D600752B56 /* Sources */,
84D8B38C1D7574D600752B56 /* Frameworks */,
84D8B38D1D7574D600752B56 /* Headers */,
84D8B38E1D7574D600752B56 /* Resources */,
);
buildRules = (
);
@@ -338,6 +491,15 @@
LastUpgradeCheck = 0730;
ORGANIZATIONNAME = admin;
TargetAttributes = {
8495F66A1DB8F14600542124 = {
CreatedOnToolsVersion = 8.0;
ProvisioningStyle = Automatic;
};
84D003751DB8FE1000560583 = {
CreatedOnToolsVersion = 8.0;
DevelopmentTeam = G497YX6CBT;
ProvisioningStyle = Automatic;
};
84D8B38F1D7574D600752B56 = {
CreatedOnToolsVersion = 7.3.1;
};
@@ -356,12 +518,14 @@
projectRoot = "";
targets = (
84D8B38F1D7574D600752B56 /* LFLiveKit */,
8495F66A1DB8F14600542124 /* LFLiveKitFramework */,
84D003751DB8FE1000560583 /* LFLiveKitFramework-universal */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
84D8B38E1D7574D600752B56 /* Resources */ = {
8495F6691DB8F14600542124 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
@@ -370,7 +534,65 @@
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
84D0037B1DB8FE1C00560583 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "../scripts/build-universal-framework.sh\n";
};
84D0037D1DB9023F00560583 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "echo \"${env}\"";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
8495F6661DB8F14600542124 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
84D0036F1DB8F88F00560583 /* LFNALUnit.cpp in Sources */,
8495F68D1DB8F27000542124 /* LFAudioCapture.m in Sources */,
8495F68E1DB8F27000542124 /* LFVideoCapture.m in Sources */,
8495F68F1DB8F27000542124 /* LFAVEncoder.mm in Sources */,
8495F6901DB8F27000542124 /* LFMP4Atom.m in Sources */,
8495F6911DB8F27000542124 /* LFVideoEncoder.m in Sources */,
8495F6921DB8F27000542124 /* LFH264VideoEncoder.mm in Sources */,
8495F6931DB8F27000542124 /* LFHardwareAudioEncoder.m in Sources */,
8495F6941DB8F27000542124 /* LFHardwareVideoEncoder.m in Sources */,
8495F6951DB8F27000542124 /* LFLiveAudioConfiguration.m in Sources */,
8495F6961DB8F27000542124 /* LFLiveVideoConfiguration.m in Sources */,
8495F6971DB8F27000542124 /* LFGPUImageBeautyFilter.m in Sources */,
8495F6981DB8F27000542124 /* LFGPUImageEmptyFilter.m in Sources */,
8495F6991DB8F27000542124 /* LFLiveSession.m in Sources */,
8495F69A1DB8F27000542124 /* LFAudioFrame.m in Sources */,
8495F69B1DB8F27000542124 /* LFFrame.m in Sources */,
8495F69C1DB8F27000542124 /* LFLiveDebug.m in Sources */,
8495F69D1DB8F27000542124 /* LFLiveStreamInfo.m in Sources */,
8495F69E1DB8F27000542124 /* LFVideoFrame.m in Sources */,
8495F69F1DB8F27000542124 /* LFStreamingBuffer.m in Sources */,
8495F6A01DB8F27000542124 /* LFStreamRtmpSocket.m in Sources */,
8495F6A11DB8F27000542124 /* NSMutableArray+LFAdd.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
84D8B38B1D7574D600752B56 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@@ -402,7 +624,93 @@
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
84D0037A1DB8FE1800560583 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 8495F66A1DB8F14600542124 /* LFLiveKitFramework */;
targetProxy = 84D003791DB8FE1800560583 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
8495F6711DB8F14600542124 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_SUSPICIOUS_MOVES = YES;
CODE_SIGN_IDENTITY = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"\"$(SRCROOT)/../samples/LFLiveKitFrameworkDemo/vendors/GPUImage.framework\"",
"\"$(SRCROOT)/../samples/LFLiveKitFrameworkDemo/vendors/pili-librtmp.framework\"",
);
HEADER_SEARCH_PATHS = (
"\"$(SRCROOT)/../samples/LFLiveKitFrameworkDemo/vendors/GPUImage.framework/Headers\"",
"\"$(SRCROOT)/../samples/LFLiveKitFrameworkDemo/vendors/pili-librtmp.framework/Headers\"",
);
INFOPLIST_FILE = LFLiveKitFramework/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MACH_O_TYPE = staticlib;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = com.youku.LFLiveKit;
PRODUCT_NAME = LFLiveKit;
SKIP_INSTALL = YES;
};
name = Debug;
};
8495F6721DB8F14600542124 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_SUSPICIOUS_MOVES = YES;
CODE_SIGN_IDENTITY = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"\"$(SRCROOT)/../samples/LFLiveKitFrameworkDemo/vendors/GPUImage.framework\"",
"\"$(SRCROOT)/../samples/LFLiveKitFrameworkDemo/vendors/pili-librtmp.framework\"",
);
HEADER_SEARCH_PATHS = (
"\"$(SRCROOT)/../samples/LFLiveKitFrameworkDemo/vendors/GPUImage.framework/Headers\"",
"\"$(SRCROOT)/../samples/LFLiveKitFrameworkDemo/vendors/pili-librtmp.framework/Headers\"",
);
INFOPLIST_FILE = LFLiveKitFramework/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MACH_O_TYPE = staticlib;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = com.youku.LFLiveKit;
PRODUCT_NAME = LFLiveKit;
SKIP_INSTALL = YES;
};
name = Release;
};
84D003771DB8FE1000560583 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEVELOPMENT_TEAM = G497YX6CBT;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
84D003781DB8FE1000560583 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEVELOPMENT_TEAM = G497YX6CBT;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
84D8B3961D7574D600752B56 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -501,13 +809,14 @@
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
HEADER_SEARCH_PATHS = (
"\"$(SRCROOT)/../Vendor/GPUImage.framework/Headers\"",
"\"$(SRCROOT)/../Vendor/pili-librtmp.framework/Headers\"",
"$(inherited)",
"\"$(SRCROOT)/../samples/LFLiveKitDemo/Pods\"/**",
);
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)";
MACH_O_TYPE = staticlib;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = com.youku.LFLiveKit;
@@ -524,13 +833,14 @@
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
HEADER_SEARCH_PATHS = (
"\"$(SRCROOT)/../Vendor/GPUImage.framework/Headers\"",
"\"$(SRCROOT)/../Vendor/pili-librtmp.framework/Headers\"",
"$(inherited)",
"\"$(SRCROOT)/../samples/LFLiveKitDemo/Pods\"/**",
);
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)";
MACH_O_TYPE = staticlib;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = com.youku.LFLiveKit;
@@ -542,6 +852,24 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
8495F6701DB8F14600542124 /* Build configuration list for PBXNativeTarget "LFLiveKitFramework" */ = {
isa = XCConfigurationList;
buildConfigurations = (
8495F6711DB8F14600542124 /* Debug */,
8495F6721DB8F14600542124 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
84D003761DB8FE1000560583 /* Build configuration list for PBXAggregateTarget "LFLiveKitFramework-universal" */ = {
isa = XCConfigurationList;
buildConfigurations = (
84D003771DB8FE1000560583 /* Debug */,
84D003781DB8FE1000560583 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
84D8B38A1D7574D600752B56 /* Build configuration list for PBXProject "LFLiveKit" */ = {
isa = XCConfigurationList;
buildConfigurations = (
+24
View File
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.4.3</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
@@ -0,0 +1,26 @@
//
// LFLiveKitFramework.h
// LFLiveKitFramework
//
// Created by admin on 2016/10/20.
// Copyright © 2016年 admin. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for LFLiveKitFramework.
FOUNDATION_EXPORT double LFLiveKitFrameworkVersionNumber;
//! Project version string for LFLiveKitFramework.
FOUNDATION_EXPORT const unsigned char LFLiveKitFrameworkVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <LFLiveKitFramework/PublicHeader.h>
#import <LFLiveKit/LFLiveSession.h>
#import <LFLiveKit/LFLiveAudioConfiguration.h>
#import <LFLiveKit/LFLiveVideoConfiguration.h>
#import <LFLiveKit/LFAudioFrame.h>
#import <LFLiveKit/LFFrame.h>
#import <LFLiveKit/LFLiveStreamInfo.h>
#import <LFLiveKit/LFVideoFrame.h>
#import <LFLiveKit/LFLiveDebug.h>
+3 -4
View File
@@ -2,7 +2,7 @@
Pod::Spec.new do |s|
s.name = "LFLiveKit"
s.version = "2.2.4.3"
s.version = "2.4.3"
s.summary = "LaiFeng ios Live. LFLiveKit."
s.homepage = "https://github.com/chenliming777"
s.license = { :type => "MIT", :file => "LICENSE" }
@@ -17,7 +17,6 @@ Pod::Spec.new do |s|
s.libraries = "c++", "z"
s.requires_arc = true
s.ios.vendored_frameworks = 'Vendor/GPUImage.framework','Vendor/pili-librtmp.framework'
#s.dependency 'LMGPUImage'
#s.dependency 'pili-librtmp', '1.0.3.1'
s.dependency 'GPUImage'
s.dependency 'pili-librtmp', '1.0.3.1'
end
+6 -12
View File
@@ -2,20 +2,13 @@
// LFLiveKit.h
// LFLiveKit
//
// Created by admin on 16/5/24.
// Copyright © 2016年 admin. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#if __has_include(<LFLiveKit/LFLiveKit.h>)
#import <LFLiveKit/LFLiveSession.h>
#import <LFLiveKit/LFLiveAudioConfiguration.h>
#import <LFLiveKit/LFLiveVideoConfiguration.h>
#import <LFLiveKit/LFAudioFrame.h>
#import <LFLiveKit/LFFrame.h>
#import <LFLiveKit/LFLiveStreamInfo.h>
#import <LFLiveKit/LFVideoFrame.h>
#import <LFLiveKit/LFLiveDebug.h>
#else
#ifndef LFLiveKit_h
#define LFLiveKit_h
#import "LFLiveSession.h"
#import "LFLiveAudioConfiguration.h"
#import "LFLiveVideoConfiguration.h"
@@ -24,5 +17,6 @@
#import "LFLiveStreamInfo.h"
#import "LFVideoFrame.h"
#import "LFLiveDebug.h"
#endif
+11 -12
View File
@@ -2,20 +2,13 @@
// LFLiveSession.h
// LFLiveKit
//
// Created by 倾慕 on 16/5/2.
// Copyright © 2016年 倾慕. All rights reserved.
//
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#if __has_include(<LFLiveKit/LFLiveKit.h>)
#import <LFLiveKit/LFLiveStreamInfo.h>
#import <LFLiveKit/LFAudioFrame.h>
#import <LFLiveKit/LFVideoFrame.h>
#import <LFLiveKit/LFLiveAudioConfiguration.h>
#import <LFLiveKit/LFLiveVideoConfiguration.h>
#import <LFLiveKit/LFLiveDebug.h>
#else
#import "LFLiveStreamInfo.h"
#import "LFAudioFrame.h"
#import "LFVideoFrame.h"
@@ -23,8 +16,6 @@
#import "LFLiveVideoConfiguration.h"
#import "LFLiveDebug.h"
#endif
typedef NS_ENUM(NSInteger,LFLiveCaptureType) {
@@ -127,7 +118,15 @@ typedef NS_ENUM(NSInteger,LFLiveCaptureTypeMask) {
*.*/
@property (nonatomic, strong, nullable) UIView *warterMarkView;
/* The currentImage is videoCapture shot */
@property (nonatomic, strong,readonly ,nullable) UIImage *currentImage;
/* The saveLocalVideo is save the local video */
@property (nonatomic, assign) BOOL saveLocalVideo;
/* The saveLocalVideoPath is save the local video path */
@property (nonatomic, strong, nullable) NSURL *saveLocalVideoPath;
#pragma mark - Initializer
///=============================================================================
/// @name Initializer
+30 -14
View File
@@ -2,8 +2,8 @@
// LFLiveSession.m
// LFLiveKit
//
// Created by 倾慕 on 16/5/2.
// Copyright © 2016年 倾慕. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#import "LFLiveSession.h"
@@ -90,8 +90,8 @@
}
- (void)dealloc {
self.videoCaptureSource.running = NO;
self.audioCaptureSource.running = NO;
_videoCaptureSource.running = NO;
_audioCaptureSource.running = NO;
}
#pragma mark -- CustomMethod
@@ -100,7 +100,6 @@
_streamInfo = streamInfo;
_streamInfo.videoConfiguration = _videoConfiguration;
_streamInfo.audioConfiguration = _audioConfiguration;
_streamInfo.needDropFrame = (self.captureType & LFLiveCaptureMaskVideo || self.captureType & LFLiveInputMaskVideo) ? YES : NO;//< 有视频执行丢帧算法
[self.socket start];
}
@@ -110,15 +109,6 @@
self.socket = nil;
}
#pragma mark -- PrivateMethod
- (void)pushSendBuffer:(LFFrame*)frame{
if(self.relativeTimestamps == 0){
self.relativeTimestamps = frame.timestamp;
}
frame.timestamp = [self uploadTimestamp:frame.timestamp];
[self.socket sendFrame:frame];
}
- (void)pushVideo:(nullable CVPixelBufferRef)pixelBuffer{
if(self.captureType & LFLiveInputMaskVideo){
if (self.uploading) [self.videoEncoder encodeVideoData:pixelBuffer timeStamp:NOW];
@@ -131,6 +121,15 @@
}
}
#pragma mark -- PrivateMethod
- (void)pushSendBuffer:(LFFrame*)frame{
if(self.relativeTimestamps == 0){
self.relativeTimestamps = frame.timestamp;
}
frame.timestamp = [self uploadTimestamp:frame.timestamp];
[self.socket sendFrame:frame];
}
#pragma mark -- CaptureDelegate
- (void)captureOutput:(nullable LFAudioCapture *)capture audioData:(nullable NSData*)audioData {
if (self.uploading) [self.audioEncoder encodeAudioData:audioData timeStamp:NOW];
@@ -252,6 +251,23 @@
[self didChangeValueForKey:@"beautyFace"];
}
- (BOOL)saveLocalVideo{
return self.videoCaptureSource.saveLocalVideo;
}
- (void)setSaveLocalVideo:(BOOL)saveLocalVideo{
[self.videoCaptureSource setSaveLocalVideo:saveLocalVideo];
}
- (NSURL*)saveLocalVideoPath{
return self.videoCaptureSource.saveLocalVideoPath;
}
- (void)setSaveLocalVideoPath:(NSURL*)saveLocalVideoPath{
[self.videoCaptureSource setSaveLocalVideoPath:saveLocalVideoPath];
}
- (BOOL)beautyFace {
return self.videoCaptureSource.beautyFace;
}
+2 -7
View File
@@ -2,18 +2,13 @@
// LFAudioCapture.h
// LFLiveKit
//
// Created by 倾慕 on 16/5/1.
// Copyright © 2016年 倾慕. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#if __has_include(<LFLiveKit/LFLiveKit.h>)
#import <LFLiveKit/LFLiveAudioConfiguration.h>
#else
#import "LFLiveAudioConfiguration.h"
#endif
#pragma mark -- AudioCaptureNotification
/** compoentFialed will post the notification */
+11 -15
View File
@@ -2,8 +2,8 @@
// LFAudioCapture.m
// LFLiveKit
//
// Created by 倾慕 on 16/5/1.
// Copyright © 2016年 倾慕. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#import "LFAudioCapture.h"
@@ -98,8 +98,9 @@ NSString *const LFAudioComponentFailedToCreateNotification = @"LFAudioComponentF
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
dispatch_sync(self.taskQueue, ^{
dispatch_async(self.taskQueue, ^{
if (self.componetInstance) {
self.isRunning = NO;
AudioOutputUnitStop(self.componetInstance);
AudioComponentInstanceDispose(self.componetInstance);
self.componetInstance = nil;
@@ -120,7 +121,11 @@ NSString *const LFAudioComponentFailedToCreateNotification = @"LFAudioComponentF
AudioOutputUnitStart(self.componetInstance);
});
} else {
self.isRunning = NO;
dispatch_async(self.taskQueue, ^{
self.isRunning = NO;
NSLog(@"MicrophoneSource: stopRunning");
AudioOutputUnitStop(self.componetInstance);
});
}
}
@@ -177,7 +182,7 @@ NSString *const LFAudioComponentFailedToCreateNotification = @"LFAudioComponentF
reason = [[[notification userInfo] objectForKey:AVAudioSessionInterruptionTypeKey] integerValue];
if (reason == AVAudioSessionInterruptionTypeBegan) {
if (self.isRunning) {
dispatch_sync(self.taskQueue, ^{
dispatch_async(self.taskQueue, ^{
NSLog(@"MicrophoneSource: stopRunning");
AudioOutputUnitStop(self.componetInstance);
});
@@ -191,7 +196,7 @@ NSString *const LFAudioComponentFailedToCreateNotification = @"LFAudioComponentF
case AVAudioSessionInterruptionOptionShouldResume:
if (self.isRunning) {
dispatch_async(self.taskQueue, ^{
NSLog(@"MicrophoneSource: stopRunning");
NSLog(@"MicrophoneSource: startRunning");
AudioOutputUnitStart(self.componetInstance);
});
}
@@ -234,15 +239,6 @@ static OSStatus handleInputBuffer(void *inRefCon,
inNumberFrames,
&buffers);
if (!source.isRunning) {
dispatch_sync(source.taskQueue, ^{
NSLog(@"MicrophoneSource: stopRunning");
AudioOutputUnitStop(source.componetInstance);
});
return status;
}
if (source.muted) {
for (int i = 0; i < buffers.mNumberBuffers; i++) {
AudioBuffer ab = buffers.mBuffers[i];
+10 -7
View File
@@ -2,18 +2,13 @@
// LFVideoCapture.h
// LFLiveKit
//
// Created by 倾慕 on 16/5/1.
// Copyright © 2016年 倾慕. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#if __has_include(<LFLiveKit/LFLiveKit.h>)
#import <LFLiveKit/LFLiveVideoConfiguration.h>
#else
#import "LFLiveVideoConfiguration.h"
#endif
@class LFVideoCapture;
/** LFVideoCapture callback videoData */
@@ -64,7 +59,15 @@
/*** The warterMarkView control whether the watermark is displayed or not ,if set ni,will remove watermark,otherwise add *.*/
@property (nonatomic, strong, nullable) UIView *warterMarkView;
/* The currentImage is videoCapture shot */
@property (nonatomic, strong, nullable) UIImage *currentImage;
/* The saveLocalVideo is save the local video */
@property (nonatomic, assign) BOOL saveLocalVideo;
/* The saveLocalVideoPath is save the local video path */
@property (nonatomic, strong, nullable) NSURL *saveLocalVideoPath;
#pragma mark - Initializer
///=============================================================================
/// @name Initializer
+58 -39
View File
@@ -2,8 +2,8 @@
// LFVideoCapture.m
// LFLiveKit
//
// Created by 倾慕 on 16/5/1.
// Copyright © 2016年 倾慕. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#import "LFVideoCapture.h"
@@ -32,6 +32,8 @@
@property (nonatomic, strong) GPUImageUIElement *uiElementInput;
@property (nonatomic, strong) UIView *waterMarkContentView;
@property (nonatomic, strong) GPUImageMovieWriter *movieWriter;
@end
@implementation LFVideoCapture
@@ -48,6 +50,7 @@
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterBackground:) name:UIApplicationWillResignActiveNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterForeground:) name:UIApplicationDidBecomeActiveNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarChanged:) name:UIApplicationWillChangeStatusBarOrientationNotification object:nil];
self.beautyFace = YES;
self.beautyLevel = 0.5;
self.brightLevel = 0.5;
@@ -60,10 +63,10 @@
- (void)dealloc {
[UIApplication sharedApplication].idleTimerDisabled = NO;
[[NSNotificationCenter defaultCenter] removeObserver:self];
[self.videoCamera stopCameraCapture];
if(self.gpuImageView){
[self.gpuImageView removeFromSuperview];
self.gpuImageView = nil;
[_videoCamera stopCameraCapture];
if(_gpuImageView){
[_gpuImageView removeFromSuperview];
_gpuImageView = nil;
}
}
@@ -72,22 +75,8 @@
- (GPUImageVideoCamera *)videoCamera{
if(!_videoCamera){
_videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:_configuration.avSessionPreset cameraPosition:AVCaptureDevicePositionFront];
UIInterfaceOrientation statusBar = [[UIApplication sharedApplication] statusBarOrientation];
if (self.configuration.landscape) {
if (statusBar != UIInterfaceOrientationLandscapeLeft && statusBar != UIInterfaceOrientationLandscapeRight) {
@throw [NSException exceptionWithName:@"当前设置方向出错" reason:@"LFLiveVideoConfiguration landscape error" userInfo:nil];
} else {
_videoCamera.outputImageOrientation = statusBar;
}
} else {
if (statusBar != UIInterfaceOrientationPortrait && statusBar != UIInterfaceOrientationPortraitUpsideDown) {
@throw [NSException exceptionWithName:@"当前设置方向出错" reason:@"LFLiveVideoConfiguration landscape error" userInfo:nil];
} else {
_videoCamera.outputImageOrientation = statusBar;
}
}
_videoCamera.horizontallyMirrorFrontFacingCamera = YES;
_videoCamera.outputImageOrientation = _configuration.outputImageOrientation;
_videoCamera.horizontallyMirrorFrontFacingCamera = NO;
_videoCamera.horizontallyMirrorRearFacingCamera = NO;
_videoCamera.frameRate = (int32_t)_configuration.videoFrameRate;
}
@@ -101,10 +90,12 @@
if (!_running) {
[UIApplication sharedApplication].idleTimerDisabled = NO;
[self.videoCamera stopCameraCapture];
if(self.saveLocalVideo) [self.movieWriter finishRecording];
} else {
[UIApplication sharedApplication].idleTimerDisabled = YES;
[self reloadFilter];
[self.videoCamera startCameraCapture];
if(self.saveLocalVideo) [self.movieWriter startRecording];
}
}
@@ -121,6 +112,7 @@
- (void)setCaptureDevicePosition:(AVCaptureDevicePosition)captureDevicePosition {
[self.videoCamera rotateCamera];
self.videoCamera.frameRate = (int32_t)_configuration.videoFrameRate;
[self reloadMirror];
}
- (AVCaptureDevicePosition)captureDevicePosition {
@@ -167,7 +159,6 @@
- (void)setMirror:(BOOL)mirror {
_mirror = mirror;
self.videoCamera.horizontallyMirrorFrontFacingCamera = mirror;
}
- (void)setBeautyFace:(BOOL)beautyFace{
@@ -265,19 +256,30 @@
return nil;
}
- (GPUImageMovieWriter*)movieWriter{
if(!_movieWriter){
_movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:self.saveLocalVideoPath size:self.configuration.videoSize];
_movieWriter.encodingLiveVideo = YES;
_movieWriter.shouldPassthroughAudio = YES;
self.videoCamera.audioEncodingTarget = self.movieWriter;
}
return _movieWriter;
}
#pragma mark -- Custom Method
- (void)processVideo:(GPUImageOutput *)output {
__weak typeof(self) _self = self;
@autoreleasepool {
GPUImageFramebuffer *imageFramebuffer = output.framebufferForOutput;
CVPixelBufferRef pixelBuffer = [imageFramebuffer pixelBuffer];
CVPixelBufferRef pixelBuffer = NULL;
CVPixelBufferCreateWithBytes(kCFAllocatorDefault, _self.configuration.videoSize.width, _self.configuration.videoSize.height, kCVPixelFormatType_32BGRA, [imageFramebuffer byteBuffer], _self.configuration.videoSize.width * 4, NULL, NULL, NULL, &pixelBuffer);
if (pixelBuffer && _self.delegate && [_self.delegate respondsToSelector:@selector(captureOutput:pixelBuffer:)]) {
[_self.delegate captureOutput:_self pixelBuffer:pixelBuffer];
}
CFRelease(pixelBuffer);
}
}
- (void)reloadFilter{
[self.filter removeAllTargets];
[self.blendFilter removeAllTargets];
@@ -296,7 +298,10 @@
self.beautyFilter = nil;
}
//< 480*640 比例为4:3 强制转换为16:9
///< 调节镜像
[self reloadMirror];
///< 480*640 比例为4:3 强制转换为16:9
if([self.configuration.avSessionPreset isEqualToString:AVCaptureSessionPreset640x480]){
CGRect cropRect = self.configuration.landscape ? CGRectMake(0, 0.125, 1, 0.75) : CGRectMake(0.125, 0, 0.75, 1);
self.cropfilter = [[GPUImageCropFilter alloc] initWithCropRegion:cropRect];
@@ -306,16 +311,18 @@
[self.videoCamera addTarget:self.filter];
}
//< 添加水印
///< 添加水印
if(self.warterMarkView){
[self.filter addTarget:self.blendFilter];
[self.uiElementInput addTarget:self.blendFilter];
[self.blendFilter addTarget:self.gpuImageView];
if(self.saveLocalVideo) [self.blendFilter addTarget:self.movieWriter];
[self.filter addTarget:self.output];
[self.uiElementInput update];
}else{
[self.filter addTarget:self.output];
[self.output addTarget:self.gpuImageView];
if(self.saveLocalVideo) [self.output addTarget:self.movieWriter];
}
[self.filter forceProcessingAtSize:self.configuration.videoSize];
@@ -323,7 +330,8 @@
[self.blendFilter forceProcessingAtSize:self.configuration.videoSize];
[self.uiElementInput forceProcessingAtSize:self.configuration.videoSize];
//< 输出数据
///< 输出数据
__weak typeof(self) _self = self;
[self.output setFrameProcessingCompletionBlock:^(GPUImageOutput *output, CMTime time) {
[_self processVideo:output];
@@ -331,6 +339,14 @@
}
- (void)reloadMirror{
if(self.mirror && self.captureDevicePosition == AVCaptureDevicePositionFront){
self.videoCamera.horizontallyMirrorFrontFacingCamera = YES;
}else{
self.videoCamera.horizontallyMirrorFrontFacingCamera = NO;
}
}
#pragma mark Notification
- (void)willEnterBackground:(NSNotification *)notification {
@@ -349,17 +365,20 @@
- (void)statusBarChanged:(NSNotification *)notification {
NSLog(@"UIApplicationWillChangeStatusBarOrientationNotification. UserInfo: %@", notification.userInfo);
UIInterfaceOrientation statusBar = [[UIApplication sharedApplication] statusBarOrientation];
if (self.configuration.landscape) {
if (statusBar == UIInterfaceOrientationLandscapeLeft) {
self.videoCamera.outputImageOrientation = UIInterfaceOrientationLandscapeRight;
} else if (statusBar == UIInterfaceOrientationLandscapeRight) {
self.videoCamera.outputImageOrientation = UIInterfaceOrientationLandscapeLeft;
}
} else {
if (statusBar == UIInterfaceOrientationPortrait) {
self.videoCamera.outputImageOrientation = UIInterfaceOrientationPortraitUpsideDown;
} else if (statusBar == UIInterfaceOrientationPortraitUpsideDown) {
self.videoCamera.outputImageOrientation = UIInterfaceOrientationPortrait;
if(self.configuration.autorotate){
if (self.configuration.landscape) {
if (statusBar == UIInterfaceOrientationLandscapeLeft) {
self.videoCamera.outputImageOrientation = UIInterfaceOrientationLandscapeRight;
} else if (statusBar == UIInterfaceOrientationLandscapeRight) {
self.videoCamera.outputImageOrientation = UIInterfaceOrientationLandscapeLeft;
}
} else {
if (statusBar == UIInterfaceOrientationPortrait) {
self.videoCamera.outputImageOrientation = UIInterfaceOrientationPortraitUpsideDown;
} else if (statusBar == UIInterfaceOrientationPortraitUpsideDown) {
self.videoCamera.outputImageOrientation = UIInterfaceOrientationPortrait;
}
}
}
}
-5
View File
@@ -13,13 +13,8 @@
#import <AVFoundation/AVVideoSettings.h>
#import <sys/stat.h>
#if __has_include(<LFLiveKit/LFLiveKit.h>)
#import <LFLiveKit/LFVideoEncoder.h>
#import <LFLiveKit/LFMP4Atom.h>
#else
#import "LFVideoEncoder.h"
#import "LFMP4Atom.h"
#endif
+2 -7
View File
@@ -2,19 +2,14 @@
// LFAudioEncoding.h
// LFLiveKit
//
// Created by 倾慕 on 16/5/2.
// Copyright © 2016年 倾慕. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#if __has_include(<LFLiveKit/LFLiveKit.h>)
#import <LFLiveKit/LFAudioFrame.h>
#import <LFLiveKit/LFLiveAudioConfiguration.h>
#else
#import "LFAudioFrame.h"
#import "LFLiveAudioConfiguration.h"
#endif
+2 -6
View File
@@ -2,15 +2,11 @@
// LFH264VideoEncoder
// LFLiveKit
//
// Created by feng on 7/5/16.
// Copyright (c) 2014 zhanqi.tv. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#if __has_include(<LFLiveKit/LFLiveKit.h>)
#import <LFLiveKit/LFVideoEncoding.h>
#else
#import "LFVideoEncoding.h"
#endif
@interface LFH264VideoEncoder : NSObject <LFVideoEncoding> {
+2 -2
View File
@@ -2,8 +2,8 @@
// LFH264VideoEncoder
// LFLiveKit
//
// Created by feng on 7/5/16.
// Copyright (c) 2014 zhanqi.tv. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#import <CoreMedia/CoreMedia.h>
+2 -6
View File
@@ -2,15 +2,11 @@
// LFHardwareAudioEncoder.h
// LFLiveKit
//
// Created by 倾慕 on 16/5/2.
// Copyright © 2016年 倾慕. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#if __has_include(<LFLiveKit/LFLiveKit.h>)
#import <LFLiveKit/LFAudioEncoding.h>
#else
#import "LFAudioEncoding.h"
#endif
@interface LFHardwareAudioEncoder : NSObject<LFAudioEncoding>
+12 -16
View File
@@ -2,8 +2,8 @@
// LFHardwareAudioEncoder.m
// LFLiveKit
//
// Created by 倾慕 on 16/5/2.
// Copyright © 2016年 倾慕. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#import "LFHardwareAudioEncoder.h"
@@ -35,7 +35,7 @@
if (!aacBuf) {
aacBuf = malloc(_configuration.bufferLength);
}
#ifdef DEBUG
enabledWriteVideoFile = NO;
@@ -59,7 +59,7 @@
if (![self createAudioConvert]) {
return;
}
if(leftLength + audioData.length >= self.configuration.bufferLength){
///<  发送
NSInteger totalSize = leftLength + audioData.length;
@@ -75,12 +75,13 @@
[self encodeBuffer:p timeStamp:timeStamp];
p += self.configuration.bufferLength;
}
free(totalBuf);
leftLength = totalSize%self.configuration.bufferLength;
memset(leftBuf, 0, self.configuration.bufferLength);
memcpy(leftBuf, totalBuf + (totalSize -leftLength), leftLength);
free(totalBuf);
}else{
///< 积累
memcpy(leftBuf+leftLength, audioData.bytes, audioData.length);
@@ -98,7 +99,7 @@
AudioBufferList buffers;
buffers.mNumberBuffers = 1;
buffers.mBuffers[0] = inBuffer;
// 初始化一个输出缓冲列表
AudioBufferList outBufferList;
@@ -132,7 +133,7 @@
}
- (void)stopEncoder {
}
#pragma mark -- CustomMethod
@@ -140,7 +141,7 @@
if (m_converter != nil) {
return TRUE;
}
AudioStreamBasicDescription inputFormat = {0};
inputFormat.mSampleRate = _configuration.audioSampleRate;
inputFormat.mFormatID = kAudioFormatLinearPCM;
@@ -150,14 +151,14 @@
inputFormat.mBitsPerChannel = 16;
inputFormat.mBytesPerFrame = inputFormat.mBitsPerChannel / 8 * inputFormat.mChannelsPerFrame;
inputFormat.mBytesPerPacket = inputFormat.mBytesPerFrame * inputFormat.mFramesPerPacket;
AudioStreamBasicDescription outputFormat; // 这里开始是输出音频格式
memset(&outputFormat, 0, sizeof(outputFormat));
outputFormat.mSampleRate = inputFormat.mSampleRate; // 采样率保持一致
outputFormat.mFormatID = kAudioFormatMPEG4AAC; // AAC编码 kAudioFormatMPEG4AAC kAudioFormatMPEG4AAC_HE_V2
outputFormat.mChannelsPerFrame = (UInt32)_configuration.numberOfChannels;;
outputFormat.mFramesPerPacket = 1024; // AAC一帧是1024个字节
const OSType subtype = kAudioFormatMPEG4AAC;
AudioClassDescription requestedCodecs[2] = {
{
@@ -175,17 +176,12 @@
OSStatus result = AudioConverterNewSpecific(&inputFormat, &outputFormat, 2, requestedCodecs, &m_converter);;
UInt32 outputBitrate = _configuration.audioBitrate;
UInt32 propSize = sizeof(outputBitrate);
// UInt32 outputPacketSize = 0;
if(result == noErr) {
result = AudioConverterSetProperty(m_converter, kAudioConverterEncodeBitRate, propSize, &outputBitrate);
}
// if(result == noErr) {
// AudioConverterGetProperty(m_converter, kAudioConverterPropertyMaximumOutputPacketSize, &propSize, &outputPacketSize);
// }
return YES;
}
+2 -6
View File
@@ -2,15 +2,11 @@
// LFHardwareVideoEncoder.h
// LFLiveKit
//
// Created by 倾慕 on 16/5/2.
// Copyright © 2016年 倾慕. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#if __has_include(<LFLiveKit/LFLiveKit.h>)
#import <LFLiveKit/LFVideoEncoding.h>
#else
#import "LFVideoEncoding.h"
#endif
@interface LFHardwareVideoEncoder : NSObject<LFVideoEncoding>
+19 -19
View File
@@ -2,10 +2,9 @@
// LFHardwareVideoEncoder.m
// LFLiveKit
//
// Created by 倾慕 on 16/5/2.
// Copyright © 2016年 倾慕. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#import "LFHardwareVideoEncoder.h"
#import <VideoToolbox/VideoToolbox.h>
@@ -20,8 +19,8 @@
@property (nonatomic, strong) LFLiveVideoConfiguration *configuration;
@property (nonatomic, weak) id<LFVideoEncodingDelegate> h264Delegate;
@property (nonatomic) BOOL isBackGround;
@property (nonatomic) NSInteger currentVideoBitRate;
@property (nonatomic) BOOL isBackGround;
@end
@@ -32,20 +31,19 @@
if (self = [super init]) {
NSLog(@"USE LFHardwareVideoEncoder");
_configuration = configuration;
[self initCompressionSession];
[self resetCompressionSession];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterBackground:) name:UIApplicationWillResignActiveNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterForeground:) name:UIApplicationDidBecomeActiveNotification object:nil];
#ifdef DEBUG
enabledWriteVideoFile = NO;
[self initForFilePath];
#endif
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterBackground:) name:UIApplicationWillResignActiveNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterForeground:) name:UIApplicationDidBecomeActiveNotification object:nil];
}
return self;
}
- (void)initCompressionSession {
- (void)resetCompressionSession {
if (compressionSession) {
VTCompressionSessionCompleteFrames(compressionSession, kCMTimeInvalid);
@@ -61,7 +59,7 @@
_currentVideoBitRate = _configuration.videoBitRate;
VTSessionSetProperty(compressionSession, kVTCompressionPropertyKey_MaxKeyFrameInterval, (__bridge CFTypeRef)@(_configuration.videoMaxKeyframeInterval));
VTSessionSetProperty(compressionSession, kVTCompressionPropertyKey_MaxKeyFrameIntervalDuration, (__bridge CFTypeRef)@(_configuration.videoMaxKeyframeInterval));
VTSessionSetProperty(compressionSession, kVTCompressionPropertyKey_MaxKeyFrameIntervalDuration, (__bridge CFTypeRef)@(_configuration.videoMaxKeyframeInterval/_configuration.videoFrameRate));
VTSessionSetProperty(compressionSession, kVTCompressionPropertyKey_ExpectedFrameRate, (__bridge CFTypeRef)@(_configuration.videoFrameRate));
VTSessionSetProperty(compressionSession, kVTCompressionPropertyKey_AverageBitRate, (__bridge CFTypeRef)@(_configuration.videoBitRate));
NSArray *limit = @[@(_configuration.videoBitRate * 1.5/8), @(1)];
@@ -75,7 +73,7 @@
}
- (void)setVideoBitRate:(NSInteger)videoBitRate {
if (_isBackGround) return;
if(_isBackGround) return;
VTSessionSetProperty(compressionSession, kVTCompressionPropertyKey_AverageBitRate, (__bridge CFTypeRef)@(videoBitRate));
NSArray *limit = @[@(videoBitRate * 1.5/8), @(1)];
VTSessionSetProperty(compressionSession, kVTCompressionPropertyKey_DataRateLimits, (__bridge CFArrayRef)limit);
@@ -99,8 +97,7 @@
#pragma mark -- LFVideoEncoder
- (void)encodeVideoData:(CVPixelBufferRef)pixelBuffer timeStamp:(uint64_t)timeStamp {
if (_isBackGround) return;
if(_isBackGround) return;
frameCount++;
CMTime presentationTimeStamp = CMTimeMake(frameCount, (int32_t)_configuration.videoFrameRate);
VTEncodeInfoFlags flags;
@@ -112,7 +109,10 @@
}
NSNumber *timeNumber = @(timeStamp);
VTCompressionSessionEncodeFrame(compressionSession, pixelBuffer, presentationTimeStamp, duration, (__bridge CFDictionaryRef)properties, (__bridge_retained void *)timeNumber, &flags);
OSStatus status = VTCompressionSessionEncodeFrame(compressionSession, pixelBuffer, presentationTimeStamp, duration, (__bridge CFDictionaryRef)properties, (__bridge_retained void *)timeNumber, &flags);
if(status != noErr){
[self resetCompressionSession];
}
}
- (void)stopEncoder {
@@ -123,13 +123,13 @@
_h264Delegate = delegate;
}
#pragma mark -- NSNotification
- (void)willEnterBackground:(NSNotification *)notification {
#pragma mark -- Notification
- (void)willEnterBackground:(NSNotification*)notification{
_isBackGround = YES;
}
- (void)willEnterForeground:(NSNotification *)notification {
[self initCompressionSession];
- (void)willEnterForeground:(NSNotification*)notification{
[self resetCompressionSession];
_isBackGround = NO;
}
+2 -9
View File
@@ -2,20 +2,13 @@
// LFVideoEncoding.h
// LFLiveKit
//
// Created by 倾慕 on 16/5/2.
// Copyright © 2016年 倾慕. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#import <Foundation/Foundation.h>
#if __has_include(<LFLiveKit/LFLiveKit.h>)
#import <LFLiveKit/LFVideoFrame.h>
#import <LFLiveKit/LFLiveVideoConfiguration.h>
#else
#import "LFVideoFrame.h"
#import "LFLiveVideoConfiguration.h"
#endif
@protocol LFVideoEncoding;
/// 编码器编码后回调
@@ -2,8 +2,8 @@
// LFLiveAudioConfiguration.h
// LFLiveKit
//
// Created by 倾慕 on 16/5/1.
// Copyright © 2016年 倾慕. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#import <Foundation/Foundation.h>
@@ -2,8 +2,8 @@
// LFLiveAudioConfiguration.m
// LFLiveKit
//
// Created by 倾慕 on 16/5/1.
// Copyright © 2016年 倾慕. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#import "LFLiveAudioConfiguration.h"
@@ -2,8 +2,8 @@
// LFLiveVideoConfiguration.h
// LFLiveKit
//
// Created by 倾慕 on 16/5/1.
// Copyright © 2016年 倾慕. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#import <Foundation/Foundation.h>
@@ -51,7 +51,7 @@ typedef NS_ENUM (NSUInteger, LFLiveVideoQuality){
+ (instancetype)defaultConfigurationForQuality:(LFLiveVideoQuality)videoQuality;
/// 视频配置(质量 & 是否是横屏)
+ (instancetype)defaultConfigurationForQuality:(LFLiveVideoQuality)videoQuality landscape:(BOOL)landscape;
+ (instancetype)defaultConfigurationForQuality:(LFLiveVideoQuality)videoQuality outputImageOrientation:(UIInterfaceOrientation)outputImageOrientation;
#pragma mark - Attribute
///=============================================================================
@@ -64,7 +64,10 @@ typedef NS_ENUM (NSUInteger, LFLiveVideoQuality){
@property (nonatomic, assign) BOOL videoSizeRespectingAspectRatio;
/// 视频输出方向
@property (nonatomic, assign) BOOL landscape;
@property (nonatomic, assign) UIInterfaceOrientation outputImageOrientation;
/// 自动旋转(这里只支持 left 变 right portrait 变 portraitUpsideDown)
@property (nonatomic, assign) BOOL autorotate;
/// 视频的帧率,即 fps
@property (nonatomic, assign) NSUInteger videoFrameRate;
@@ -93,4 +96,7 @@ typedef NS_ENUM (NSUInteger, LFLiveVideoQuality){
///< ≈sde3分辨率
@property (nonatomic, assign, readonly) NSString *avSessionPreset;
///< 是否是横屏
@property (nonatomic, assign, readonly) BOOL landscape;
@end
@@ -2,8 +2,8 @@
// LFLiveVideoConfiguration.m
// LFLiveKit
//
// Created by 倾慕 on 16/5/1.
// Copyright © 2016年 倾慕. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#import "LFLiveVideoConfiguration.h"
@@ -20,11 +20,11 @@
}
+ (instancetype)defaultConfigurationForQuality:(LFLiveVideoQuality)videoQuality {
LFLiveVideoConfiguration *configuration = [LFLiveVideoConfiguration defaultConfigurationForQuality:videoQuality landscape:NO];
LFLiveVideoConfiguration *configuration = [LFLiveVideoConfiguration defaultConfigurationForQuality:videoQuality outputImageOrientation:UIInterfaceOrientationPortrait];
return configuration;
}
+ (instancetype)defaultConfigurationForQuality:(LFLiveVideoQuality)videoQuality landscape:(BOOL)landscape {
+ (instancetype)defaultConfigurationForQuality:(LFLiveVideoQuality)videoQuality outputImageOrientation:(UIInterfaceOrientation)outputImageOrientation {
LFLiveVideoConfiguration *configuration = [LFLiveVideoConfiguration new];
switch (videoQuality) {
case LFLiveVideoQuality_Low1:{
@@ -131,9 +131,9 @@
}
configuration.sessionPreset = [configuration supportSessionPreset:configuration.sessionPreset];
configuration.videoMaxKeyframeInterval = configuration.videoFrameRate*2;
configuration.landscape = landscape;
configuration.outputImageOrientation = outputImageOrientation;
CGSize size = configuration.videoSize;
if (landscape) {
if(configuration.landscape) {
configuration.videoSize = CGSizeMake(size.height, size.width);
} else {
configuration.videoSize = CGSizeMake(size.width, size.height);
@@ -166,6 +166,10 @@
return avSessionPreset;
}
- (BOOL)landscape{
return (self.outputImageOrientation == UIInterfaceOrientationLandscapeLeft || self.outputImageOrientation == UIInterfaceOrientationLandscapeRight) ? YES : NO;
}
- (CGSize)videoSize{
if(_videoSizeRespectingAspectRatio){
return self.aspectRatioVideoSize;
@@ -249,7 +253,7 @@
break;
}
if(self.landscape){
if (self.landscape){
return CGSizeMake(videoSize.height, videoSize.width);
}
return videoSize;
@@ -275,7 +279,8 @@
[aCoder encodeObject:@(self.videoMaxBitRate) forKey:@"videoMaxBitRate"];
[aCoder encodeObject:@(self.videoMinBitRate) forKey:@"videoMinBitRate"];
[aCoder encodeObject:@(self.sessionPreset) forKey:@"sessionPreset"];
[aCoder encodeObject:@(self.landscape) forKey:@"landscape"];
[aCoder encodeObject:@(self.outputImageOrientation) forKey:@"outputImageOrientation"];
[aCoder encodeObject:@(self.autorotate) forKey:@"autorotate"];
[aCoder encodeObject:@(self.videoSizeRespectingAspectRatio) forKey:@"videoSizeRespectingAspectRatio"];
}
@@ -290,7 +295,8 @@
_videoMaxBitRate = [[aDecoder decodeObjectForKey:@"videoMaxBitRate"] unsignedIntegerValue];
_videoMinBitRate = [[aDecoder decodeObjectForKey:@"videoMinBitRate"] unsignedIntegerValue];
_sessionPreset = [[aDecoder decodeObjectForKey:@"sessionPreset"] unsignedIntegerValue];
_landscape = [[aDecoder decodeObjectForKey:@"landscape"] unsignedIntegerValue];
_outputImageOrientation = [[aDecoder decodeObjectForKey:@"outputImageOrientation"] unsignedIntegerValue];
_autorotate = [[aDecoder decodeObjectForKey:@"autorotate"] boolValue];
_videoSizeRespectingAspectRatio = [[aDecoder decodeObjectForKey:@"videoSizeRespectingAspectRatio"] unsignedIntegerValue];
return self;
}
@@ -307,7 +313,8 @@
@(self.videoMinBitRate),
self.avSessionPreset,
@(self.sessionPreset),
@(self.landscape),
@(self.outputImageOrientation),
@(self.autorotate),
@(self.videoSizeRespectingAspectRatio)];
for (NSObject *value in values) {
@@ -333,7 +340,8 @@
object.videoMinBitRate == self.videoMinBitRate &&
[object.avSessionPreset isEqualToString:self.avSessionPreset] &&
object.sessionPreset == self.sessionPreset &&
object.landscape == self.landscape &&
object.outputImageOrientation == self.outputImageOrientation &&
object.autorotate == self.autorotate &&
object.videoSizeRespectingAspectRatio == self.videoSizeRespectingAspectRatio;
}
}
@@ -357,7 +365,8 @@
[desc appendFormat:@" videoMinBitRate:%zi", self.videoMinBitRate];
[desc appendFormat:@" avSessionPreset:%@", self.avSessionPreset];
[desc appendFormat:@" sessionPreset:%zi", self.sessionPreset];
[desc appendFormat:@" landscape:%zi", self.landscape];
[desc appendFormat:@" outputImageOrientation:%zi", self.outputImageOrientation];
[desc appendFormat:@" autorotate:%zi", self.autorotate];
return desc;
}
+3 -4
View File
@@ -1,10 +1,9 @@
#if __has_include(<GPUImage/GPUImage.h>)
#import <GPUImage/GPUImage.h>
#elif __has_include("GPUImage/GPUImage.h")
#import "GPUImage/GPUImage.h"
#if __has_include(<GPUImage/GPUImageFramework.h>)
#import <GPUImage/GPUImageFramework.h>
#else
#import "GPUImage.h"
#endif
@interface LFGPUImageBeautyFilter : GPUImageFilter {
}
+2 -4
View File
@@ -1,7 +1,5 @@
#if __has_include(<GPUImage/GPUImage.h>)
#import <GPUImage/GPUImage.h>
#elif __has_include("GPUImage/GPUImage.h")
#import "GPUImage/GPUImage.h"
#if __has_include(<GPUImage/GPUImageFramework.h>)
#import <GPUImage/GPUImageFramework.h>
#else
#import "GPUImage.h"
#endif
+2 -6
View File
@@ -2,15 +2,11 @@
// LFAudioFrame.h
// LFLiveKit
//
// Created by 倾慕 on 16/5/2.
// Copyright © 2016年 倾慕. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#if __has_include(<LFLiveKit/LFLiveKit.h>)
#import <LFLiveKit/LFFrame.h>
#else
#import "LFFrame.h"
#endif
@interface LFAudioFrame : LFFrame
+2 -2
View File
@@ -2,8 +2,8 @@
// LFAudioFrame.m
// LFLiveKit
//
// Created by on 16/5/2.
// Copyright © 2016 . All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016 LaiFeng All rights reserved.
//
#import "LFAudioFrame.h"
+2 -2
View File
@@ -2,8 +2,8 @@
// LFFrame.h
// LFLiveKit
//
// Created by 倾慕 on 16/5/2.
// Copyright © 2016年 倾慕. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#import <Foundation/Foundation.h>
+2 -2
View File
@@ -2,8 +2,8 @@
// LFFrame.m
// LFLiveKit
//
// Created by on 16/5/2.
// Copyright © 2016 . All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016 LaiFeng All rights reserved.
//
#import "LFFrame.h"
+2 -2
View File
@@ -2,8 +2,8 @@
// LFLiveDebug.h
// LaiFeng
//
// Created by admin on 16/5/19.
// Copyright © 2016年 live Interactive. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#import <Foundation/Foundation.h>
+2 -2
View File
@@ -2,8 +2,8 @@
// LFLiveDebug.m
// LaiFeng
//
// Created by admin on 16/5/19.
// Copyright © 2016 live Interactive. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016 LaiFeng All rights reserved.
//
#import "LFLiveDebug.h"
+6 -12
View File
@@ -2,19 +2,13 @@
// LFLiveStreamInfo.h
// LFLiveKit
//
// Created by 倾慕 on 16/5/2.
// Copyright © 2016年 倾慕. All rights reserved.
// 真正的上传地址 token等
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#import <Foundation/Foundation.h>
#if __has_include(<LFLiveKit/LFLiveKit.h>)
#import <LFLiveKit/LFLiveAudioConfiguration.h>
#import <LFLiveKit/LFLiveVideoConfiguration.h>
#else
#import "LFLiveAudioConfiguration.h"
#import "LFLiveVideoConfiguration.h"
#endif
@@ -29,7 +23,9 @@ typedef NS_ENUM (NSUInteger, LFLiveState){
/// 已断开
LFLiveStop = 3,
/// 连接出错
LFLiveError = 4
LFLiveError = 4,
///  正在刷新
LFLiveRefresh = 5
};
typedef NS_ENUM (NSUInteger, LFLiveSocketErrorCode) {
@@ -53,7 +49,5 @@ typedef NS_ENUM (NSUInteger, LFLiveSocketErrorCode) {
@property (nonatomic, strong) LFLiveAudioConfiguration *audioConfiguration;
///视频配置
@property (nonatomic, strong) LFLiveVideoConfiguration *videoConfiguration;
///是否丢帧
@property (nonatomic, assign) BOOL needDropFrame;
@end
+2 -2
View File
@@ -2,8 +2,8 @@
// LFLiveStreamInfo.m
// LFLiveKit
//
// Created by on 16/5/2.
// Copyright © 2016 . All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016 LaiFeng All rights reserved.
//
#import "LFLiveStreamInfo.h"
+2 -6
View File
@@ -2,15 +2,11 @@
// LFVideoFrame.h
// LFLiveKit
//
// Created by 倾慕 on 16/5/2.
// Copyright © 2016年 倾慕. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#if __has_include(<LFLiveKit/LFLiveKit.h>)
#import <LFLiveKit/LFFrame.h>
#else
#import "LFFrame.h"
#endif
@interface LFVideoFrame : LFFrame
+2 -2
View File
@@ -2,8 +2,8 @@
// LFVideoFrame.m
// LFLiveKit
//
// Created by on 16/5/2.
// Copyright © 2016 . All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016 LaiFeng All rights reserved.
//
#import "LFVideoFrame.h"
+2 -6
View File
@@ -2,15 +2,11 @@
// LFStreamRTMPSocket.h
// LaiFeng
//
// Created by admin on 16/5/18.
// Copyright © 2016年 live Interactive. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#if __has_include(<LFLiveKit/LFLiveKit.h>)
#import <LFLiveKit/LFStreamSocket.h>
#else
#import "LFStreamSocket.h"
#endif
@interface LFStreamRTMPSocket : NSObject<LFStreamSocket>
+100 -87
View File
@@ -2,21 +2,14 @@
// LFStreamRTMPSocket.m
// LFLiveKit
//
// Created by admin on 16/5/18.
// Copyright © 2016 live Interactive. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016 LaiFeng All rights reserved.
//
#import "LFStreamRTMPSocket.h"
#if __has_include(<pili-librtmp/rtmp.h>)
#import <pili-librtmp/rtmp.h>
#elif __has_include("pili-librtmp/rtmp.h")
#import "pili-librtmp/rtmp.h"
#else
#import "rtmp.h"
#endif
static const NSInteger RetryTimesBreaken = 20; ///< 1 3 20
static const NSInteger RetryTimesBreaken = 5; ///< 1 3 20
static const NSInteger RetryTimesMargin = 3;
@@ -28,7 +21,7 @@ static const NSInteger RetryTimesMargin = 3;
#define SAVC(x) static const AVal av_ ## x = AVC(#x)
static const AVal av_setDataFrame = AVC("@setDataFrame");
static const AVal av_SDKVersion = AVC("LFLiveKit 1.8.0");
static const AVal av_SDKVersion = AVC("LFLiveKit 2.4.0");
SAVC(onMetaData);
SAVC(duration);
SAVC(width);
@@ -112,12 +105,24 @@ SAVC(mp4a);
self.debugInfo.streamId = self.stream.streamId;
self.debugInfo.uploadUrl = self.stream.url;
self.debugInfo.isRtmp = YES;
if (_isConnecting) return;
_isConnecting = YES;
if (self.delegate && [self.delegate respondsToSelector:@selector(socketStatus:status:)]) {
[self.delegate socketStatus:self status:LFLivePending];
}
if (_rtmp != NULL) {
PILI_RTMP_Close(_rtmp, &_error);
PILI_RTMP_Free(_rtmp);
}
[self RTMP264_Connect:(char *)[_stream.url cStringUsingEncoding:NSASCIIStringEncoding]];
}
- (void)stop {
dispatch_async(self.rtmpSendQueue, ^{
[self _stop];
[NSObject cancelPreviousPerformRequestsWithTarget:self];
});
}
@@ -131,12 +136,12 @@ SAVC(mp4a);
_rtmp = NULL;
}
[self clean];
[NSObject cancelPreviousPerformRequestsWithTarget:self];
}
- (void)sendFrame:(LFFrame *)frame {
if (!frame) return;
[self.buffer appendObject:frame];
if(!self.isSending){
[self sendFrame];
}
@@ -148,74 +153,75 @@ SAVC(mp4a);
#pragma mark -- CustomMethod
- (void)sendFrame {
__weak typeof(self) _self = self;
dispatch_async(self.rtmpSendQueue, ^{
if (!self.isSending && self.buffer.list.count > 0) {
self.isSending = YES;
if (!_self.isSending && _self.buffer.list.count > 0) {
_self.isSending = YES;
if (!_isConnected || _isReconnecting || _isConnecting || !_rtmp){
self.isSending = NO;
if (!_self.isConnected || _self.isReconnecting || _self.isConnecting || !_rtmp){
_self.isSending = NO;
return;
}
//
LFFrame *frame = [self.buffer popFirstObject];
LFFrame *frame = [_self.buffer popFirstObject];
if ([frame isKindOfClass:[LFVideoFrame class]]) {
if (!self.sendVideoHead) {
self.sendVideoHead = YES;
if (!_self.sendVideoHead) {
_self.sendVideoHead = YES;
if(!((LFVideoFrame*)frame).sps || !((LFVideoFrame*)frame).pps){
self.isSending = NO;
_self.isSending = NO;
return;
}
[self sendVideoHeader:(LFVideoFrame *)frame];
[_self sendVideoHeader:(LFVideoFrame *)frame];
} else {
[self sendVideo:(LFVideoFrame *)frame];
[_self sendVideo:(LFVideoFrame *)frame];
}
} else {
if (!self.sendAudioHead) {
self.sendAudioHead = YES;
if (!_self.sendAudioHead) {
_self.sendAudioHead = YES;
if(!((LFAudioFrame*)frame).audioInfo){
self.isSending = NO;
_self.isSending = NO;
return;
}
[self sendAudioHeader:(LFAudioFrame *)frame];
[_self sendAudioHeader:(LFAudioFrame *)frame];
} else {
[self sendAudio:frame];
[_self sendAudio:frame];
}
}
//debug更新
self.debugInfo.totalFrame++;
self.debugInfo.dropFrame += self.buffer.lastDropFrames;
self.buffer.lastDropFrames = 0;
_self.debugInfo.totalFrame++;
_self.debugInfo.dropFrame += _self.buffer.lastDropFrames;
_self.buffer.lastDropFrames = 0;
self.debugInfo.dataFlow += frame.data.length;
self.debugInfo.elapsedMilli = CACurrentMediaTime() * 1000 - self.debugInfo.timeStamp;
if (self.debugInfo.elapsedMilli < 1000) {
self.debugInfo.bandwidth += frame.data.length;
_self.debugInfo.dataFlow += frame.data.length;
_self.debugInfo.elapsedMilli = CACurrentMediaTime() * 1000 - _self.debugInfo.timeStamp;
if (_self.debugInfo.elapsedMilli < 1000) {
_self.debugInfo.bandwidth += frame.data.length;
if ([frame isKindOfClass:[LFAudioFrame class]]) {
self.debugInfo.capturedAudioCount++;
_self.debugInfo.capturedAudioCount++;
} else {
self.debugInfo.capturedVideoCount++;
_self.debugInfo.capturedVideoCount++;
}
self.debugInfo.unSendCount = self.buffer.list.count;
_self.debugInfo.unSendCount = _self.buffer.list.count;
} else {
self.debugInfo.currentBandwidth = self.debugInfo.bandwidth;
self.debugInfo.currentCapturedAudioCount = self.debugInfo.capturedAudioCount;
self.debugInfo.currentCapturedVideoCount = self.debugInfo.capturedVideoCount;
if (self.delegate && [self.delegate respondsToSelector:@selector(socketDebug:debugInfo:)]) {
[self.delegate socketDebug:self debugInfo:self.debugInfo];
_self.debugInfo.currentBandwidth = _self.debugInfo.bandwidth;
_self.debugInfo.currentCapturedAudioCount = _self.debugInfo.capturedAudioCount;
_self.debugInfo.currentCapturedVideoCount = _self.debugInfo.capturedVideoCount;
if (_self.delegate && [_self.delegate respondsToSelector:@selector(socketDebug:debugInfo:)]) {
[_self.delegate socketDebug:_self debugInfo:_self.debugInfo];
}
self.debugInfo.bandwidth = 0;
self.debugInfo.capturedAudioCount = 0;
self.debugInfo.capturedVideoCount = 0;
self.debugInfo.timeStamp = CACurrentMediaTime() * 1000;
_self.debugInfo.bandwidth = 0;
_self.debugInfo.capturedAudioCount = 0;
_self.debugInfo.capturedVideoCount = 0;
_self.debugInfo.timeStamp = CACurrentMediaTime() * 1000;
}
//
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//< sendFrame方法
self.isSending = NO;
_self.isSending = NO;
});
}
@@ -237,18 +243,6 @@ SAVC(mp4a);
- (NSInteger)RTMP264_Connect:(char *)push_url {
//timestamp是一直在累加
//
if (_isConnecting) return -1;
_isConnecting = YES;
if (self.delegate && [self.delegate respondsToSelector:@selector(socketStatus:status:)]) {
[self.delegate socketStatus:self status:LFLivePending];
}
if (_rtmp != NULL) {
PILI_RTMP_Close(_rtmp, &_error);
PILI_RTMP_Free(_rtmp);
}
_rtmp = PILI_RTMP_Alloc();
PILI_RTMP_Init(_rtmp);
@@ -287,19 +281,13 @@ SAVC(mp4a);
_isConnecting = NO;
_isReconnecting = NO;
_isSending = NO;
_retryTimes4netWorkBreaken = 0;
return 0;
Failed:
PILI_RTMP_Close(_rtmp, &_error);
PILI_RTMP_Free(_rtmp);
_rtmp = NULL;
if (self.delegate && [self.delegate respondsToSelector:@selector(socketDidError:errorCode:)]) {
[self.delegate socketDidError:self errorCode:LFLiveSocketError_ConnectSocket];
}
if (self.delegate && [self.delegate respondsToSelector:@selector(socketStatus:status:)]) {
[self.delegate socketStatus:self status:LFLiveError];
}
[self reconnect];
return -1;
}
@@ -491,36 +479,61 @@ Failed:
// 线
- (void)reconnect {
dispatch_async(self.rtmpSendQueue, ^{
_isReconnecting = NO;
if (_isConnected) return;
[self _stop];
[self _start];
if (self.retryTimes4netWorkBreaken++ < self.reconnectCount && !self.isReconnecting) {
self.isConnected = NO;
self.isConnecting = NO;
self.isReconnecting = YES;
dispatch_async(dispatch_get_main_queue(), ^{
[self performSelector:@selector(_reconnect) withObject:nil afterDelay:self.reconnectInterval];
});
} else if (self.retryTimes4netWorkBreaken >= self.reconnectCount) {
if (self.delegate && [self.delegate respondsToSelector:@selector(socketStatus:status:)]) {
[self.delegate socketStatus:self status:LFLiveError];
}
if (self.delegate && [self.delegate respondsToSelector:@selector(socketDidError:errorCode:)]) {
[self.delegate socketDidError:self errorCode:LFLiveSocketError_ReConnectTimeOut];
}
}
});
}
- (void)_reconnect{
[NSObject cancelPreviousPerformRequestsWithTarget:self];
_isReconnecting = NO;
if(_isConnected) return;
_isReconnecting = NO;
if (_isConnected) return;
if (_rtmp != NULL) {
PILI_RTMP_Close(_rtmp, &_error);
PILI_RTMP_Free(_rtmp);
_rtmp = NULL;
}
_sendAudioHead = NO;
_sendVideoHead = NO;
if (self.delegate && [self.delegate respondsToSelector:@selector(socketStatus:status:)]) {
[self.delegate socketStatus:self status:LFLiveRefresh];
}
if (_rtmp != NULL) {
PILI_RTMP_Close(_rtmp, &_error);
PILI_RTMP_Free(_rtmp);
}
[self RTMP264_Connect:(char *)[_stream.url cStringUsingEncoding:NSASCIIStringEncoding]];
}
#pragma mark -- CallBack
void RTMPErrorCallback(RTMPError *error, void *userData) {
LFStreamRTMPSocket *socket = (__bridge LFStreamRTMPSocket *)userData;
if (error->code < 0) {
if (socket.retryTimes4netWorkBreaken++ < socket.reconnectCount && !socket.isReconnecting) {
socket.isConnected = NO;
socket.isConnecting = NO;
socket.isReconnecting = YES;
[socket performSelectorOnMainThread:@selector(reconnect) withObject:nil waitUntilDone:socket.reconnectInterval];
} else if (socket.retryTimes4netWorkBreaken >= socket.reconnectCount) {
if (socket.delegate && [socket.delegate respondsToSelector:@selector(socketStatus:status:)]) {
[socket.delegate socketStatus:socket status:LFLiveError];
}
if (socket.delegate && [socket.delegate respondsToSelector:@selector(socketDidError:errorCode:)]) {
[socket.delegate socketDidError:socket errorCode:LFLiveSocketError_ReConnectTimeOut];
}
}
[socket reconnect];
}
}
void ConnectionTimeCallback(PILI_CONNECTION_TIME *conn_time, void *userData) {
//LFStreamRTMPSocket *socket = (__bridge LFStreamRTMPSocket*)userData;
}
#pragma mark -- LFStreamingBufferDelegate
@@ -545,7 +558,7 @@ void ConnectionTimeCallback(PILI_CONNECTION_TIME *conn_time, void *userData) {
if (!_buffer) {
_buffer = [[LFStreamingBuffer alloc] init];
_buffer.delegate = self;
_buffer.needDropFrame = self.stream.needDropFrame;
}
return _buffer;
}
+2 -9
View File
@@ -2,21 +2,14 @@
// LFStreamSocket.h
// LFLiveKit
//
// Created by admin on 16/5/3.
// Copyright © 2016年 倾慕. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#import <Foundation/Foundation.h>
#if __has_include(<LFLiveKit/LFLiveKit.h>)
#import <LFLiveKit/LFLiveStreamInfo.h>
#import <LFLiveKit/LFStreamingBuffer.h>
#import <LFLiveKit/LFLiveDebug.h>
#else
#import "LFLiveStreamInfo.h"
#import "LFStreamingBuffer.h"
#import "LFLiveDebug.h"
#endif
+2 -10
View File
@@ -2,19 +2,13 @@
// LFStreamingBuffer.h
// LFLiveKit
//
// Created by 倾慕 on 16/5/2.
// Copyright © 2016年 倾慕. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#import <Foundation/Foundation.h>
#if __has_include(<LFLiveKit/LFLiveKit.h>)
#import <LFLiveKit/LFAudioFrame.h>
#import <LFLiveKit/LFVideoFrame.h>
#else
#import "LFAudioFrame.h"
#import "LFVideoFrame.h"
#endif
/** current buffer status */
@@ -34,8 +28,6 @@ typedef NS_ENUM (NSUInteger, LFLiveBuffferState) {
@interface LFStreamingBuffer : NSObject
/** The needDropFrame control Dynamic frame loss ,default is YES */
@property (nonatomic, assign) BOOL needDropFrame;
/** The delegate of the buffer. buffer callback */
@property (nullable, nonatomic, weak) id <LFStreamingBufferDelegate> delegate;
+20 -26
View File
@@ -2,14 +2,14 @@
// LFStreamingBuffer.m
// LFLiveKit
//
// Created by on 16/5/2.
// Copyright © 2016 . All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016 LaiFeng All rights reserved.
//
#import "LFStreamingBuffer.h"
#import "NSMutableArray+LFAdd.h"
static const NSUInteger defaultSortBufferMaxCount = 10;///< 10
static const NSUInteger defaultSortBufferMaxCount = 5;///< 10
static const NSUInteger defaultUpdateInterval = 1;///< 1s
static const NSUInteger defaultCallBackInterval = 5;///< 5s计时一次
static const NSUInteger defaultSendBufferMaxCount = 600;///< 600
@@ -41,7 +41,6 @@ static const NSUInteger defaultSendBufferMaxCount = 600;///< 最大缓冲区为6
self.maxCount = defaultSendBufferMaxCount;
self.lastDropFrames = 0;
self.startTimer = NO;
self.needDropFrame = YES;
}
return self;
}
@@ -92,26 +91,21 @@ static const NSUInteger defaultSendBufferMaxCount = 600;///< 最大缓冲区为6
- (void)removeExpireFrame {
if (self.list.count < self.maxCount) return;
if(self.needDropFrame){
NSArray *pFrames = [self expirePFrames];///< P到第一个I之间的p帧
self.lastDropFrames += [pFrames count];
if (pFrames && pFrames.count > 0) {
[self.list removeObjectsInArray:pFrames];
return;
}
NSArray *iFrames = [self expireIFrames];///<  I帧I帧可能对应多个nal
self.lastDropFrames += [iFrames count];
if (iFrames) {
[self.list removeObjectsInArray:iFrames];
return;
}
[self.list removeAllObjects];
}else{
[self.list lfPopFirstObject];
NSArray *pFrames = [self expirePFrames];///< P到第一个I之间的p帧
self.lastDropFrames += [pFrames count];
if (pFrames && pFrames.count > 0) {
[self.list removeObjectsInArray:pFrames];
return;
}
NSArray *iFrames = [self expireIFrames];///<  I帧I帧可能对应多个nal
self.lastDropFrames += [iFrames count];
if (iFrames) {
[self.list removeObjectsInArray:iFrames];
return;
}
[self.list removeAllObjects];
}
- (NSArray *)expirePFrames {
@@ -161,9 +155,9 @@ NSInteger frameDataCompare(id obj1, id obj2, void *context){
NSInteger decreaseCount = 0;
for (NSNumber *number in self.thresholdList) {
if (number.integerValue >= currentCount) {
if (number.integerValue > currentCount) {
increaseCount++;
} else {
} else{
decreaseCount++;
}
currentCount = [number integerValue];
@@ -176,7 +170,7 @@ NSInteger frameDataCompare(id obj1, id obj2, void *context){
if (decreaseCount >= self.callBackInterval) {
return LFLiveBuffferDecline;
}
return LFLiveBuffferUnknown;
}
@@ -210,7 +204,7 @@ NSInteger frameDataCompare(id obj1, id obj2, void *context){
dispatch_semaphore_wait(_lock, DISPATCH_TIME_FOREVER);
[self.thresholdList addObject:@(self.list.count)];
dispatch_semaphore_signal(_lock);
if (self.currentInterval >= self.callBackInterval) {
LFLiveBuffferState state = [self currentBufferState];
if (state == LFLiveBuffferIncrease) {
+2 -2
View File
@@ -2,8 +2,8 @@
// NSMutableArray+LFAdd.h
// YYKit
//
// Created by admin on 16/5/20.
// Copyright © 2016年 倾慕. All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#import <Foundation/Foundation.h>
+2 -2
View File
@@ -2,8 +2,8 @@
// NSMutableArray+LFAdd.m
// YYKit
//
// Created by admin on 16/5/20.
// Copyright © 2016 . All rights reserved.
// Created by LaiFeng on 16/5/20.
// Copyright © 2016 LaiFeng All rights reserved.
//
#import "NSMutableArray+LFAdd.h"
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:LFLiveKitDemo.xcodeproj">
</FileRef>
</Workspace>
@@ -1,91 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0730"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "84D8B4251D75778B00752B56"
BuildableName = "LFLiveKitDemo.app"
BlueprintName = "LFLiveKitDemo"
ReferencedContainer = "container:LFLiveKitDemo.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "84D8B4251D75778B00752B56"
BuildableName = "LFLiveKitDemo.app"
BlueprintName = "LFLiveKitDemo"
ReferencedContainer = "container:LFLiveKitDemo.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "84D8B4251D75778B00752B56"
BuildableName = "LFLiveKitDemo.app"
BlueprintName = "LFLiveKitDemo"
ReferencedContainer = "container:LFLiveKitDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "84D8B4251D75778B00752B56"
BuildableName = "LFLiveKitDemo.app"
BlueprintName = "LFLiveKitDemo"
ReferencedContainer = "container:LFLiveKitDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>LFLiveKitDemo.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>84D8B4251D75778B00752B56</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:LFLiveKitSwiftDemo.xcodeproj">
</FileRef>
</Workspace>
@@ -1,10 +0,0 @@
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#ifndef LFLiveKitSwiftDemo_Bridging_H
#define LFLiveKitSwiftDemo_Bridging_H
#import <LFLiveKit/LFLiveKit.h>
#endif
+52 -49
View File
@@ -66,71 +66,74 @@ LFLiveKit
* VideoToolbox
* AudioToolbox
* libz
* libstdc++
## Usage example
#### Objective-C
```objc
- (LFLiveSession*)session {
if (!_session) {
_session = [[LFLiveSession alloc] initWithAudioConfiguration:[LFLiveAudioConfiguration defaultConfiguration] videoConfiguration:[LFLiveVideoConfiguration defaultConfiguration]];
_session.preView = self;
_session.delegate = self;
}
return _session;
}
- (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)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;
- (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
```swift
// import LFLiveKit in [ProjectName]-Bridging-Header.h
#import <LFLiveKit.h>
// 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: - 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)
}
//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)
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)
```
## Release History
* 2.0.0
* CHANGE: modify bugs,support ios7 live.
* 2.2.4.3
* CHANGE: modify bugs,support swift import.
## License
@@ -25,30 +25,13 @@
84D8B4631D75782700752B56 /* close_preview@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 84D8B4581D75782700752B56 /* close_preview@2x.png */; };
84D8B4641D75782700752B56 /* close_preview@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 84D8B4591D75782700752B56 /* close_preview@3x.png */; };
84D8B4651D75782700752B56 /* ios-29x29.png in Resources */ = {isa = PBXBuildFile; fileRef = 84D8B45A1D75782700752B56 /* ios-29x29.png */; };
84D8B4681D75783F00752B56 /* GPUImage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D8B4661D75783F00752B56 /* GPUImage.framework */; };
84D8B4CF1D757F0700752B56 /* libstdc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D8B4CE1D757F0700752B56 /* libstdc++.tbd */; };
84D8B5541D76822C00752B56 /* pili-librtmp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D8B5531D76822C00752B56 /* pili-librtmp.framework */; };
84D8B5F41D768B9E00752B56 /* LFLiveKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D8B5F11D768B8300752B56 /* LFLiveKit.framework */; };
BC8B37EEE1CEEF9B5614DC91 /* libPods-LFLiveKitDemo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5B1CCEEE06FCFAF75D105A51 /* libPods-LFLiveKitDemo.a */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
84D8B5F01D768B8300752B56 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 84D8B5EC1D768B8300752B56 /* LFLiveKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 84D8B3901D7574D600752B56;
remoteInfo = LFLiveKit;
};
84D8B5F21D768B9700752B56 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 84D8B5EC1D768B8300752B56 /* LFLiveKit.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 84D8B38F1D7574D600752B56;
remoteInfo = LFLiveKit;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
289A9C4510CD7EA6F4CE9897 /* Pods-LFLiveKitDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LFLiveKitDemo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-LFLiveKitDemo/Pods-LFLiveKitDemo.debug.xcconfig"; sourceTree = "<group>"; };
5B1CCEEE06FCFAF75D105A51 /* libPods-LFLiveKitDemo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-LFLiveKitDemo.a"; sourceTree = BUILT_PRODUCTS_DIR; };
84D8B4261D75778B00752B56 /* LFLiveKitDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LFLiveKitDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
84D8B42A1D75778B00752B56 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
84D8B42C1D75778B00752B56 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
@@ -74,10 +57,8 @@
84D8B4581D75782700752B56 /* close_preview@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "close_preview@2x.png"; sourceTree = "<group>"; };
84D8B4591D75782700752B56 /* close_preview@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "close_preview@3x.png"; sourceTree = "<group>"; };
84D8B45A1D75782700752B56 /* ios-29x29.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ios-29x29.png"; sourceTree = "<group>"; };
84D8B4661D75783F00752B56 /* GPUImage.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GPUImage.framework; path = ../Vendor/GPUImage.framework; sourceTree = "<group>"; };
84D8B4CE1D757F0700752B56 /* libstdc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libstdc++.tbd"; path = "usr/lib/libstdc++.tbd"; sourceTree = SDKROOT; };
84D8B5531D76822C00752B56 /* pili-librtmp.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "pili-librtmp.framework"; path = "../Vendor/pili-librtmp.framework"; sourceTree = "<group>"; };
84D8B5EC1D768B8300752B56 /* LFLiveKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = LFLiveKit.xcodeproj; path = ../FrameWork/LFLiveKit.xcodeproj; sourceTree = "<group>"; };
96E1231310083A3881AD2AB6 /* Pods-LFLiveKitDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LFLiveKitDemo.release.xcconfig"; path = "Pods/Target Support Files/Pods-LFLiveKitDemo/Pods-LFLiveKitDemo.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -85,25 +66,30 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
84D8B5F41D768B9E00752B56 /* LFLiveKit.framework in Frameworks */,
84D8B5541D76822C00752B56 /* pili-librtmp.framework in Frameworks */,
84D8B4CF1D757F0700752B56 /* libstdc++.tbd in Frameworks */,
84D8B4681D75783F00752B56 /* GPUImage.framework in Frameworks */,
BC8B37EEE1CEEF9B5614DC91 /* libPods-LFLiveKitDemo.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
65E0CF98FF954863E543A0E1 /* Frameworks */ = {
isa = PBXGroup;
children = (
5B1CCEEE06FCFAF75D105A51 /* libPods-LFLiveKitDemo.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
84D8B41D1D75778B00752B56 = {
isa = PBXGroup;
children = (
84D8B5EC1D768B8300752B56 /* LFLiveKit.xcodeproj */,
84D8B5531D76822C00752B56 /* pili-librtmp.framework */,
84D8B4CE1D757F0700752B56 /* libstdc++.tbd */,
84D8B4661D75783F00752B56 /* GPUImage.framework */,
84D8B4281D75778B00752B56 /* LFLiveKitDemo */,
84D8B4271D75778B00752B56 /* Products */,
F3E359B8A7561F963C47A62F /* Pods */,
65E0CF98FF954863E543A0E1 /* Frameworks */,
);
sourceTree = "<group>";
};
@@ -170,12 +156,13 @@
path = images;
sourceTree = "<group>";
};
84D8B5ED1D768B8300752B56 /* Products */ = {
F3E359B8A7561F963C47A62F /* Pods */ = {
isa = PBXGroup;
children = (
84D8B5F11D768B8300752B56 /* LFLiveKit.framework */,
289A9C4510CD7EA6F4CE9897 /* Pods-LFLiveKitDemo.debug.xcconfig */,
96E1231310083A3881AD2AB6 /* Pods-LFLiveKitDemo.release.xcconfig */,
);
name = Products;
name = Pods;
sourceTree = "<group>";
};
/* End PBXGroup section */
@@ -185,14 +172,16 @@
isa = PBXNativeTarget;
buildConfigurationList = 84D8B43D1D75778B00752B56 /* Build configuration list for PBXNativeTarget "LFLiveKitDemo" */;
buildPhases = (
A819C09CC049A57DC5C97E12 /* 📦 Check Pods Manifest.lock */,
84D8B4221D75778B00752B56 /* Sources */,
84D8B4231D75778B00752B56 /* Frameworks */,
84D8B4241D75778B00752B56 /* Resources */,
883533331BE4DCC0DB5075CF /* 📦 Embed Pods Frameworks */,
4CC4C37B93D109913E475307 /* 📦 Copy Pods Resources */,
);
buildRules = (
);
dependencies = (
84D8B5F31D768B9700752B56 /* PBXTargetDependency */,
);
name = LFLiveKitDemo;
productName = LFLiveKitDemo;
@@ -210,6 +199,7 @@
TargetAttributes = {
84D8B4251D75778B00752B56 = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = G497YX6CBT;
};
};
};
@@ -224,12 +214,6 @@
mainGroup = 84D8B41D1D75778B00752B56;
productRefGroup = 84D8B4271D75778B00752B56 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 84D8B5ED1D768B8300752B56 /* Products */;
ProjectRef = 84D8B5EC1D768B8300752B56 /* LFLiveKit.xcodeproj */;
},
);
projectRoot = "";
targets = (
84D8B4251D75778B00752B56 /* LFLiveKitDemo */,
@@ -237,16 +221,6 @@
};
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
84D8B5F11D768B8300752B56 /* LFLiveKit.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = LFLiveKit.framework;
remoteRef = 84D8B5F01D768B8300752B56 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
84D8B4241D75778B00752B56 /* Resources */ = {
isa = PBXResourcesBuildPhase;
@@ -269,6 +243,54 @@
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
4CC4C37B93D109913E475307 /* 📦 Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "📦 Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-LFLiveKitDemo/Pods-LFLiveKitDemo-resources.sh\"\n";
showEnvVarsInLog = 0;
};
883533331BE4DCC0DB5075CF /* 📦 Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "📦 Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-LFLiveKitDemo/Pods-LFLiveKitDemo-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
A819C09CC049A57DC5C97E12 /* 📦 Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "📦 Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
84D8B4221D75778B00752B56 /* Sources */ = {
isa = PBXSourcesBuildPhase;
@@ -285,14 +307,6 @@
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
84D8B5F31D768B9700752B56 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = LFLiveKit;
targetProxy = 84D8B5F21D768B9700752B56 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
84D8B4321D75778B00752B56 /* Main.storyboard */ = {
isa = PBXVariantGroup;
@@ -397,38 +411,36 @@
};
84D8B43E1D75778B00752B56 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 289A9C4510CD7EA6F4CE9897 /* Pods-LFLiveKitDemo.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/../Vendor\"/**",
);
HEADER_SEARCH_PATHS = "";
DEVELOPMENT_TEAM = G497YX6CBT;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
HEADER_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = LFLiveKitDemo/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = "";
OTHER_LDFLAGS = "-all_load";
PRODUCT_BUNDLE_IDENTIFIER = com.youku.LFLiveKitDemo;
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = com.youku.LaiFeng;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
84D8B43F1D75778B00752B56 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 96E1231310083A3881AD2AB6 /* Pods-LFLiveKitDemo.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/../Vendor\"/**",
);
HEADER_SEARCH_PATHS = "";
DEVELOPMENT_TEAM = G497YX6CBT;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
HEADER_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = LFLiveKitDemo/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = "";
OTHER_LDFLAGS = "-all_load";
PRODUCT_BUNDLE_IDENTIFIER = com.youku.LFLiveKitDemo;
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = com.youku.LaiFeng;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

@@ -26,13 +26,16 @@
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>NSCameraUsageDescription</key>
<string>cameraDesciption</string>
<key>NSMicrophoneUsageDescription</key>
<string>microphoneDesciption</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
+374
View File
@@ -0,0 +1,374 @@
//
// LFLivePreview.m
// LFLiveKit
//
// Created by on 16/5/2.
// Copyright © 2016 live Interactive. All rights reserved.
//
#import "LFLivePreview.h"
#import "UIControl+YYAdd.h"
#import "UIView+YYAdd.h"
#import "LFLiveKit.h"
inline static NSString *formatedSpeed(float bytes, float elapsed_milli) {
if (elapsed_milli <= 0) {
return @"N/A";
}
if (bytes <= 0) {
return @"0 KB/s";
}
float bytes_per_sec = ((float)bytes) * 1000.f / elapsed_milli;
if (bytes_per_sec >= 1000 * 1000) {
return [NSString stringWithFormat:@"%.2f MB/s", ((float)bytes_per_sec) / 1000 / 1000];
} else if (bytes_per_sec >= 1000) {
return [NSString stringWithFormat:@"%.1f KB/s", ((float)bytes_per_sec) / 1000];
} else {
return [NSString stringWithFormat:@"%ld B/s", (long)bytes_per_sec];
}
}
@interface LFLivePreview ()<LFLiveSessionDelegate>
@property (nonatomic, strong) UIButton *beautyButton;
@property (nonatomic, strong) UIButton *cameraButton;
@property (nonatomic, strong) UIButton *closeButton;
@property (nonatomic, strong) UIButton *startLiveButton;
@property (nonatomic, strong) UIView *containerView;
@property (nonatomic, strong) LFLiveDebug *debugInfo;
@property (nonatomic, strong) LFLiveSession *session;
@property (nonatomic, strong) UILabel *stateLabel;
@end
@implementation LFLivePreview
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
self.backgroundColor = [UIColor clearColor];
[self requestAccessForVideo];
[self requestAccessForAudio];
[self addSubview:self.containerView];
[self.containerView addSubview:self.stateLabel];
[self.containerView addSubview:self.closeButton];
[self.containerView addSubview:self.cameraButton];
[self.containerView addSubview:self.beautyButton];
[self.containerView addSubview:self.startLiveButton];
}
return self;
}
#pragma mark -- Public Method
- (void)requestAccessForVideo {
__weak typeof(self) _self = self;
AVAuthorizationStatus status = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
switch (status) {
case AVAuthorizationStatusNotDetermined: {
//
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
if (granted) {
dispatch_async(dispatch_get_main_queue(), ^{
[_self.session setRunning:YES];
});
}
}];
break;
}
case AVAuthorizationStatusAuthorized: {
//
dispatch_async(dispatch_get_main_queue(), ^{
[_self.session setRunning:YES];
});
break;
}
case AVAuthorizationStatusDenied:
case AVAuthorizationStatusRestricted:
// 访
break;
default:
break;
}
}
- (void)requestAccessForAudio {
AVAuthorizationStatus status = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeAudio];
switch (status) {
case AVAuthorizationStatusNotDetermined: {
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeAudio completionHandler:^(BOOL granted) {
}];
break;
}
case AVAuthorizationStatusAuthorized: {
break;
}
case AVAuthorizationStatusDenied:
case AVAuthorizationStatusRestricted:
break;
default:
break;
}
}
#pragma mark -- LFStreamingSessionDelegate
/** live status changed will callback */
- (void)liveSession:(nullable LFLiveSession *)session liveStateDidChange:(LFLiveState)state {
NSLog(@"liveStateDidChange: %ld", state);
switch (state) {
case LFLiveReady:
_stateLabel.text = @"未连接";
break;
case LFLivePending:
_stateLabel.text = @"连接中";
break;
case LFLiveStart:
_stateLabel.text = @"已连接";
break;
case LFLiveError:
_stateLabel.text = @"连接错误";
break;
case LFLiveStop:
_stateLabel.text = @"未连接";
break;
default:
break;
}
}
/** live debug info callback */
- (void)liveSession:(nullable LFLiveSession *)session debugInfo:(nullable LFLiveDebug *)debugInfo {
NSLog(@"debugInfo uploadSpeed: %@", formatedSpeed(debugInfo.currentBandwidth, debugInfo.elapsedMilli));
}
/** callback socket errorcode */
- (void)liveSession:(nullable LFLiveSession *)session errorCode:(LFLiveSocketErrorCode)errorCode {
NSLog(@"errorCode: %ld", errorCode);
}
#pragma mark -- Getter Setter
- (LFLiveSession *)session {
if (!_session) {
/** 发现大家有不会用横屏的请注意啦,横屏需要在ViewController supportedInterfaceOrientations修改方向 默认竖屏 ****/
/** 发现大家有不会用横屏的请注意啦,横屏需要在ViewController supportedInterfaceOrientations修改方向 默认竖屏 ****/
/** 发现大家有不会用横屏的请注意啦,横屏需要在ViewController supportedInterfaceOrientations修改方向 默认竖屏 ****/
/***  默认分辨率368 640 音频:44.1 iphone6以上48 双声道 方向竖屏 ***/
LFLiveVideoConfiguration *videoConfiguration = [LFLiveVideoConfiguration new];
videoConfiguration.videoSize = CGSizeMake(640, 360);
videoConfiguration.videoBitRate = 800*1024;
videoConfiguration.videoMaxBitRate = 1000*1024;
videoConfiguration.videoMinBitRate = 500*1024;
videoConfiguration.videoFrameRate = 24;
videoConfiguration.videoMaxKeyframeInterval = 48;
videoConfiguration.outputImageOrientation = UIInterfaceOrientationLandscapeLeft;
videoConfiguration.autorotate = NO;
videoConfiguration.sessionPreset = LFCaptureSessionPreset720x1280;
_session = [[LFLiveSession alloc] initWithAudioConfiguration:[LFLiveAudioConfiguration defaultConfiguration] videoConfiguration:videoConfiguration captureType:LFLiveCaptureDefaultMask];
/**   自己定制单声道 */
/*
LFLiveAudioConfiguration *audioConfiguration = [LFLiveAudioConfiguration new];
audioConfiguration.numberOfChannels = 1;
audioConfiguration.audioBitrate = LFLiveAudioBitRate_64Kbps;
audioConfiguration.audioSampleRate = LFLiveAudioSampleRate_44100Hz;
_session = [[LFLiveSession alloc] initWithAudioConfiguration:audioConfiguration videoConfiguration:[LFLiveVideoConfiguration defaultConfiguration]];
*/
/**   自己定制高质量音频96K */
/*
LFLiveAudioConfiguration *audioConfiguration = [LFLiveAudioConfiguration new];
audioConfiguration.numberOfChannels = 2;
audioConfiguration.audioBitrate = LFLiveAudioBitRate_96Kbps;
audioConfiguration.audioSampleRate = LFLiveAudioSampleRate_44100Hz;
_session = [[LFLiveSession alloc] initWithAudioConfiguration:audioConfiguration videoConfiguration:[LFLiveVideoConfiguration defaultConfiguration]];
*/
/**   自己定制高质量音频96K 分辨率设置为540*960 方向竖屏 */
/*
LFLiveAudioConfiguration *audioConfiguration = [LFLiveAudioConfiguration new];
audioConfiguration.numberOfChannels = 2;
audioConfiguration.audioBitrate = LFLiveAudioBitRate_96Kbps;
audioConfiguration.audioSampleRate = LFLiveAudioSampleRate_44100Hz;
LFLiveVideoConfiguration *videoConfiguration = [LFLiveVideoConfiguration new];
videoConfiguration.videoSize = CGSizeMake(540, 960);
videoConfiguration.videoBitRate = 800*1024;
videoConfiguration.videoMaxBitRate = 1000*1024;
videoConfiguration.videoMinBitRate = 500*1024;
videoConfiguration.videoFrameRate = 24;
videoConfiguration.videoMaxKeyframeInterval = 48;
videoConfiguration.orientation = UIInterfaceOrientationPortrait;
videoConfiguration.sessionPreset = LFCaptureSessionPreset540x960;
_session = [[LFLiveSession alloc] initWithAudioConfiguration:audioConfiguration videoConfiguration:videoConfiguration];
*/
/**   自己定制高质量音频128K 分辨率设置为720*1280 方向竖屏 */
/*
LFLiveAudioConfiguration *audioConfiguration = [LFLiveAudioConfiguration new];
audioConfiguration.numberOfChannels = 2;
audioConfiguration.audioBitrate = LFLiveAudioBitRate_128Kbps;
audioConfiguration.audioSampleRate = LFLiveAudioSampleRate_44100Hz;
LFLiveVideoConfiguration *videoConfiguration = [LFLiveVideoConfiguration new];
videoConfiguration.videoSize = CGSizeMake(720, 1280);
videoConfiguration.videoBitRate = 800*1024;
videoConfiguration.videoMaxBitRate = 1000*1024;
videoConfiguration.videoMinBitRate = 500*1024;
videoConfiguration.videoFrameRate = 15;
videoConfiguration.videoMaxKeyframeInterval = 30;
videoConfiguration.landscape = NO;
videoConfiguration.sessionPreset = LFCaptureSessionPreset360x640;
_session = [[LFLiveSession alloc] initWithAudioConfiguration:audioConfiguration videoConfiguration:videoConfiguration];
*/
/**   自己定制高质量音频128K 分辨率设置为720*1280 方向横屏 */
/*
LFLiveAudioConfiguration *audioConfiguration = [LFLiveAudioConfiguration new];
audioConfiguration.numberOfChannels = 2;
audioConfiguration.audioBitrate = LFLiveAudioBitRate_128Kbps;
audioConfiguration.audioSampleRate = LFLiveAudioSampleRate_44100Hz;
LFLiveVideoConfiguration *videoConfiguration = [LFLiveVideoConfiguration new];
videoConfiguration.videoSize = CGSizeMake(1280, 720);
videoConfiguration.videoBitRate = 800*1024;
videoConfiguration.videoMaxBitRate = 1000*1024;
videoConfiguration.videoMinBitRate = 500*1024;
videoConfiguration.videoFrameRate = 15;
videoConfiguration.videoMaxKeyframeInterval = 30;
videoConfiguration.landscape = YES;
videoConfiguration.sessionPreset = LFCaptureSessionPreset720x1280;
_session = [[LFLiveSession alloc] initWithAudioConfiguration:audioConfiguration videoConfiguration:videoConfiguration];
*/
_session.delegate = self;
_session.showDebugInfo = NO;
_session.preView = self;
/*本地存储*/
// _session.saveLocalVideo = YES;
// NSString *pathToMovie = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Movie.mp4"];
// unlink([pathToMovie UTF8String]); // If a file already exists, AVAssetWriter won't let you record new frames, so delete the old movie
// NSURL *movieURL = [NSURL fileURLWithPath:pathToMovie];
// _session.saveLocalVideoPath = movieURL;
/*
UIImageView *imageView = [[UIImageView alloc] init];
imageView.alpha = 0.8;
imageView.frame = CGRectMake(100, 100, 29, 29);
imageView.image = [UIImage imageNamed:@"ios-29x29"];
_session.warterMarkView = imageView;*/
}
return _session;
}
- (UIView *)containerView {
if (!_containerView) {
_containerView = [UIView new];
_containerView.frame = self.bounds;
_containerView.backgroundColor = [UIColor clearColor];
_containerView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
}
return _containerView;
}
- (UILabel *)stateLabel {
if (!_stateLabel) {
_stateLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 20, 80, 40)];
_stateLabel.text = @"未连接";
_stateLabel.textColor = [UIColor whiteColor];
_stateLabel.font = [UIFont boldSystemFontOfSize:14.f];
}
return _stateLabel;
}
- (UIButton *)closeButton {
if (!_closeButton) {
_closeButton = [UIButton new];
_closeButton.size = CGSizeMake(44, 44);
_closeButton.left = self.width - 10 - _closeButton.width;
_closeButton.top = 20;
[_closeButton setImage:[UIImage imageNamed:@"close_preview"] forState:UIControlStateNormal];
_closeButton.exclusiveTouch = YES;
[_closeButton addBlockForControlEvents:UIControlEventTouchUpInside block:^(id sender) {
}];
}
return _closeButton;
}
- (UIButton *)cameraButton {
if (!_cameraButton) {
_cameraButton = [UIButton new];
_cameraButton.size = CGSizeMake(44, 44);
_cameraButton.origin = CGPointMake(_closeButton.left - 10 - _cameraButton.width, 20);
[_cameraButton setImage:[UIImage imageNamed:@"camra_preview"] forState:UIControlStateNormal];
_cameraButton.exclusiveTouch = YES;
__weak typeof(self) _self = self;
[_cameraButton addBlockForControlEvents:UIControlEventTouchUpInside block:^(id sender) {
AVCaptureDevicePosition devicePositon = _self.session.captureDevicePosition;
_self.session.captureDevicePosition = (devicePositon == AVCaptureDevicePositionBack) ? AVCaptureDevicePositionFront : AVCaptureDevicePositionBack;
}];
}
return _cameraButton;
}
- (UIButton *)beautyButton {
if (!_beautyButton) {
_beautyButton = [UIButton new];
_beautyButton.size = CGSizeMake(44, 44);
_beautyButton.origin = CGPointMake(_cameraButton.left - 10 - _beautyButton.width, 20);
[_beautyButton setImage:[UIImage imageNamed:@"camra_beauty"] forState:UIControlStateNormal];
[_beautyButton setImage:[UIImage imageNamed:@"camra_beauty_close"] forState:UIControlStateSelected];
_beautyButton.exclusiveTouch = YES;
__weak typeof(self) _self = self;
[_beautyButton addBlockForControlEvents:UIControlEventTouchUpInside block:^(id sender) {
_self.session.beautyFace = !_self.session.beautyFace;
_self.beautyButton.selected = !_self.session.beautyFace;
}];
}
return _beautyButton;
}
- (UIButton *)startLiveButton {
if (!_startLiveButton) {
_startLiveButton = [UIButton new];
_startLiveButton.size = CGSizeMake(self.width - 60, 44);
_startLiveButton.left = 30;
_startLiveButton.bottom = self.height - 50;
_startLiveButton.layer.cornerRadius = _startLiveButton.height/2;
[_startLiveButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[_startLiveButton.titleLabel setFont:[UIFont systemFontOfSize:16]];
[_startLiveButton setTitle:@"开始直播" forState:UIControlStateNormal];
[_startLiveButton setBackgroundColor:[UIColor colorWithRed:50 green:32 blue:245 alpha:1]];
_startLiveButton.exclusiveTouch = YES;
__weak typeof(self) _self = self;
[_startLiveButton addBlockForControlEvents:UIControlEventTouchUpInside block:^(id sender) {
_self.startLiveButton.selected = !_self.startLiveButton.selected;
if (_self.startLiveButton.selected) {
[_self.startLiveButton setTitle:@"结束直播" forState:UIControlStateNormal];
LFLiveStreamInfo *stream = [LFLiveStreamInfo new];
stream.url = @"rtmp://live.hkstv.hk.lxdns.com:1935/live/stream153";
[_self.session startLive:stream];
} else {
[_self.startLiveButton setTitle:@"开始直播" forState:UIControlStateNormal];
[_self.session stopLive];
}
}];
}
return _startLiveButton;
}
@end
@@ -22,7 +22,7 @@
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
return UIInterfaceOrientationMaskLandscape;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before

Width:  |  Height:  |  Size: 907 B

After

Width:  |  Height:  |  Size: 907 B

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

+6
View File
@@ -0,0 +1,6 @@
source 'https://github.com/CocoaPods/Specs.git'
platform :ios,'7.0'
target “LFLiveKitDemo” do
pod 'LFLiveKit', :path => '../../.'
end
@@ -0,0 +1,519 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
8495F6B01DB8F37300542124 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8495F6AF1DB8F37300542124 /* main.m */; };
8495F6B31DB8F37300542124 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8495F6B21DB8F37300542124 /* AppDelegate.m */; };
8495F6B61DB8F37300542124 /* FirstViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8495F6B51DB8F37300542124 /* FirstViewController.m */; };
8495F6B91DB8F37300542124 /* SecondViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8495F6B81DB8F37300542124 /* SecondViewController.m */; };
8495F6BC1DB8F37300542124 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8495F6BA1DB8F37300542124 /* Main.storyboard */; };
8495F6BE1DB8F37300542124 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8495F6BD1DB8F37300542124 /* Assets.xcassets */; };
8495F6C11DB8F37300542124 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8495F6BF1DB8F37300542124 /* LaunchScreen.storyboard */; };
8495F6D31DB8F3CD00542124 /* LFLiveKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8495F6D01DB8F37E00542124 /* LFLiveKit.framework */; };
8495F6D71DB8F49800542124 /* GPUImage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8495F6D51DB8F49800542124 /* GPUImage.framework */; };
8495F6D81DB8F49800542124 /* pili-librtmp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8495F6D61DB8F49800542124 /* pili-librtmp.framework */; };
84D003561DB8F7FA00560583 /* UIControl+YYAdd.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D003471DB8F7FA00560583 /* UIControl+YYAdd.m */; };
84D003571DB8F7FA00560583 /* UIView+YYAdd.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D003491DB8F7FA00560583 /* UIView+YYAdd.m */; };
84D003581DB8F7FA00560583 /* camra_beauty@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 84D0034B1DB8F7FA00560583 /* camra_beauty@2x.png */; };
84D003591DB8F7FA00560583 /* camra_beauty@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 84D0034C1DB8F7FA00560583 /* camra_beauty@3x.png */; };
84D0035A1DB8F7FA00560583 /* camra_beauty_close@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 84D0034D1DB8F7FA00560583 /* camra_beauty_close@2x.png */; };
84D0035B1DB8F7FA00560583 /* camra_beauty_close@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 84D0034E1DB8F7FA00560583 /* camra_beauty_close@3x.png */; };
84D0035C1DB8F7FA00560583 /* camra_preview@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 84D0034F1DB8F7FA00560583 /* camra_preview@2x.png */; };
84D0035D1DB8F7FA00560583 /* camra_preview@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 84D003501DB8F7FA00560583 /* camra_preview@3x.png */; };
84D0035E1DB8F7FA00560583 /* close_preview@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 84D003511DB8F7FA00560583 /* close_preview@2x.png */; };
84D0035F1DB8F7FA00560583 /* close_preview@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 84D003521DB8F7FA00560583 /* close_preview@3x.png */; };
84D003601DB8F7FA00560583 /* ios-29x29.png in Resources */ = {isa = PBXBuildFile; fileRef = 84D003531DB8F7FA00560583 /* ios-29x29.png */; };
84D003611DB8F7FA00560583 /* LFLivePreview.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D003551DB8F7FA00560583 /* LFLivePreview.m */; };
84D003641DB8F83400560583 /* libstdc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D003631DB8F83400560583 /* libstdc++.tbd */; };
84D0036A1DB8F85E00560583 /* VideoToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D003691DB8F85E00560583 /* VideoToolbox.framework */; };
84D0036C1DB8F86700560583 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D0036B1DB8F86700560583 /* AudioToolbox.framework */; };
84D0036E1DB8F86D00560583 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D0036D1DB8F86D00560583 /* AVFoundation.framework */; };
84D003711DB8F8BD00560583 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D003701DB8F8BD00560583 /* UIKit.framework */; };
84D003731DB8F8C200560583 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D003721DB8F8C200560583 /* Foundation.framework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
8495F6CD1DB8F37E00542124 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 8495F6C81DB8F37E00542124 /* LFLiveKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 84D8B3901D7574D600752B56;
remoteInfo = LFLiveKit;
};
8495F6CF1DB8F37E00542124 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 8495F6C81DB8F37E00542124 /* LFLiveKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 8495F66B1DB8F14600542124;
remoteInfo = LFLiveKitFramework;
};
8495F6D11DB8F3C400542124 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 8495F6C81DB8F37E00542124 /* LFLiveKit.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 8495F66A1DB8F14600542124;
remoteInfo = LFLiveKitFramework;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
8495F6AB1DB8F37300542124 /* LFLiveKitFrameworkDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LFLiveKitFrameworkDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
8495F6AF1DB8F37300542124 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
8495F6B11DB8F37300542124 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
8495F6B21DB8F37300542124 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
8495F6B41DB8F37300542124 /* FirstViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FirstViewController.h; sourceTree = "<group>"; };
8495F6B51DB8F37300542124 /* FirstViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FirstViewController.m; sourceTree = "<group>"; };
8495F6B71DB8F37300542124 /* SecondViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SecondViewController.h; sourceTree = "<group>"; };
8495F6B81DB8F37300542124 /* SecondViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SecondViewController.m; sourceTree = "<group>"; };
8495F6BB1DB8F37300542124 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
8495F6BD1DB8F37300542124 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
8495F6C01DB8F37300542124 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
8495F6C21DB8F37300542124 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8495F6C81DB8F37E00542124 /* LFLiveKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = LFLiveKit.xcodeproj; path = ../../FrameWork/LFLiveKit.xcodeproj; sourceTree = "<group>"; };
8495F6D51DB8F49800542124 /* GPUImage.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GPUImage.framework; path = vendors/GPUImage.framework; sourceTree = "<group>"; };
8495F6D61DB8F49800542124 /* pili-librtmp.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "pili-librtmp.framework"; path = "vendors/pili-librtmp.framework"; sourceTree = "<group>"; };
84D003461DB8F7FA00560583 /* UIControl+YYAdd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIControl+YYAdd.h"; sourceTree = "<group>"; };
84D003471DB8F7FA00560583 /* UIControl+YYAdd.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIControl+YYAdd.m"; sourceTree = "<group>"; };
84D003481DB8F7FA00560583 /* UIView+YYAdd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+YYAdd.h"; sourceTree = "<group>"; };
84D003491DB8F7FA00560583 /* UIView+YYAdd.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+YYAdd.m"; sourceTree = "<group>"; };
84D0034B1DB8F7FA00560583 /* camra_beauty@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "camra_beauty@2x.png"; sourceTree = "<group>"; };
84D0034C1DB8F7FA00560583 /* camra_beauty@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "camra_beauty@3x.png"; sourceTree = "<group>"; };
84D0034D1DB8F7FA00560583 /* camra_beauty_close@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "camra_beauty_close@2x.png"; sourceTree = "<group>"; };
84D0034E1DB8F7FA00560583 /* camra_beauty_close@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "camra_beauty_close@3x.png"; sourceTree = "<group>"; };
84D0034F1DB8F7FA00560583 /* camra_preview@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "camra_preview@2x.png"; sourceTree = "<group>"; };
84D003501DB8F7FA00560583 /* camra_preview@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "camra_preview@3x.png"; sourceTree = "<group>"; };
84D003511DB8F7FA00560583 /* close_preview@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "close_preview@2x.png"; sourceTree = "<group>"; };
84D003521DB8F7FA00560583 /* close_preview@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "close_preview@3x.png"; sourceTree = "<group>"; };
84D003531DB8F7FA00560583 /* ios-29x29.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ios-29x29.png"; sourceTree = "<group>"; };
84D003541DB8F7FA00560583 /* LFLivePreview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LFLivePreview.h; sourceTree = "<group>"; };
84D003551DB8F7FA00560583 /* LFLivePreview.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LFLivePreview.m; sourceTree = "<group>"; };
84D003631DB8F83400560583 /* libstdc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libstdc++.tbd"; path = "usr/lib/libstdc++.tbd"; sourceTree = SDKROOT; };
84D003651DB8F84000560583 /* libresolv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libresolv.tbd; path = usr/lib/libresolv.tbd; sourceTree = SDKROOT; };
84D003671DB8F84800560583 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
84D003691DB8F85E00560583 /* VideoToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = VideoToolbox.framework; path = System/Library/Frameworks/VideoToolbox.framework; sourceTree = SDKROOT; };
84D0036B1DB8F86700560583 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
84D0036D1DB8F86D00560583 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
84D003701DB8F8BD00560583 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
84D003721DB8F8C200560583 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
8495F6A81DB8F37300542124 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
84D003731DB8F8C200560583 /* Foundation.framework in Frameworks */,
84D003711DB8F8BD00560583 /* UIKit.framework in Frameworks */,
84D0036E1DB8F86D00560583 /* AVFoundation.framework in Frameworks */,
84D0036C1DB8F86700560583 /* AudioToolbox.framework in Frameworks */,
84D0036A1DB8F85E00560583 /* VideoToolbox.framework in Frameworks */,
84D003641DB8F83400560583 /* libstdc++.tbd in Frameworks */,
8495F6D71DB8F49800542124 /* GPUImage.framework in Frameworks */,
8495F6D81DB8F49800542124 /* pili-librtmp.framework in Frameworks */,
8495F6D31DB8F3CD00542124 /* LFLiveKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
8495F6A21DB8F37300542124 = {
isa = PBXGroup;
children = (
8495F6C81DB8F37E00542124 /* LFLiveKit.xcodeproj */,
8495F6AD1DB8F37300542124 /* LFLiveKitFrameworkDemo */,
8495F6AC1DB8F37300542124 /* Products */,
8495F6D41DB8F49800542124 /* Frameworks */,
);
sourceTree = "<group>";
};
8495F6AC1DB8F37300542124 /* Products */ = {
isa = PBXGroup;
children = (
8495F6AB1DB8F37300542124 /* LFLiveKitFrameworkDemo.app */,
);
name = Products;
sourceTree = "<group>";
};
8495F6AD1DB8F37300542124 /* LFLiveKitFrameworkDemo */ = {
isa = PBXGroup;
children = (
8495F6B11DB8F37300542124 /* AppDelegate.h */,
8495F6B21DB8F37300542124 /* AppDelegate.m */,
8495F6B41DB8F37300542124 /* FirstViewController.h */,
8495F6B51DB8F37300542124 /* FirstViewController.m */,
8495F6B71DB8F37300542124 /* SecondViewController.h */,
8495F6B81DB8F37300542124 /* SecondViewController.m */,
84D003451DB8F7FA00560583 /* category */,
84D0034A1DB8F7FA00560583 /* images */,
84D003541DB8F7FA00560583 /* LFLivePreview.h */,
84D003551DB8F7FA00560583 /* LFLivePreview.m */,
8495F6BA1DB8F37300542124 /* Main.storyboard */,
8495F6BD1DB8F37300542124 /* Assets.xcassets */,
8495F6BF1DB8F37300542124 /* LaunchScreen.storyboard */,
8495F6C21DB8F37300542124 /* Info.plist */,
8495F6AE1DB8F37300542124 /* Supporting Files */,
);
path = LFLiveKitFrameworkDemo;
sourceTree = "<group>";
};
8495F6AE1DB8F37300542124 /* Supporting Files */ = {
isa = PBXGroup;
children = (
8495F6AF1DB8F37300542124 /* main.m */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
8495F6C91DB8F37E00542124 /* Products */ = {
isa = PBXGroup;
children = (
8495F6CE1DB8F37E00542124 /* LFLiveKit.framework */,
8495F6D01DB8F37E00542124 /* LFLiveKit.framework */,
);
name = Products;
sourceTree = "<group>";
};
8495F6D41DB8F49800542124 /* Frameworks */ = {
isa = PBXGroup;
children = (
84D003721DB8F8C200560583 /* Foundation.framework */,
84D003701DB8F8BD00560583 /* UIKit.framework */,
84D0036D1DB8F86D00560583 /* AVFoundation.framework */,
84D0036B1DB8F86700560583 /* AudioToolbox.framework */,
84D003691DB8F85E00560583 /* VideoToolbox.framework */,
84D003671DB8F84800560583 /* libz.tbd */,
84D003651DB8F84000560583 /* libresolv.tbd */,
84D003631DB8F83400560583 /* libstdc++.tbd */,
8495F6D51DB8F49800542124 /* GPUImage.framework */,
8495F6D61DB8F49800542124 /* pili-librtmp.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
84D003451DB8F7FA00560583 /* category */ = {
isa = PBXGroup;
children = (
84D003461DB8F7FA00560583 /* UIControl+YYAdd.h */,
84D003471DB8F7FA00560583 /* UIControl+YYAdd.m */,
84D003481DB8F7FA00560583 /* UIView+YYAdd.h */,
84D003491DB8F7FA00560583 /* UIView+YYAdd.m */,
);
path = category;
sourceTree = "<group>";
};
84D0034A1DB8F7FA00560583 /* images */ = {
isa = PBXGroup;
children = (
84D0034B1DB8F7FA00560583 /* camra_beauty@2x.png */,
84D0034C1DB8F7FA00560583 /* camra_beauty@3x.png */,
84D0034D1DB8F7FA00560583 /* camra_beauty_close@2x.png */,
84D0034E1DB8F7FA00560583 /* camra_beauty_close@3x.png */,
84D0034F1DB8F7FA00560583 /* camra_preview@2x.png */,
84D003501DB8F7FA00560583 /* camra_preview@3x.png */,
84D003511DB8F7FA00560583 /* close_preview@2x.png */,
84D003521DB8F7FA00560583 /* close_preview@3x.png */,
84D003531DB8F7FA00560583 /* ios-29x29.png */,
);
path = images;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
8495F6AA1DB8F37300542124 /* LFLiveKitFrameworkDemo */ = {
isa = PBXNativeTarget;
buildConfigurationList = 8495F6C51DB8F37300542124 /* Build configuration list for PBXNativeTarget "LFLiveKitFrameworkDemo" */;
buildPhases = (
8495F6A71DB8F37300542124 /* Sources */,
8495F6A81DB8F37300542124 /* Frameworks */,
8495F6A91DB8F37300542124 /* Resources */,
);
buildRules = (
);
dependencies = (
8495F6D21DB8F3C400542124 /* PBXTargetDependency */,
);
name = LFLiveKitFrameworkDemo;
productName = LFLiveKitFrameworkDemo;
productReference = 8495F6AB1DB8F37300542124 /* LFLiveKitFrameworkDemo.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
8495F6A31DB8F37300542124 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = admin;
TargetAttributes = {
8495F6AA1DB8F37300542124 = {
CreatedOnToolsVersion = 8.0;
DevelopmentTeam = G497YX6CBT;
ProvisioningStyle = Automatic;
};
};
};
buildConfigurationList = 8495F6A61DB8F37300542124 /* Build configuration list for PBXProject "LFLiveKitFrameworkDemo" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 8495F6A21DB8F37300542124;
productRefGroup = 8495F6AC1DB8F37300542124 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 8495F6C91DB8F37E00542124 /* Products */;
ProjectRef = 8495F6C81DB8F37E00542124 /* LFLiveKit.xcodeproj */;
},
);
projectRoot = "";
targets = (
8495F6AA1DB8F37300542124 /* LFLiveKitFrameworkDemo */,
);
};
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
8495F6CE1DB8F37E00542124 /* LFLiveKit.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = LFLiveKit.framework;
remoteRef = 8495F6CD1DB8F37E00542124 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
8495F6D01DB8F37E00542124 /* LFLiveKit.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = LFLiveKit.framework;
remoteRef = 8495F6CF1DB8F37E00542124 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
8495F6A91DB8F37300542124 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
84D0035A1DB8F7FA00560583 /* camra_beauty_close@2x.png in Resources */,
8495F6C11DB8F37300542124 /* LaunchScreen.storyboard in Resources */,
84D003581DB8F7FA00560583 /* camra_beauty@2x.png in Resources */,
8495F6BE1DB8F37300542124 /* Assets.xcassets in Resources */,
84D0035D1DB8F7FA00560583 /* camra_preview@3x.png in Resources */,
84D0035B1DB8F7FA00560583 /* camra_beauty_close@3x.png in Resources */,
84D003601DB8F7FA00560583 /* ios-29x29.png in Resources */,
84D0035F1DB8F7FA00560583 /* close_preview@3x.png in Resources */,
84D0035E1DB8F7FA00560583 /* close_preview@2x.png in Resources */,
8495F6BC1DB8F37300542124 /* Main.storyboard in Resources */,
84D0035C1DB8F7FA00560583 /* camra_preview@2x.png in Resources */,
84D003591DB8F7FA00560583 /* camra_beauty@3x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
8495F6A71DB8F37300542124 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
84D003561DB8F7FA00560583 /* UIControl+YYAdd.m in Sources */,
8495F6B91DB8F37300542124 /* SecondViewController.m in Sources */,
84D003571DB8F7FA00560583 /* UIView+YYAdd.m in Sources */,
8495F6B31DB8F37300542124 /* AppDelegate.m in Sources */,
84D003611DB8F7FA00560583 /* LFLivePreview.m in Sources */,
8495F6B61DB8F37300542124 /* FirstViewController.m in Sources */,
8495F6B01DB8F37300542124 /* main.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
8495F6D21DB8F3C400542124 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = LFLiveKitFramework;
targetProxy = 8495F6D11DB8F3C400542124 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
8495F6BA1DB8F37300542124 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
8495F6BB1DB8F37300542124 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
8495F6BF1DB8F37300542124 /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
8495F6C01DB8F37300542124 /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
8495F6C31DB8F37300542124 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVES = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
name = Debug;
};
8495F6C41DB8F37300542124 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVES = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
8495F6C61DB8F37300542124 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = G497YX6CBT;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/vendors",
);
HEADER_SEARCH_PATHS = "\"$(SRCROOT)/vendors\"";
INFOPLIST_FILE = LFLiveKitFrameworkDemo/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = com.youku.LFLiveKitFrameworkDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
8495F6C71DB8F37300542124 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = G497YX6CBT;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/vendors",
);
HEADER_SEARCH_PATHS = "\"$(SRCROOT)/vendors\"";
INFOPLIST_FILE = LFLiveKitFrameworkDemo/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = com.youku.LFLiveKitFrameworkDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
8495F6A61DB8F37300542124 /* Build configuration list for PBXProject "LFLiveKitFrameworkDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
8495F6C31DB8F37300542124 /* Debug */,
8495F6C41DB8F37300542124 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
8495F6C51DB8F37300542124 /* Build configuration list for PBXNativeTarget "LFLiveKitFrameworkDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
8495F6C61DB8F37300542124 /* Debug */,
8495F6C71DB8F37300542124 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 8495F6A31DB8F37300542124 /* Project object */;
}
@@ -0,0 +1,17 @@
//
// AppDelegate.h
// LFLiveKitFrameworkDemo
//
// Created by admin on 2016/10/20.
// Copyright © 2016年 admin. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
@@ -0,0 +1,51 @@
//
// AppDelegate.m
// LFLiveKitFrameworkDemo
//
// Created by admin on 2016/10/20.
// Copyright © 2016 admin. All rights reserved.
//
#import "AppDelegate.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@end
@@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "first.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "second.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="49e-Tb-3d3">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--First-->
<scene sceneID="hNz-n2-bh7">
<objects>
<viewController id="9pv-A4-QxB" customClass="FirstViewController" customModuleProvider="" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Ia1-K6-d13"/>
<viewControllerLayoutGuide type="bottom" id="4ug-Mw-9AY"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="tsR-hK-woN">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" text="First View" textAlignment="center" lineBreakMode="tailTruncation" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="KQZ-1w-vlD">
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" name="Helvetica" family="Helvetica" pointSize="36"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Loaded by FirstViewController" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="A5M-7J-77L">
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="centerX" secondItem="KQZ-1w-vlD" secondAttribute="centerX" id="6BV-lF-sBN"/>
<constraint firstItem="A5M-7J-77L" firstAttribute="top" secondItem="KQZ-1w-vlD" secondAttribute="bottom" constant="8" symbolic="YES" id="cfb-er-3JN"/>
<constraint firstItem="A5M-7J-77L" firstAttribute="centerX" secondItem="KQZ-1w-vlD" secondAttribute="centerX" id="e1l-AV-tCB"/>
<constraint firstAttribute="centerY" secondItem="KQZ-1w-vlD" secondAttribute="centerY" id="exm-UA-ej4"/>
</constraints>
</view>
<tabBarItem key="tabBarItem" title="First" image="first" id="acW-dT-cKf"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="W5J-7L-Pyd" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="750" y="-320"/>
</scene>
<!--Second-->
<scene sceneID="wg7-f3-ORb">
<objects>
<viewController id="8rJ-Kc-sve" customClass="SecondViewController" customModuleProvider="" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="L7p-HK-0SC"/>
<viewControllerLayoutGuide type="bottom" id="Djb-ko-YwX"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="QS5-Rx-YEW">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" text="Second View" textAlignment="center" lineBreakMode="tailTruncation" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="zEq-FU-wV5">
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" name="Helvetica" family="Helvetica" pointSize="36"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Loaded by SecondViewController" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NDk-cv-Gan">
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="NDk-cv-Gan" firstAttribute="top" secondItem="zEq-FU-wV5" secondAttribute="bottom" constant="8" symbolic="YES" id="Day-4N-Vmt"/>
<constraint firstItem="NDk-cv-Gan" firstAttribute="centerX" secondItem="zEq-FU-wV5" secondAttribute="centerX" id="JgO-Fn-dHn"/>
<constraint firstAttribute="centerX" secondItem="zEq-FU-wV5" secondAttribute="centerX" id="qqM-NS-xev"/>
<constraint firstAttribute="centerY" secondItem="zEq-FU-wV5" secondAttribute="centerY" id="qzY-Ky-pLD"/>
</constraints>
</view>
<tabBarItem key="tabBarItem" title="Second" image="second" id="cPa-gy-q4n"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="4Nw-L8-lE0" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="750" y="360"/>
</scene>
<!--Tab Bar Controller-->
<scene sceneID="yl2-sM-qoP">
<objects>
<tabBarController id="49e-Tb-3d3" sceneMemberID="viewController">
<nil key="simulatedBottomBarMetrics"/>
<tabBar key="tabBar" contentMode="scaleToFill" id="W28-zg-YXA">
<rect key="frame" x="0.0" y="975" width="768" height="49"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
</tabBar>
<connections>
<segue destination="9pv-A4-QxB" kind="relationship" relationship="viewControllers" id="u7Y-xg-7CH"/>
<segue destination="8rJ-Kc-sve" kind="relationship" relationship="viewControllers" id="lzU-1b-eKA"/>
</connections>
</tabBarController>
<placeholder placeholderIdentifier="IBFirstResponder" id="HuB-VB-40B" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="0.0" y="0.0"/>
</scene>
</scenes>
<resources>
<image name="first" width="30" height="30"/>
<image name="second" width="30" height="30"/>
</resources>
</document>
@@ -0,0 +1,15 @@
//
// FirstViewController.h
// LFLiveKitFrameworkDemo
//
// Created by admin on 2016/10/20.
// Copyright © 2016年 admin. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface FirstViewController : UIViewController
@end
@@ -0,0 +1,30 @@
//
// FirstViewController.m
// LFLiveKitFrameworkDemo
//
// Created by admin on 2016/10/20.
// Copyright © 2016 admin. All rights reserved.
//
#import "FirstViewController.h"
#import <LFLiveKit/LFLiveKitFramework.h>
@interface FirstViewController ()
@end
@implementation FirstViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>NSCameraUsageDescription</key>
<string>..</string>
<key>NSMicrophoneUsageDescription</key>
<string>..</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UIStatusBarTintParameters</key>
<dict>
<key>UINavigationBar</key>
<dict>
<key>Style</key>
<string>UIBarStyleDefault</string>
<key>Translucent</key>
<false/>
</dict>
</dict>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
@@ -0,0 +1,13 @@
//
// LFLivePreview.h
// LFLiveKit
//
// Created by 倾慕 on 16/5/2.
// Copyright © 2016年 live Interactive. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface LFLivePreview : UIView
@end
@@ -9,7 +9,7 @@
#import "LFLivePreview.h"
#import "UIControl+YYAdd.h"
#import "UIView+YYAdd.h"
#import <LFLiveKit/LFLiveKit.h>
#import <LFLiveKit/LFLiveKitFramework.h>
inline static NSString *formatedSpeed(float bytes, float elapsed_milli) {
if (elapsed_milli <= 0) {
@@ -163,7 +163,8 @@ inline static NSString *formatedSpeed(float bytes, float elapsed_milli) {
videoConfiguration.videoMinBitRate = 500*1024;
videoConfiguration.videoFrameRate = 24;
videoConfiguration.videoMaxKeyframeInterval = 48;
videoConfiguration.landscape = NO;
videoConfiguration.outputImageOrientation = UIInterfaceOrientationPortrait;
videoConfiguration.autorotate = NO;
videoConfiguration.sessionPreset = LFCaptureSessionPreset720x1280;
_session = [[LFLiveSession alloc] initWithAudioConfiguration:[LFLiveAudioConfiguration defaultConfiguration] videoConfiguration:videoConfiguration captureType:LFLiveCaptureDefaultMask];
@@ -254,11 +255,19 @@ inline static NSString *formatedSpeed(float bytes, float elapsed_milli) {
_session.showDebugInfo = NO;
_session.preView = self;
/*本地存储*/
// _session.saveLocalVideo = YES;
// NSString *pathToMovie = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Movie.mp4"];
// unlink([pathToMovie UTF8String]); // If a file already exists, AVAssetWriter won't let you record new frames, so delete the old movie
// NSURL *movieURL = [NSURL fileURLWithPath:pathToMovie];
// _session.saveLocalVideoPath = movieURL;
/*
UIImageView *imageView = [[UIImageView alloc] init];
imageView.alpha = 0.8;
imageView.frame = CGRectMake(100, 100, 29, 29);
imageView.image = [UIImage imageNamed:@"ios-29x29"];
_session.warterMarkView = imageView;
_session.warterMarkView = imageView;*/
}
return _session;
@@ -0,0 +1,15 @@
//
// SecondViewController.h
// LFLiveKitFrameworkDemo
//
// Created by admin on 2016/10/20.
// Copyright © 2016年 admin. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SecondViewController : UIViewController
@end
@@ -0,0 +1,34 @@
//
// SecondViewController.m
// LFLiveKitFrameworkDemo
//
// Created by admin on 2016/10/20.
// Copyright © 2016 admin. All rights reserved.
//
#import "SecondViewController.h"
#import "LFLivePreview.h"
@interface SecondViewController ()
@end
@implementation SecondViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self.view addSubview:[[LFLivePreview alloc] initWithFrame:self.view.bounds]];
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return YES;
}
@end
@@ -0,0 +1,71 @@
//
// UIControl+YYAdd.h
//
//
// Created by guoyaoyuan on 13-4-5.
// Copyright (c) 2013 live Interactive. All rights reserved.
//
#import <UIKit/UIKit.h>
/**
Provides extensions for `UIControl`.
*/
@interface UIControl (YYAdd)
/**
Removes all targets and actions for a particular event (or events)
from an internal dispatch table.
*/
- (void)removeAllTargets;
/**
Adds or replaces a target and action for a particular event (or events)
to an internal dispatch table.
@param target The target objectthat is, the object to which the
action message is sent. If this is nil, the responder
chain is searched for an object willing to respond to the
action message.
@param action A selector identifying an action message. It cannot be NULL.
@param controlEvents A bitmask specifying the control events for which the
action message is sent.
*/
- (void)setTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents;
/**
Adds a block for a particular event (or events) to an internal dispatch table.
It will cause a strong reference to @a block.
@param block The block which is invoked then the action message is
sent (cannot be nil). The block is retained.
@param controlEvents A bitmask specifying the control events for which the
action message is sent.
*/
- (void)addBlockForControlEvents:(UIControlEvents)controlEvents block:(void (^)(id sender))block;
/**
Adds or replaces a block for a particular event (or events) to an internal
dispatch table. It will cause a strong reference to @a block.
@param block The block which is invoked then the action message is
sent (cannot be nil). The block is retained.
@param controlEvents A bitmask specifying the control events for which the
action message is sent.
*/
- (void)setBlockForControlEvents:(UIControlEvents)controlEvents block:(void (^)(id sender))block;
/**
Removes all blocks for a particular event (or events) from an internal
dispatch table.
@param controlEvents A bitmask specifying the control events for which the
action message is sent.
*/
- (void)removeAllBlocksForControlEvents:(UIControlEvents)controlEvents;
@end
@@ -0,0 +1,105 @@
//
// UIControl+YYAdd.m
//
//
// Created by guoyaoyuan on 13-4-5.
// Copyright (c) 2013 live Interactive. All rights reserved.
//
#import "UIControl+YYAdd.h"
#import <objc/runtime.h>
static const int block_key;
@interface _LFUIControlBlockTarget : NSObject
@property (nonatomic, copy) void (^block)(id sender);
@property (nonatomic, assign) UIControlEvents events;
- (id)initWithBlock:(void (^)(id sender))block events:(UIControlEvents)events;
- (void)invoke:(id)sender;
@end
@implementation _LFUIControlBlockTarget
- (id)initWithBlock:(void (^)(id sender))block events:(UIControlEvents)events {
self = [super init];
if (self) {
self.block = block;
self.events = events;
}
return self;
}
- (void)invoke:(id)sender {
if (self.block) self.block(sender);
}
@end
@implementation UIControl (LFAdd)
- (void)removeAllTargets {
[[self allTargets] enumerateObjectsUsingBlock: ^(id object, BOOL *stop) {
[self removeTarget:object
action:NULL
forControlEvents:UIControlEventAllEvents];
}];
}
- (void)setTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents {
NSSet *targets = [self allTargets];
for (id currentTarget in targets) {
NSArray *actions = [self actionsForTarget:currentTarget forControlEvent:controlEvents];
for (NSString *currentAction in actions) {
[self removeTarget:currentTarget action:NSSelectorFromString(currentAction)
forControlEvents:controlEvents];
}
}
[self addTarget:target action:action forControlEvents:controlEvents];
}
- (void)addBlockForControlEvents:(UIControlEvents)controlEvents
block:(void (^)(id sender))block {
_LFUIControlBlockTarget *target = [[_LFUIControlBlockTarget alloc]
initWithBlock:block events:controlEvents];
[self addTarget:target action:@selector(invoke:) forControlEvents:controlEvents];
NSMutableArray *targets = [self _lf_allUIControlBlockTargets];
[targets addObject:target];
}
- (void)setBlockForControlEvents:(UIControlEvents)controlEvents
block:(void (^)(id sender))block {
[self removeAllBlocksForControlEvents:controlEvents];
[self addBlockForControlEvents:controlEvents block:block];
}
- (void)removeAllBlocksForControlEvents:(UIControlEvents)controlEvents {
NSMutableArray *targets = [self _lf_allUIControlBlockTargets];
NSMutableArray *removes = [NSMutableArray array];
[targets enumerateObjectsUsingBlock: ^(id obj, NSUInteger idx, BOOL *stop) {
_LFUIControlBlockTarget *target = (_LFUIControlBlockTarget *)obj;
if (target.events == controlEvents) {
[removes addObject:target];
[self removeTarget:target
action:@selector(invoke:)
forControlEvents:controlEvents];
}
}];
[targets removeObjectsInArray:removes];
}
- (NSMutableArray *)_lf_allUIControlBlockTargets {
NSMutableArray *targets = objc_getAssociatedObject(self, &block_key);
if (!targets) {
targets = [NSMutableArray array];
objc_setAssociatedObject(self, &block_key, targets, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
return targets;
}
@end
@@ -0,0 +1,132 @@
//
// UIView+Add.h
//
//
// Created by guoyaoyuan on 13-4-3.
// Copyright (c) 2013 live Interactive. All rights reserved.
//
#import <UIKit/UIKit.h>
/**
Provides extensions for `UIView`.
*/
@interface UIView (YYAdd)
/**
Create a snapshot image of the complete view hierarchy.
This method should be called in main thread.
*/
- (nullable UIImage *)snapshotImage;
/**
Create a snapshot PDF of the complete view hierarchy.
This method should be called in main thread.
*/
- (nullable NSData *)snapshotPDF;
/**
Shortcut to set the view.layer's shadow
@param color Shadow Color
@param offset Shadow offset
@param radius Shadow radius
*/
- (void)setLayerShadow:(nullable UIColor*)color offset:(CGSize)offset radius:(CGFloat)radius;
/**
* liyuan+
*/
- (void) makeInsetShadow;
- (void) makeInsetShadowWithRadius:(float)radius Alpha:(float)alpha;
- (void) makeInsetShadowWithRadius:(float)radius Color:(nullable UIColor *)color Directions:(nullable NSArray *)directions;
/**
Remove all subviews.
@warning Never call this method inside your view's drawRect: method.
*/
- (void)removeAllSubviews;
/**
Returns the view's view controller (may be nil).
*/
@property (nonatomic, readonly,nullable) UIViewController *viewController;
@property (nonatomic) CGFloat left; ///< Shortcut for frame.origin.x.
@property (nonatomic) CGFloat top; ///< Shortcut for frame.origin.y
@property (nonatomic) CGFloat right; ///< Shortcut for frame.origin.x + frame.size.width
@property (nonatomic) CGFloat bottom; ///< Shortcut for frame.origin.y + frame.size.height
@property (nonatomic) CGFloat width; ///< Shortcut for frame.size.width.
@property (nonatomic) CGFloat height; ///< Shortcut for frame.size.height.
@property (nonatomic) CGFloat centerX; ///< Shortcut for center.x
@property (nonatomic) CGFloat centerY; ///< Shortcut for center.y
@property (nonatomic) CGPoint origin; ///< Shortcut for frame.origin.
@property (nonatomic) CGSize size; ///< Shortcut for frame.size.
@property (nonatomic, readonly) CGRect screenFrame; ///< View frame on the screen, taking into account scroll views.
/**
Returns the visible alpha on screen, taking into account superview and window.
*/
@property (nonatomic, readonly) CGFloat visibleAlpha;
/**
Converts a point from the receiver's coordinate system to that of the specified view or window.
@param point A point specified in the local coordinate system (bounds) of the receiver.
@param view The view or window into whose coordinate system point is to be converted.
If view is nil, this method instead converts to window base coordinates.
@return The point converted to the coordinate system of view.
*/
- (CGPoint)convertPoint:(CGPoint)point toViewOrWindow:(nullable UIView *)view;
/**
Converts a point from the coordinate system of a given view or window to that of the receiver.
@param point A point specified in the local coordinate system (bounds) of view.
@param view The view or window with point in its coordinate system.
If view is nil, this method instead converts from window base coordinates.
@return The point converted to the local coordinate system (bounds) of the receiver.
*/
- (CGPoint)convertPoint:(CGPoint)point fromViewOrWindow:(nullable UIView *)view;
/**
Converts a rectangle from the receiver's coordinate system to that of another view or window.
@param rect A rectangle specified in the local coordinate system (bounds) of the receiver.
@param view The view or window that is the target of the conversion operation. If view is nil, this method instead converts to window base coordinates.
@return The converted rectangle.
*/
- (CGRect)convertRect:(CGRect)rect toViewOrWindow:(nullable UIView *)view;
/**
Converts a rectangle from the coordinate system of another view or window to that of the receiver.
@param rect A rectangle specified in the local coordinate system (bounds) of view.
@param view The view or window with rect in its coordinate system.
If view is nil, this method instead converts from window base coordinates.
@return The converted rectangle.
*/
- (CGRect)convertRect:(CGRect)rect fromViewOrWindow:(nullable UIView *)view;
/**
* Objc
*
* @param viewControllerCls Obj的类名,nil时默认返回当前控制器
*
* @return viewController Or needCls
*/
- (nonnull id)viewControllerWithNeedViewOrViewController:(nullable Class)viewControllerCls
;
/// 移除所有子视图中 tableview、scrollview 的 delegate、datasource
- (void)clearScrollViewDelegate;
- (void)removeAllGestures;
- (void)removeAllGesturesWithSubViews;
/// 在 block 内禁用动画
+ (void)disableAnimationWithBlock:(nullable void (^)(void))block;
@end
@@ -0,0 +1,464 @@
//
// UIView+Add.m
//
//
// Created by guoyaoyuan on 13-4-3.
// Copyright (c) 2013 live Interactive. All rights reserved.
//
#import "UIView+YYAdd.h"
#import <QuartzCore/QuartzCore.h>
@implementation UIView (YYAdd)
- (UIImage *)snapshotImage {
UIImage *image = nil;
if ([self respondsToSelector:@selector(drawViewHierarchyInRect:afterScreenUpdates:)]) {
UIGraphicsBeginImageContextWithOptions(self.bounds.size, YES, 0);
[self drawViewHierarchyInRect:self.bounds afterScreenUpdates:YES];
image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}else{
UIGraphicsBeginImageContextWithOptions(self.bounds.size, self.opaque, 0);
[self.layer renderInContext:UIGraphicsGetCurrentContext()];
image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
return image;
}
- (NSData *)snapshotPDF {
CGRect bounds = self.bounds;
NSMutableData* data = [NSMutableData data];
CGDataConsumerRef consumer = CGDataConsumerCreateWithCFData((__bridge CFMutableDataRef)data);
CGContextRef context = CGPDFContextCreate(consumer, &bounds, NULL);
CGDataConsumerRelease(consumer);
if (!context) return nil;
CGPDFContextBeginPage(context, NULL);
CGContextTranslateCTM(context, 0, bounds.size.height);
CGContextScaleCTM(context, 1.0, -1.0);
[self.layer renderInContext:context];
CGPDFContextEndPage(context);
CGPDFContextClose(context);
CGContextRelease(context);
return data;
}
- (void)setLayerShadow:(UIColor*)color offset:(CGSize)offset radius:(CGFloat)radius {
self.layer.shadowColor = color.CGColor;
self.layer.shadowOffset = offset;
self.layer.shadowRadius = radius;
self.layer.shadowOpacity = 1;
self.layer.shouldRasterize = YES;
self.layer.rasterizationScale = [UIScreen mainScreen].scale;
}
#define kShadowViewTag 2132
#define kValidDirections [NSArray arrayWithObjects: @"top", @"bottom", @"left", @"right",nil]
- (void) makeInsetShadow
{
NSArray *shadowDirections = [NSArray arrayWithObjects:@"top", @"bottom", @"left" , @"right" , nil];
UIColor *color = [UIColor colorWithRed:(0.0) green:(0.0) blue:(0.0) alpha:0.5];
UIView *shadowView = [self createShadowViewWithRadius:3 Color:color Directions:shadowDirections];
shadowView.tag = kShadowViewTag;
[self addSubview:shadowView];
}
- (void) makeInsetShadowWithRadius:(float)radius Alpha:(float)alpha
{
NSArray *shadowDirections = [NSArray arrayWithObjects:@"top", @"bottom", @"left" , @"right" , nil];
UIColor *color = [UIColor colorWithRed:(0.0) green:(0.0) blue:(0.0) alpha:alpha];
UIView *shadowView = [self createShadowViewWithRadius:radius Color:color Directions:shadowDirections];
shadowView.tag = kShadowViewTag;
[self addSubview:shadowView];
}
- (void) makeInsetShadowWithRadius:(float)radius Color:(UIColor *)color Directions:(NSArray *)directions
{
UIView *shadowView = [self createShadowViewWithRadius:radius Color:color Directions:directions];
shadowView.tag = kShadowViewTag;
[self addSubview:shadowView];
}
- (UIView *) createShadowViewWithRadius:(float)radius Color:(UIColor *)color Directions:(NSArray *)directions
{
UIView *shadowView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height)];
shadowView.backgroundColor = [UIColor clearColor];
// Ignore duplicate direction
NSMutableDictionary *directionDict = [[NSMutableDictionary alloc] init];
for (NSString *direction in directions) [directionDict setObject:@"1" forKey:direction];
// for (NSString *direction in directionDict) {
// // Ignore invalid direction
// if ([kValidDirections containsObject:direction])
// {
// CAGradientLayer *shadow = [CAGradientLayer layer];
// shadow.locations = @[@(0.0),@(0.5)];
//
// if ([direction isEqualToString:@"top"]) {
// [shadow setStartPoint:CGPointMake(0.5, 0.0)];
// [shadow setEndPoint:CGPointMake(0.5, 1.0)];
// shadow.frame = CGRectMake(-radius, -radius, self.bounds.size.width + radius*2, radius);
// shadow.colors = [NSArray arrayWithObjects:(id)[self.backgroundColor CGColor], (id)[color CGColor], nil];
// }
// else if ([direction isEqualToString:@"bottom"])
// {
// [shadow setStartPoint:CGPointMake(0.5, 1.0)];
// [shadow setEndPoint:CGPointMake(0.5, 0.0)];
// shadow.frame = CGRectMake(-radius, self.bounds.size.height, self.bounds.size.width + radius*2, radius);
// shadow.colors = [NSArray arrayWithObjects:(id)[self.backgroundColor CGColor] ,(id)[color CGColor], nil];
// } else if ([direction isEqualToString:@"left"])
// {
// shadow.frame = CGRectMake(-radius, -radius, radius, self.bounds.size.height + radius*2);
// [shadow setStartPoint:CGPointMake(0.0, 0.5)];
// [shadow setEndPoint:CGPointMake(1.0, 0.5)];
// shadow.colors = [NSArray arrayWithObjects:(id)[self.backgroundColor CGColor],(id)[color CGColor], nil];
//
// } else if ([direction isEqualToString:@"right"])
// {
// shadow.frame = CGRectMake(self.bounds.size.width, -radius, radius, self.bounds.size.height + radius*2);
// [shadow setStartPoint:CGPointMake(1.0, 0.5)];
// [shadow setEndPoint:CGPointMake(0.0, 0.5)];
// shadow.colors = [NSArray arrayWithObjects:(id)[self.backgroundColor CGColor],(id)[color CGColor], nil];
// }
// //
//
// [shadowView.layer insertSublayer:shadow atIndex:0];
// }
// }
for (NSString *direction in directionDict) {
// Ignore invalid direction
if ([kValidDirections containsObject:direction])
{
CALayer *shadow = [CAGradientLayer layer];
shadow.backgroundColor = color.CGColor;
if ([direction isEqualToString:@"top"]) {
shadow.frame = CGRectMake(0, 0, self.bounds.size.width, radius);
}
else if ([direction isEqualToString:@"bottom"])
{
shadow.frame = CGRectMake(0, self.bounds.size.height, self.bounds.size.width, radius);
} else if ([direction isEqualToString:@"left"])
{
shadow.frame = CGRectMake(0, 0, radius, self.bounds.size.height );
} else if ([direction isEqualToString:@"right"])
{
shadow.frame = CGRectMake(self.bounds.size.width, 0, radius, self.bounds.size.height);
}
[shadowView.layer insertSublayer:shadow atIndex:0];
}
}
return shadowView;
}
- (void)removeAllSubviews {
while (self.subviews.count) {
[self.subviews.lastObject removeFromSuperview];
}
}
- (UIViewController *)viewController {
for (UIView *view = self; view; view = view.superview) {
UIResponder *nextResponder = [view nextResponder];
if ([nextResponder isKindOfClass:[UIViewController class]]) {
return (UIViewController *)nextResponder;
}
}
return nil;
}
- (nonnull id)viewControllerWithNeedViewOrViewController:(nullable Class)viewControllerCls
{
UIViewController *result = nil;
UIWindow * window = [[UIApplication sharedApplication] keyWindow];
if (window.windowLevel != UIWindowLevelNormal)
{
NSArray *windows = [[UIApplication sharedApplication] windows];
for(UIWindow * tmpWin in windows)
{
if (tmpWin.windowLevel == UIWindowLevelNormal)
{
window = tmpWin;
break;
}
}
}
UIView *frontView = self;
id nextResponse = [frontView nextResponder];
Class cls = viewControllerCls?viewControllerCls:UIViewController.class;
while (nextResponse) {
if ([nextResponse isKindOfClass:cls]) {
result = nextResponse;
break;
}
nextResponse = [nextResponse nextResponder];
}
if(!result) result = window.rootViewController;
return result;
}
- (CGFloat)left {
return self.frame.origin.x;
}
- (void)setLeft:(CGFloat)x {
CGRect frame = self.frame;
frame.origin.x = x;
self.frame = frame;
}
- (CGFloat)top {
return self.frame.origin.y;
}
- (void)setTop:(CGFloat)y {
CGRect frame = self.frame;
frame.origin.y = y;
self.frame = frame;
}
- (CGFloat)right {
return self.frame.origin.x + self.frame.size.width;
}
- (void)setRight:(CGFloat)right {
CGRect frame = self.frame;
frame.origin.x = right - frame.size.width;
self.frame = frame;
}
- (CGFloat)bottom {
return self.frame.origin.y + self.frame.size.height;
}
- (void)setBottom:(CGFloat)bottom {
CGRect frame = self.frame;
frame.origin.y = bottom - frame.size.height;
self.frame = frame;
}
- (CGFloat)width {
return self.frame.size.width;
}
- (void)setWidth:(CGFloat)width {
CGRect frame = self.frame;
frame.size.width = width;
self.frame = frame;
}
- (CGFloat)height {
return self.frame.size.height;
}
- (void)setHeight:(CGFloat)height {
CGRect frame = self.frame;
frame.size.height = height;
self.frame = frame;
}
- (CGFloat)centerX {
return self.center.x;
}
- (void)setCenterX:(CGFloat)centerX {
self.center = CGPointMake(centerX, self.center.y);
}
- (CGFloat)centerY {
return self.center.y;
}
- (void)setCenterY:(CGFloat)centerY {
self.center = CGPointMake(self.center.x, centerY);
}
- (CGPoint)origin {
return self.frame.origin;
}
- (void)setOrigin:(CGPoint)origin {
CGRect frame = self.frame;
frame.origin = origin;
self.frame = frame;
}
- (CGSize)size {
return self.frame.size;
}
- (void)setSize:(CGSize)size {
CGRect frame = self.frame;
frame.size = size;
self.frame = frame;
}
- (CGRect)screenFrame {
CGPoint origin = CGPointZero;
for (UIView *view = self; view; view = view.superview) {
origin.x += view.left;
origin.y += view.top;
if ([view isKindOfClass:[UIScrollView class]]) {
UIScrollView *scrollView = (UIScrollView *)view;
origin.x -= scrollView.contentOffset.x;
origin.y -= scrollView.contentOffset.y;
}
}
return CGRectMake(origin.x, origin.y, self.width, self.height);
}
- (CGFloat)visibleAlpha {
if ([self isKindOfClass:[UIWindow class]]) {
if (self.hidden) return 0;
return self.alpha;
}
if (!self.window) return 0;
CGFloat alpha = 1;
UIView *v = self;
while (v) {
if (v.hidden) {
alpha = 0;
break;
}
alpha *= v.alpha;
v = v.superview;
}
return alpha;
}
- (CGPoint)convertPoint:(CGPoint)point toViewOrWindow:(UIView *)view {
if (!view) {
if ([self isKindOfClass:[UIWindow class]]) {
return [((UIWindow *)self) convertPoint:point toWindow:nil];
} else {
return [self convertPoint:point toView:nil];
}
}
UIWindow *from = [self isKindOfClass:[UIWindow class]] ? (id)self : self.window;
UIWindow *to = [view isKindOfClass:[UIWindow class]] ? (id)view : view.window;
if ((!from || !to) || (from == to)) return [self convertPoint:point toView:view];
point = [self convertPoint:point toView:from];
point = [to convertPoint:point fromWindow:from];
point = [view convertPoint:point fromView:to];
return point;
}
- (CGPoint)convertPoint:(CGPoint)point fromViewOrWindow:(UIView *)view {
if (!view) {
if ([self isKindOfClass:[UIWindow class]]) {
return [((UIWindow *)self) convertPoint:point fromWindow:nil];
} else {
return [self convertPoint:point fromView:nil];
}
}
UIWindow *from = [view isKindOfClass:[UIWindow class]] ? (id)view : view.window;
UIWindow *to = [self isKindOfClass:[UIWindow class]] ? (id)self : self.window;
if ((!from || !to) || (from == to)) return [self convertPoint:point fromView:view];
point = [from convertPoint:point fromView:view];
point = [to convertPoint:point fromWindow:from];
point = [self convertPoint:point fromView:to];
return point;
}
- (CGRect)convertRect:(CGRect)rect toViewOrWindow:(UIView *)view {
if (!view) {
if ([self isKindOfClass:[UIWindow class]]) {
return [((UIWindow *)self) convertRect:rect toWindow:nil];
} else {
return [self convertRect:rect toView:nil];
}
}
UIWindow *from = [self isKindOfClass:[UIWindow class]] ? (id)self : self.window;
UIWindow *to = [view isKindOfClass:[UIWindow class]] ? (id)view : view.window;
if (!from || !to) return [self convertRect:rect toView:view];
if (from == to) return [self convertRect:rect toView:view];
rect = [self convertRect:rect toView:from];
rect = [to convertRect:rect fromWindow:from];
rect = [view convertRect:rect fromView:to];
return rect;
}
- (CGRect)convertRect:(CGRect)rect fromViewOrWindow:(UIView *)view {
if (!view) {
if ([self isKindOfClass:[UIWindow class]]) {
return [((UIWindow *)self) convertRect:rect fromWindow:nil];
} else {
return [self convertRect:rect fromView:nil];
}
}
UIWindow *from = [view isKindOfClass:[UIWindow class]] ? (id)view : view.window;
UIWindow *to = [self isKindOfClass:[UIWindow class]] ? (id)self : self.window;
if ((!from || !to) || (from == to)) return [self convertRect:rect fromView:view];
rect = [from convertRect:rect fromView:view];
rect = [to convertRect:rect fromWindow:from];
rect = [self convertRect:rect fromView:to];
return rect;
}
- (void)clearScrollViewDelegate {
if ([self isKindOfClass:[UIScrollView class]]) {
((UIScrollView *)self).delegate = nil;
if ([self isKindOfClass:[UITableView class]]) {
((UITableView *)self).delegate = nil;
}
}
for (UIView *sub in self.subviews) {
[sub clearScrollViewDelegate];
}
}
- (void)removeAllGestures {
NSArray *gs = [self.gestureRecognizers copy];
for (UIGestureRecognizer *g in gs) {
[self removeGestureRecognizer:g];
}
}
- (void)removeAllGesturesWithSubViews {
[self removeAllGestures];
for (UIView *v in self.subviews) {
[v removeAllGesturesWithSubViews];
}
[UIView animateWithDuration:0 animations:^{
}];
}
+ (void)disableAnimationWithBlock:(void (^)(void))block {
if (!block) return;
BOOL aniEnabled = [CATransaction disableActions];
[CATransaction setDisableActions:YES];
block();
[CATransaction setDisableActions:aniEnabled];
}
@end

Some files were not shown because too many files have changed in this diff Show More