Commit cf9d068670867445cdd403fe6109093a7e969e95
Merge branch 'master' of bj.gitlab.cnlive.com:ios-team/LiveVideoCloud
Showing
7 changed files
with
430 additions
and
53 deletions
LiveVideoCloud/LiveVideoCloud.xcodeproj/project.pbxproj
| @@ -22,7 +22,6 @@ | @@ -22,7 +22,6 @@ | ||
| 22 | 810B650A1E77B39D00133E15 /* LVCFullScreenPlayerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 810B65091E77B39D00133E15 /* LVCFullScreenPlayerController.m */; }; | 22 | 810B650A1E77B39D00133E15 /* LVCFullScreenPlayerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 810B65091E77B39D00133E15 /* LVCFullScreenPlayerController.m */; }; |
| 23 | 8112D4311E7927A5002E00F6 /* LVCPlayerLoadingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8112D4301E7927A5002E00F6 /* LVCPlayerLoadingView.m */; }; | 23 | 8112D4311E7927A5002E00F6 /* LVCPlayerLoadingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8112D4301E7927A5002E00F6 /* LVCPlayerLoadingView.m */; }; |
| 24 | 812E50531E7699DC004F5FCD /* CNLivePlayerSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 812E50501E7699DC004F5FCD /* CNLivePlayerSDK.framework */; }; | 24 | 812E50531E7699DC004F5FCD /* CNLivePlayerSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 812E50501E7699DC004F5FCD /* CNLivePlayerSDK.framework */; }; |
| 25 | - 812E50541E7699DC004F5FCD /* KSYGPUResource.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 812E50511E7699DC004F5FCD /* KSYGPUResource.bundle */; }; | ||
| 26 | 812E50551E7699E9004F5FCD /* CNLiveMsgTools.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 812E504F1E7699DC004F5FCD /* CNLiveMsgTools.framework */; }; | 25 | 812E50551E7699E9004F5FCD /* CNLiveMsgTools.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 812E504F1E7699DC004F5FCD /* CNLiveMsgTools.framework */; }; |
| 27 | 812E50561E7699E9004F5FCD /* CNLiveMsgTools.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 812E504F1E7699DC004F5FCD /* CNLiveMsgTools.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; | 26 | 812E50561E7699E9004F5FCD /* CNLiveMsgTools.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 812E504F1E7699DC004F5FCD /* CNLiveMsgTools.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; |
| 28 | 812E50581E7699E9004F5FCD /* CNLivePlayerSDK.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 812E50501E7699DC004F5FCD /* CNLivePlayerSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; | 27 | 812E50581E7699E9004F5FCD /* CNLivePlayerSDK.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 812E50501E7699DC004F5FCD /* CNLivePlayerSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; |
| @@ -146,6 +145,9 @@ | @@ -146,6 +145,9 @@ | ||
| 146 | D2575C7E1E76A4F300E3A8FC /* NHPlaneViews.m in Sources */ = {isa = PBXBuildFile; fileRef = D2575C771E76A4F300E3A8FC /* NHPlaneViews.m */; }; | 145 | D2575C7E1E76A4F300E3A8FC /* NHPlaneViews.m in Sources */ = {isa = PBXBuildFile; fileRef = D2575C771E76A4F300E3A8FC /* NHPlaneViews.m */; }; |
| 147 | D2575C7F1E76A4F300E3A8FC /* NHPlaneViews.xib in Resources */ = {isa = PBXBuildFile; fileRef = D2575C781E76A4F300E3A8FC /* NHPlaneViews.xib */; }; | 146 | D2575C7F1E76A4F300E3A8FC /* NHPlaneViews.xib in Resources */ = {isa = PBXBuildFile; fileRef = D2575C781E76A4F300E3A8FC /* NHPlaneViews.xib */; }; |
| 148 | D2575C801E76A4F300E3A8FC /* resource.bundle in Resources */ = {isa = PBXBuildFile; fileRef = D2575C791E76A4F300E3A8FC /* resource.bundle */; }; | 147 | D2575C801E76A4F300E3A8FC /* resource.bundle in Resources */ = {isa = PBXBuildFile; fileRef = D2575C791E76A4F300E3A8FC /* resource.bundle */; }; |
| 148 | + D25BF87A1E7B8A82007FB138 /* FilterFunctionView.m in Sources */ = {isa = PBXBuildFile; fileRef = D25BF8771E7B8A82007FB138 /* FilterFunctionView.m */; }; | ||
| 149 | + D25BF87B1E7B8A82007FB138 /* SliderView.m in Sources */ = {isa = PBXBuildFile; fileRef = D25BF8791E7B8A82007FB138 /* SliderView.m */; }; | ||
| 150 | + D25BF87D1E7B8C78007FB138 /* KSYGPUResource.bundle in Resources */ = {isa = PBXBuildFile; fileRef = D25BF87C1E7B8C78007FB138 /* KSYGPUResource.bundle */; }; | ||
| 149 | D2888D941E6EB8B4003A77C8 /* LVCTabBar.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888D931E6EB8B4003A77C8 /* LVCTabBar.m */; }; | 151 | D2888D941E6EB8B4003A77C8 /* LVCTabBar.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888D931E6EB8B4003A77C8 /* LVCTabBar.m */; }; |
| 150 | D2888D9E1E6EBF1B003A77C8 /* LVCLiveViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888D9B1E6EBF1B003A77C8 /* LVCLiveViewController.m */; }; | 152 | D2888D9E1E6EBF1B003A77C8 /* LVCLiveViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888D9B1E6EBF1B003A77C8 /* LVCLiveViewController.m */; }; |
| 151 | D2888DB11E6EC05F003A77C8 /* TempViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888DB01E6EC05F003A77C8 /* TempViewController.m */; }; | 153 | D2888DB11E6EC05F003A77C8 /* TempViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888DB01E6EC05F003A77C8 /* TempViewController.m */; }; |
| @@ -477,6 +479,11 @@ | @@ -477,6 +479,11 @@ | ||
| 477 | D2575C771E76A4F300E3A8FC /* NHPlaneViews.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NHPlaneViews.m; sourceTree = "<group>"; }; | 479 | D2575C771E76A4F300E3A8FC /* NHPlaneViews.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NHPlaneViews.m; sourceTree = "<group>"; }; |
| 478 | D2575C781E76A4F300E3A8FC /* NHPlaneViews.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NHPlaneViews.xib; sourceTree = "<group>"; }; | 480 | D2575C781E76A4F300E3A8FC /* NHPlaneViews.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NHPlaneViews.xib; sourceTree = "<group>"; }; |
| 479 | D2575C791E76A4F300E3A8FC /* resource.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = resource.bundle; sourceTree = "<group>"; }; | 481 | D2575C791E76A4F300E3A8FC /* resource.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = resource.bundle; sourceTree = "<group>"; }; |
| 482 | + D25BF8761E7B8A82007FB138 /* FilterFunctionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FilterFunctionView.h; sourceTree = "<group>"; }; | ||
| 483 | + D25BF8771E7B8A82007FB138 /* FilterFunctionView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FilterFunctionView.m; sourceTree = "<group>"; }; | ||
| 484 | + D25BF8781E7B8A82007FB138 /* SliderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SliderView.h; sourceTree = "<group>"; }; | ||
| 485 | + D25BF8791E7B8A82007FB138 /* SliderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SliderView.m; sourceTree = "<group>"; }; | ||
| 486 | + D25BF87C1E7B8C78007FB138 /* KSYGPUResource.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = KSYGPUResource.bundle; sourceTree = "<group>"; }; | ||
| 480 | D2888D921E6EB8B4003A77C8 /* LVCTabBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCTabBar.h; sourceTree = "<group>"; }; | 487 | D2888D921E6EB8B4003A77C8 /* LVCTabBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCTabBar.h; sourceTree = "<group>"; }; |
| 481 | D2888D931E6EB8B4003A77C8 /* LVCTabBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCTabBar.m; sourceTree = "<group>"; }; | 488 | D2888D931E6EB8B4003A77C8 /* LVCTabBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCTabBar.m; sourceTree = "<group>"; }; |
| 482 | D2888D9A1E6EBF1B003A77C8 /* LVCLiveViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCLiveViewController.h; sourceTree = "<group>"; }; | 489 | D2888D9A1E6EBF1B003A77C8 /* LVCLiveViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCLiveViewController.h; sourceTree = "<group>"; }; |
| @@ -560,9 +567,9 @@ | @@ -560,9 +567,9 @@ | ||
| 560 | 812E504E1E7699B9004F5FCD /* CNLiveSDK */ = { | 567 | 812E504E1E7699B9004F5FCD /* CNLiveSDK */ = { |
| 561 | isa = PBXGroup; | 568 | isa = PBXGroup; |
| 562 | children = ( | 569 | children = ( |
| 570 | + D25BF87C1E7B8C78007FB138 /* KSYGPUResource.bundle */, | ||
| 563 | 812E504F1E7699DC004F5FCD /* CNLiveMsgTools.framework */, | 571 | 812E504F1E7699DC004F5FCD /* CNLiveMsgTools.framework */, |
| 564 | 812E50501E7699DC004F5FCD /* CNLivePlayerSDK.framework */, | 572 | 812E50501E7699DC004F5FCD /* CNLivePlayerSDK.framework */, |
| 565 | - 812E50511E7699DC004F5FCD /* KSYGPUResource.bundle */, | ||
| 566 | ); | 573 | ); |
| 567 | path = CNLiveSDK; | 574 | path = CNLiveSDK; |
| 568 | sourceTree = "<group>"; | 575 | sourceTree = "<group>"; |
| @@ -1319,6 +1326,24 @@ | @@ -1319,6 +1326,24 @@ | ||
| 1319 | path = GiftResource; | 1326 | path = GiftResource; |
| 1320 | sourceTree = "<group>"; | 1327 | sourceTree = "<group>"; |
| 1321 | }; | 1328 | }; |
| 1329 | + D25BF8741E7B8A59007FB138 /* Model */ = { | ||
| 1330 | + isa = PBXGroup; | ||
| 1331 | + children = ( | ||
| 1332 | + ); | ||
| 1333 | + path = Model; | ||
| 1334 | + sourceTree = "<group>"; | ||
| 1335 | + }; | ||
| 1336 | + D25BF8751E7B8A59007FB138 /* View */ = { | ||
| 1337 | + isa = PBXGroup; | ||
| 1338 | + children = ( | ||
| 1339 | + D25BF8761E7B8A82007FB138 /* FilterFunctionView.h */, | ||
| 1340 | + D25BF8771E7B8A82007FB138 /* FilterFunctionView.m */, | ||
| 1341 | + D25BF8781E7B8A82007FB138 /* SliderView.h */, | ||
| 1342 | + D25BF8791E7B8A82007FB138 /* SliderView.m */, | ||
| 1343 | + ); | ||
| 1344 | + path = View; | ||
| 1345 | + sourceTree = "<group>"; | ||
| 1346 | + }; | ||
| 1322 | D2888D911E6EB897003A77C8 /* View */ = { | 1347 | D2888D911E6EB897003A77C8 /* View */ = { |
| 1323 | isa = PBXGroup; | 1348 | isa = PBXGroup; |
| 1324 | children = ( | 1349 | children = ( |
| @@ -1332,8 +1357,8 @@ | @@ -1332,8 +1357,8 @@ | ||
| 1332 | isa = PBXGroup; | 1357 | isa = PBXGroup; |
| 1333 | children = ( | 1358 | children = ( |
| 1334 | D2888D991E6EBF1B003A77C8 /* Controller */, | 1359 | D2888D991E6EBF1B003A77C8 /* Controller */, |
| 1335 | - D2888D9C1E6EBF1B003A77C8 /* Model */, | ||
| 1336 | - D2888D9D1E6EBF1B003A77C8 /* View */, | 1360 | + D25BF8741E7B8A59007FB138 /* Model */, |
| 1361 | + D25BF8751E7B8A59007FB138 /* View */, | ||
| 1337 | ); | 1362 | ); |
| 1338 | path = LiveSections; | 1363 | path = LiveSections; |
| 1339 | sourceTree = "<group>"; | 1364 | sourceTree = "<group>"; |
| @@ -1347,20 +1372,6 @@ | @@ -1347,20 +1372,6 @@ | ||
| 1347 | path = Controller; | 1372 | path = Controller; |
| 1348 | sourceTree = "<group>"; | 1373 | sourceTree = "<group>"; |
| 1349 | }; | 1374 | }; |
| 1350 | - D2888D9C1E6EBF1B003A77C8 /* Model */ = { | ||
| 1351 | - isa = PBXGroup; | ||
| 1352 | - children = ( | ||
| 1353 | - ); | ||
| 1354 | - path = Model; | ||
| 1355 | - sourceTree = "<group>"; | ||
| 1356 | - }; | ||
| 1357 | - D2888D9D1E6EBF1B003A77C8 /* View */ = { | ||
| 1358 | - isa = PBXGroup; | ||
| 1359 | - children = ( | ||
| 1360 | - ); | ||
| 1361 | - path = View; | ||
| 1362 | - sourceTree = "<group>"; | ||
| 1363 | - }; | ||
| 1364 | D2888DA71E6EC014003A77C8 /* homeSections */ = { | 1375 | D2888DA71E6EC014003A77C8 /* homeSections */ = { |
| 1365 | isa = PBXGroup; | 1376 | isa = PBXGroup; |
| 1366 | children = ( | 1377 | children = ( |
| @@ -1553,6 +1564,8 @@ | @@ -1553,6 +1564,8 @@ | ||
| 1553 | D2029B911E6EAAA50027CD92 /* animation.xcassets in Resources */, | 1564 | D2029B911E6EAAA50027CD92 /* animation.xcassets in Resources */, |
| 1554 | D2029CB01E6EADE10027CD92 /* MJRefresh.bundle in Resources */, | 1565 | D2029CB01E6EADE10027CD92 /* MJRefresh.bundle in Resources */, |
| 1555 | D2575C7C1E76A4F300E3A8FC /* NHFighterView.nib in Resources */, | 1566 | D2575C7C1E76A4F300E3A8FC /* NHFighterView.nib in Resources */, |
| 1567 | + D25BF87D1E7B8C78007FB138 /* KSYGPUResource.bundle in Resources */, | ||
| 1568 | + D2029B8F1E6EAAA50027CD92 /* Main.storyboard in Resources */, | ||
| 1556 | 812E50541E7699DC004F5FCD /* KSYGPUResource.bundle in Resources */, | 1569 | 812E50541E7699DC004F5FCD /* KSYGPUResource.bundle in Resources */, |
| 1557 | ); | 1570 | ); |
| 1558 | runOnlyForDeploymentPostprocessing = 0; | 1571 | runOnlyForDeploymentPostprocessing = 0; |
| @@ -1669,6 +1682,7 @@ | @@ -1669,6 +1682,7 @@ | ||
| 1669 | D2029D091E6EAE2E0027CD92 /* Foundation+Log.m in Sources */, | 1682 | D2029D091E6EAE2E0027CD92 /* Foundation+Log.m in Sources */, |
| 1670 | D2029C8E1E6EADE10027CD92 /* AFImageDownloader.m in Sources */, | 1683 | D2029C8E1E6EADE10027CD92 /* AFImageDownloader.m in Sources */, |
| 1671 | D2029BCA1E6EADD70027CD92 /* BaseModel.m in Sources */, | 1684 | D2029BCA1E6EADD70027CD92 /* BaseModel.m in Sources */, |
| 1685 | + D25BF87B1E7B8A82007FB138 /* SliderView.m in Sources */, | ||
| 1672 | 810B65041E779B1F00133E15 /* NSArray+MASAdditions.m in Sources */, | 1686 | 810B65041E779B1F00133E15 /* NSArray+MASAdditions.m in Sources */, |
| 1673 | D2029D031E6EAE2E0027CD92 /* UIImage+ZXExtension.m in Sources */, | 1687 | D2029D031E6EAE2E0027CD92 /* UIImage+ZXExtension.m in Sources */, |
| 1674 | D2029D0A1E6EAE2E0027CD92 /* ZXServerUrl.m in Sources */, | 1688 | D2029D0A1E6EAE2E0027CD92 /* ZXServerUrl.m in Sources */, |
| @@ -1684,6 +1698,7 @@ | @@ -1684,6 +1698,7 @@ | ||
| 1684 | D2029BCD1E6EADD70027CD92 /* BaseViewController.m in Sources */, | 1698 | D2029BCD1E6EADD70027CD92 /* BaseViewController.m in Sources */, |
| 1685 | 810B64E01E779AE900133E15 /* LVCPlayer.m in Sources */, | 1699 | 810B64E01E779AE900133E15 /* LVCPlayer.m in Sources */, |
| 1686 | 810B64FF1E779B1F00133E15 /* MASConstraint.m in Sources */, | 1700 | 810B64FF1E779B1F00133E15 /* MASConstraint.m in Sources */, |
| 1701 | + D25BF87A1E7B8A82007FB138 /* FilterFunctionView.m in Sources */, | ||
| 1687 | D2029D001E6EAE2E0027CD92 /* NSNumber+ScaleHeight.m in Sources */, | 1702 | D2029D001E6EAE2E0027CD92 /* NSNumber+ScaleHeight.m in Sources */, |
| 1688 | D2888D9E1E6EBF1B003A77C8 /* LVCLiveViewController.m in Sources */, | 1703 | D2888D9E1E6EBF1B003A77C8 /* LVCLiveViewController.m in Sources */, |
| 1689 | D2029C951E6EADE10027CD92 /* UIWebView+AFNetworking.m in Sources */, | 1704 | D2029C951E6EADE10027CD92 /* UIWebView+AFNetworking.m in Sources */, |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/LiveSections/Controller/LVCLiveViewController.m
| @@ -9,11 +9,12 @@ | @@ -9,11 +9,12 @@ | ||
| 9 | #import "LVCLiveViewController.h" | 9 | #import "LVCLiveViewController.h" |
| 10 | #import <CNLivePlayerSDK/CNLiveGPUStreamerKit.h> | 10 | #import <CNLivePlayerSDK/CNLiveGPUStreamerKit.h> |
| 11 | #import <CNLivePlayerSDK/CNLiveWebcastManager.h> | 11 | #import <CNLivePlayerSDK/CNLiveWebcastManager.h> |
| 12 | +#import "FilterFunctionView.h" | ||
| 12 | 13 | ||
| 13 | #define KAppId @"60_irn9edco29" | 14 | #define KAppId @"60_irn9edco29" |
| 14 | #define KAppKey @"69fe70bda67e059286ad509d9f5377f815955645b52f94" | 15 | #define KAppKey @"69fe70bda67e059286ad509d9f5377f815955645b52f94" |
| 15 | 16 | ||
| 16 | -@interface LVCLiveViewController () { | 17 | +@interface LVCLiveViewController ()<UIGestureRecognizerDelegate> { |
| 17 | // 开始直播 | 18 | // 开始直播 |
| 18 | UIButton *_startLiveBtn; | 19 | UIButton *_startLiveBtn; |
| 19 | // 缩放因子 | 20 | // 缩放因子 |
| @@ -24,6 +25,8 @@ | @@ -24,6 +25,8 @@ | ||
| 24 | 25 | ||
| 25 | @property (nonatomic,strong) CNLiveGPUStreamerKit *kitCN; | 26 | @property (nonatomic,strong) CNLiveGPUStreamerKit *kitCN; |
| 26 | 27 | ||
| 28 | +@property (nonatomic,strong) FilterFunctionView *filterView; | ||
| 29 | + | ||
| 27 | @end | 30 | @end |
| 28 | 31 | ||
| 29 | @implementation LVCLiveViewController | 32 | @implementation LVCLiveViewController |
| @@ -69,7 +72,9 @@ | @@ -69,7 +72,9 @@ | ||
| 69 | // _kitCN.activityName = @"iOS test"; | 72 | // _kitCN.activityName = @"iOS test"; |
| 70 | // _kitCN.coverImgUrl = @"djfiwooa"; | 73 | // _kitCN.coverImgUrl = @"djfiwooa"; |
| 71 | 74 | ||
| 75 | + // 设置推流配置 | ||
| 72 | [self setStreamerCfg]; | 76 | [self setStreamerCfg]; |
| 77 | + // 添加监听 | ||
| 73 | [self addObservers]; | 78 | [self addObservers]; |
| 74 | 79 | ||
| 75 | _startLiveBtn = [self addButton:@"开始直播" frame:CGRectMake(100, 40, 80, 40) action:@selector(startCapture:)]; | 80 | _startLiveBtn = [self addButton:@"开始直播" frame:CGRectMake(100, 40, 80, 40) action:@selector(startCapture:)]; |
| @@ -77,7 +82,7 @@ | @@ -77,7 +82,7 @@ | ||
| 77 | [_startLiveBtn setTitle:@"停止直播" forState:UIControlStateSelected]; | 82 | [_startLiveBtn setTitle:@"停止直播" forState:UIControlStateSelected]; |
| 78 | 83 | ||
| 79 | [self addButton:@"关闭预览" frame:CGRectMake(10, 40, 80, 40) action:@selector(startPreview:)]; | 84 | [self addButton:@"关闭预览" frame:CGRectMake(10, 40, 80, 40) action:@selector(startPreview:)]; |
| 80 | - [self addButton:@"退出" frame:CGRectMake(190, 40, 80, 40) action:@selector(quit)]; | 85 | +// [self addButton:@"退出" frame:CGRectMake(190, 40, 80, 40) action:@selector(quit)]; |
| 81 | [self addButton:@"美颜" frame:CGRectMake(10, 100, 80, 40) action:@selector(openFilter:)]; | 86 | [self addButton:@"美颜" frame:CGRectMake(10, 100, 80, 40) action:@selector(openFilter:)]; |
| 82 | [self addButton:@"摄像头" frame:CGRectMake(100, 100, 80, 40) action:@selector(changeCamera:)]; | 87 | [self addButton:@"摄像头" frame:CGRectMake(100, 100, 80, 40) action:@selector(changeCamera:)]; |
| 83 | [self addButton:@"闪光灯" frame:CGRectMake(190, 100, 80, 40) action:@selector(openFlash)]; | 88 | [self addButton:@"闪光灯" frame:CGRectMake(190, 100, 80, 40) action:@selector(openFlash)]; |
| @@ -120,16 +125,16 @@ | @@ -120,16 +125,16 @@ | ||
| 120 | [_kitCN startPreview:self.captureView]; | 125 | [_kitCN startPreview:self.captureView]; |
| 121 | 126 | ||
| 122 | //水印图片 | 127 | //水印图片 |
| 123 | - _kitCN.watermark.logoPic = [UIImage imageNamed:@"互动电视180x180"]; | ||
| 124 | - _kitCN.watermark.logoRect = CGRectMake(0.8, 0.8, 50, 50); | ||
| 125 | - _kitCN.watermark.logoAlpha = 0.6; | 128 | +// _kitCN.watermark.logoPic = [UIImage imageNamed:@"互动电视180x180"]; |
| 129 | +// _kitCN.watermark.logoRect = CGRectMake(0.8, 0.8, 50, 50); | ||
| 130 | +// _kitCN.watermark.logoAlpha = 0.6; | ||
| 126 | 131 | ||
| 127 | //水印文字 | 132 | //水印文字 |
| 128 | - _kitCN.watermark.textLabel = [[UILabel alloc] init]; | ||
| 129 | - _kitCN.watermark.textLabel.text = [NSString stringWithFormat:@"cnlive"]; | ||
| 130 | - _kitCN.watermark.textLabel.font = [UIFont systemFontOfSize:8]; | ||
| 131 | - _kitCN.watermark.textRect = CGRectMake(0.78, 0.88, 0.2, 0.04); | ||
| 132 | - [_kitCN.watermark updateTextLabel]; | 133 | +// _kitCN.watermark.textLabel = [[UILabel alloc] init]; |
| 134 | +// _kitCN.watermark.textLabel.text = [NSString stringWithFormat:@"cnlive"]; | ||
| 135 | +// _kitCN.watermark.textLabel.font = [UIFont systemFontOfSize:8]; | ||
| 136 | +// _kitCN.watermark.textRect = CGRectMake(0.78, 0.88, 0.2, 0.04); | ||
| 137 | +// [_kitCN.watermark updateTextLabel]; | ||
| 133 | 138 | ||
| 134 | } | 139 | } |
| 135 | 140 | ||
| @@ -156,11 +161,13 @@ | @@ -156,11 +161,13 @@ | ||
| 156 | [_kitCN startStream:^{ | 161 | [_kitCN startStream:^{ |
| 157 | NSLog(@"开启推流成功 ------- success"); | 162 | NSLog(@"开启推流成功 ------- success"); |
| 158 | } failure:^(NSDictionary *errorDic) { | 163 | } failure:^(NSDictionary *errorDic) { |
| 164 | + NSString *str=[[NSMutableString alloc] initWithData:errorDic[@"errorMessage"] encoding:NSUTF8StringEncoding]; | ||
| 165 | + NSLog(@"%@",str); | ||
| 159 | [self toast:errorDic[@"errorMessage"]]; | 166 | [self toast:errorDic[@"errorMessage"]]; |
| 160 | _startLiveBtn.selected = NO; | 167 | _startLiveBtn.selected = NO; |
| 161 | }]; | 168 | }]; |
| 162 | }else{ | 169 | }else{ |
| 163 | -// _stateLab.text = nil; | 170 | + |
| 164 | [_kitCN stopStream]; | 171 | [_kitCN stopStream]; |
| 165 | } | 172 | } |
| 166 | } | 173 | } |
| @@ -184,6 +191,59 @@ | @@ -184,6 +191,59 @@ | ||
| 184 | } | 191 | } |
| 185 | } | 192 | } |
| 186 | 193 | ||
| 194 | +// 美颜滤镜 | ||
| 195 | +- (void)openFilter:(UIButton *)button { | ||
| 196 | + | ||
| 197 | + button.selected = !button.selected; | ||
| 198 | + | ||
| 199 | + if (button.selected) { | ||
| 200 | + | ||
| 201 | + _filterView.hidden = NO; | ||
| 202 | + | ||
| 203 | + __weak LVCLiveViewController *weakselff = self; | ||
| 204 | + | ||
| 205 | + _filterView.filterViewBlock = ^(float grindRatio , float whitenRatio, float intensity){ | ||
| 206 | + | ||
| 207 | + [weakselff.kitCN.beautifyFaceFilter filterAdjustingParameterWithGrindRatio:grindRatio | ||
| 208 | + whitenRatio:whitenRatio | ||
| 209 | + intensity:intensity]; | ||
| 210 | + }; | ||
| 211 | + | ||
| 212 | + _filterView.currentTypeBlock = ^(NSInteger currentType){ | ||
| 213 | + [weakselff.kitCN.beautifyFaceFilter setBeautyType:currentType]; | ||
| 214 | + }; | ||
| 215 | + | ||
| 216 | + _filterView.currentIdxBlock = ^(NSInteger currentIdx){ | ||
| 217 | + weakselff.kitCN.beautifyFaceFilter.curEffectIdx = currentIdx; | ||
| 218 | + }; | ||
| 219 | + | ||
| 220 | + } else { | ||
| 221 | + | ||
| 222 | + _filterView.hidden = YES; | ||
| 223 | + | ||
| 224 | + } | ||
| 225 | +} | ||
| 226 | + | ||
| 227 | +// 转换前后置摄像头 | ||
| 228 | +- (void)changeCamera:(UIButton *)button { | ||
| 229 | + | ||
| 230 | +// button.selected = !button.selected; | ||
| 231 | +// if (button.selected) { | ||
| 232 | +// _kitCN.cameraPosition = AVCaptureDevicePositionBack; | ||
| 233 | +// }else{ | ||
| 234 | +// _kitCN.cameraPosition = AVCaptureDevicePositionFront; | ||
| 235 | +// } | ||
| 236 | + [_kitCN switchCamera]; | ||
| 237 | + | ||
| 238 | +} | ||
| 239 | + | ||
| 240 | +// 闪光灯 | ||
| 241 | +- (void)openFlash { | ||
| 242 | + | ||
| 243 | + [_kitCN toggleTorch]; | ||
| 244 | + // [_kitCN setTorchMode:AVCaptureTorchModeOn]; | ||
| 245 | +} | ||
| 246 | + | ||
| 187 | // 退出 | 247 | // 退出 |
| 188 | - (void)closeBtnClivk { | 248 | - (void)closeBtnClivk { |
| 189 | 249 | ||
| @@ -200,8 +260,8 @@ | @@ -200,8 +260,8 @@ | ||
| 200 | 260 | ||
| 201 | #pragma mark - UIGestureRecognizer Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 261 | #pragma mark - UIGestureRecognizer Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 202 | //对焦与曝光 | 262 | //对焦与曝光 |
| 203 | -- (void)onTap:(UIGestureRecognizer *)sender | ||
| 204 | -{ | 263 | +- (void)onTap:(UIGestureRecognizer *)sender { |
| 264 | + | ||
| 205 | CGPoint current = [sender locationInView:self.view]; | 265 | CGPoint current = [sender locationInView:self.view]; |
| 206 | CGPoint point = [self convertToPointOfInterestFromViewCoordinates:current]; | 266 | CGPoint point = [self convertToPointOfInterestFromViewCoordinates:current]; |
| 207 | [_kitCN exposureAtPoint:point]; | 267 | [_kitCN exposureAtPoint:point]; |
| @@ -209,7 +269,8 @@ | @@ -209,7 +269,8 @@ | ||
| 209 | } | 269 | } |
| 210 | 270 | ||
| 211 | //缩放 | 271 | //缩放 |
| 212 | -- (void)pinchDetected:(UIPinchGestureRecognizer *)recognizer{ | 272 | +- (void)pinchDetected:(UIPinchGestureRecognizer *)recognizer { |
| 273 | + | ||
| 213 | if (recognizer.state == UIGestureRecognizerStateBegan) { | 274 | if (recognizer.state == UIGestureRecognizerStateBegan) { |
| 214 | _currentPinchZoomFactor = _kitCN.pinchZoomFactor; | 275 | _currentPinchZoomFactor = _kitCN.pinchZoomFactor; |
| 215 | } | 276 | } |
| @@ -228,45 +289,39 @@ | @@ -228,45 +289,39 @@ | ||
| 228 | 289 | ||
| 229 | [_kitCN appBecomeActive]; | 290 | [_kitCN appBecomeActive]; |
| 230 | } | 291 | } |
| 231 | -// 拍摄状态改变 | 292 | +// 采集状态改变 |
| 232 | - (void)captureStateChange { | 293 | - (void)captureStateChange { |
| 233 | 294 | ||
| 234 | if ( _kitCN.captureState == CNLiveCaptureStateIdle){ | 295 | if ( _kitCN.captureState == CNLiveCaptureStateIdle){ |
| 235 | //初始化时状态为空闲 | 296 | //初始化时状态为空闲 |
| 236 | -// _stateLab.text = @"CNLiveCaptureStateIdle"; | ||
| 237 | 297 | ||
| 238 | return; | 298 | return; |
| 239 | } | 299 | } |
| 240 | else if (_kitCN.captureState == CNLiveCaptureStateCapturing ) { | 300 | else if (_kitCN.captureState == CNLiveCaptureStateCapturing ) { |
| 241 | //设备工作中 | 301 | //设备工作中 |
| 242 | -// _stateLab.text = @"CNLiveCaptureStateCapturing"; | ||
| 243 | 302 | ||
| 244 | return; | 303 | return; |
| 245 | } | 304 | } |
| 246 | else if (_kitCN.captureState == CNLiveCaptureStateClosingCapture ) { | 305 | else if (_kitCN.captureState == CNLiveCaptureStateClosingCapture ) { |
| 247 | //关闭采集设备中 | 306 | //关闭采集设备中 |
| 248 | -// _stateLab.text = @"CNLiveCaptureStateClosingCapture"; | ||
| 249 | 307 | ||
| 250 | return; | 308 | return; |
| 251 | } | 309 | } |
| 252 | else if (_kitCN.captureState == CNLiveCaptureStateDevAuthDenied ) { | 310 | else if (_kitCN.captureState == CNLiveCaptureStateDevAuthDenied ) { |
| 253 | //设备授权被拒绝 | 311 | //设备授权被拒绝 |
| 254 | NSLog(@"---------CNLiveCaptureStateDevAuthDenied"); | 312 | NSLog(@"---------CNLiveCaptureStateDevAuthDenied"); |
| 255 | -// _stateLab.text = @"camera/mic Authorization Denied"; | ||
| 256 | 313 | ||
| 257 | return; | 314 | return; |
| 258 | } | 315 | } |
| 259 | else if (_kitCN.captureState == CNLiveCaptureStateParameterError ) { | 316 | else if (_kitCN.captureState == CNLiveCaptureStateParameterError ) { |
| 260 | // 参数错误,无法打开 | 317 | // 参数错误,无法打开 |
| 261 | NSLog(@"---------CNLiveCaptureStateParameterError"); | 318 | NSLog(@"---------CNLiveCaptureStateParameterError"); |
| 262 | -// _stateLab.text = @"capture devices ParameterError"; | ||
| 263 | 319 | ||
| 264 | return; | 320 | return; |
| 265 | } | 321 | } |
| 266 | else if (_kitCN.captureState == CNLiveCaptureStateDevBusy ) { | 322 | else if (_kitCN.captureState == CNLiveCaptureStateDevBusy ) { |
| 267 | //设备正忙,请稍后尝试 | 323 | //设备正忙,请稍后尝试 |
| 268 | NSLog(@"---------CNLiveCaptureStateDevBusy"); | 324 | NSLog(@"---------CNLiveCaptureStateDevBusy"); |
| 269 | -// _stateLab.text = @"device busy, try later"; | ||
| 270 | 325 | ||
| 271 | } | 326 | } |
| 272 | } | 327 | } |
| @@ -276,19 +331,16 @@ | @@ -276,19 +331,16 @@ | ||
| 276 | if (_kitCN.streamState == CNLiveStreamStateIdle) { | 331 | if (_kitCN.streamState == CNLiveStreamStateIdle) { |
| 277 | 332 | ||
| 278 | NSLog(@"---------CNLiveStreamStateIdle"); | 333 | NSLog(@"---------CNLiveStreamStateIdle"); |
| 279 | -// _stateLab.text = @"CNLiveStreamStateIdle"; | ||
| 280 | } | 334 | } |
| 281 | 335 | ||
| 282 | if (_kitCN.streamState == CNLiveStreamStateConnected) { | 336 | if (_kitCN.streamState == CNLiveStreamStateConnected) { |
| 283 | 337 | ||
| 284 | NSLog(@"---------CNLiveStreamStateConnected"); | 338 | NSLog(@"---------CNLiveStreamStateConnected"); |
| 285 | -// _stateLab.text = [NSString stringWithFormat:@"CNLiveStreamStateConnected------%@",_hostURL]; | ||
| 286 | } | 339 | } |
| 287 | 340 | ||
| 288 | if (_kitCN.streamState == CNLiveStreamStateConnecting) { | 341 | if (_kitCN.streamState == CNLiveStreamStateConnecting) { |
| 289 | 342 | ||
| 290 | NSLog(@"---------CNLiveStreamStateConnecting"); | 343 | NSLog(@"---------CNLiveStreamStateConnecting"); |
| 291 | -// _stateLab.text = @"CNLiveStreamStateConnecting"; | ||
| 292 | } | 344 | } |
| 293 | 345 | ||
| 294 | //推流出错 | 346 | //推流出错 |
| @@ -302,14 +354,12 @@ | @@ -302,14 +354,12 @@ | ||
| 302 | if ( _kitCN.streamState == CNLiveStreamStateDisconnecting) { | 354 | if ( _kitCN.streamState == CNLiveStreamStateDisconnecting) { |
| 303 | 355 | ||
| 304 | NSLog(@"---------CNLiveStreamStateDisconnecting"); | 356 | NSLog(@"---------CNLiveStreamStateDisconnecting"); |
| 305 | -// _stateLab.text = @"CNLiveStreamStateDisconnecting"; | ||
| 306 | } | 357 | } |
| 307 | 358 | ||
| 308 | //结束推流成功 | 359 | //结束推流成功 |
| 309 | if ( _kitCN.streamState == CNLiveStopStreamSuccess) { | 360 | if ( _kitCN.streamState == CNLiveStopStreamSuccess) { |
| 310 | 361 | ||
| 311 | NSLog(@"---------CNLiveStopStreamSuccess"); | 362 | NSLog(@"---------CNLiveStopStreamSuccess"); |
| 312 | -// _stateLab.text = @"CNLiveStopStreamSuccess"; | ||
| 313 | } | 363 | } |
| 314 | } | 364 | } |
| 315 | // 推流失败 | 365 | // 推流失败 |
| @@ -320,19 +370,19 @@ | @@ -320,19 +370,19 @@ | ||
| 320 | NSLog(@"onErr: %lu ", (unsigned long) err); | 370 | NSLog(@"onErr: %lu ", (unsigned long) err); |
| 321 | 371 | ||
| 322 | if ( CNLiveStreamErrorCode_CNLiveAUTHFAILED == err ) { | 372 | if ( CNLiveStreamErrorCode_CNLiveAUTHFAILED == err ) { |
| 323 | -// _stateLab.text = @"SDK auth failed, \npls check ak/sk"; | 373 | + |
| 324 | } | 374 | } |
| 325 | else if ( CNLiveStreamErrorCode_CODEC_OPEN_FAILED == err) { | 375 | else if ( CNLiveStreamErrorCode_CODEC_OPEN_FAILED == err) { |
| 326 | -// _stateLab.text = @"Selected Codec not supported \n in this version"; | 376 | + |
| 327 | } | 377 | } |
| 328 | else if ( CNLiveStreamErrorCode_CONNECT_FAILED == err) { | 378 | else if ( CNLiveStreamErrorCode_CONNECT_FAILED == err) { |
| 329 | -// _stateLab.text = @"Connecting error, pls check host url \nor network"; | 379 | + |
| 330 | } | 380 | } |
| 331 | else if ( CNLiveStreamErrorCode_CONNECT_BREAK == err) { | 381 | else if ( CNLiveStreamErrorCode_CONNECT_BREAK == err) { |
| 332 | -// _stateLab.text = @"Connection break"; | 382 | + |
| 333 | } | 383 | } |
| 334 | else if ( CNLiveStreamErrorCode_ABNORMAL == err) { | 384 | else if ( CNLiveStreamErrorCode_ABNORMAL == err) { |
| 335 | -// _stateLab.text = @"CNLiveStreamErrorCode_ABNORMAL"; | 385 | + |
| 336 | [self toast:@"推流异常中断~~"]; | 386 | [self toast:@"推流异常中断~~"]; |
| 337 | _startLiveBtn.selected = NO; | 387 | _startLiveBtn.selected = NO; |
| 338 | 388 | ||
| @@ -376,8 +426,7 @@ | @@ -376,8 +426,7 @@ | ||
| 376 | } | 426 | } |
| 377 | 427 | ||
| 378 | // 提示框 | 428 | // 提示框 |
| 379 | -- (void)toast:(NSString*)message | ||
| 380 | -{ | 429 | +- (void)toast:(NSString*)message { |
| 381 | 430 | ||
| 382 | UIAlertView *toast = [[UIAlertView alloc] initWithTitle:nil | 431 | UIAlertView *toast = [[UIAlertView alloc] initWithTitle:nil |
| 383 | message:message | 432 | message:message |
| @@ -393,8 +442,8 @@ | @@ -393,8 +442,8 @@ | ||
| 393 | 442 | ||
| 394 | 443 | ||
| 395 | // 将UI的坐标转换成相机坐标 | 444 | // 将UI的坐标转换成相机坐标 |
| 396 | -- (CGPoint)convertToPointOfInterestFromViewCoordinates:(CGPoint)viewCoordinates | ||
| 397 | -{ | 445 | +- (CGPoint)convertToPointOfInterestFromViewCoordinates:(CGPoint)viewCoordinates { |
| 446 | + | ||
| 398 | CGPoint pointOfInterest = CGPointMake(.5f, .5f); | 447 | CGPoint pointOfInterest = CGPointMake(.5f, .5f); |
| 399 | CGSize frameSize = self.view.frame.size; | 448 | CGSize frameSize = self.view.frame.size; |
| 400 | CGSize apertureSize = [_kitCN captureDimension]; | 449 | CGSize apertureSize = [_kitCN captureDimension]; |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/LiveSections/View/FilterFunctionView.h
0 → 100755
| 1 | +// | ||
| 2 | +// FilterFunctionView.h | ||
| 3 | +// CNLivePlayerSDKDemo | ||
| 4 | +// | ||
| 5 | +// Created by iOS on 16/12/21. | ||
| 6 | +// Copyright © 2016年 雷浩杰. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <UIKit/UIKit.h> | ||
| 10 | + | ||
| 11 | +typedef void(^FilterViewBlock)(float grindRatio , float whitenRatio, float intensity); | ||
| 12 | + | ||
| 13 | +typedef void(^FilterCurrentType)(NSInteger currentType); | ||
| 14 | + | ||
| 15 | +typedef void(^FilterCurrentIdx)(NSInteger currentIdx); | ||
| 16 | + | ||
| 17 | +@interface FilterFunctionView : UIView | ||
| 18 | + | ||
| 19 | +@property (nonatomic, copy) FilterViewBlock filterViewBlock; | ||
| 20 | + | ||
| 21 | +@property (nonatomic, copy) FilterCurrentType currentTypeBlock; | ||
| 22 | + | ||
| 23 | +@property (nonatomic, copy) FilterCurrentIdx currentIdxBlock; | ||
| 24 | + | ||
| 25 | +@end | ||
| 26 | + |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/LiveSections/View/FilterFunctionView.m
0 → 100755
| 1 | +// | ||
| 2 | +// FilterFunctionView.m | ||
| 3 | +// CNLivePlayerSDKDemo | ||
| 4 | +// | ||
| 5 | +// Created by iOS on 16/12/21. | ||
| 6 | +// Copyright © 2016年 雷浩杰. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "FilterFunctionView.h" | ||
| 10 | +#import "SliderView.h" | ||
| 11 | + | ||
| 12 | +@interface FilterFunctionView ()<SliderViewDelegate,UIPickerViewDelegate,UIPickerViewDataSource> | ||
| 13 | +{ | ||
| 14 | + NSArray *_dataArr; | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | +@property (nonatomic, strong) SliderView *slider1; | ||
| 18 | +@property (nonatomic, strong) SliderView *slider2; | ||
| 19 | +@property (nonatomic, strong) SliderView *slider3; | ||
| 20 | +@property (nonatomic, strong) UISegmentedControl * filterGroupType; | ||
| 21 | +@property (nonatomic, strong) UIPickerView *effectPicker; | ||
| 22 | + | ||
| 23 | +@end | ||
| 24 | + | ||
| 25 | +@implementation FilterFunctionView | ||
| 26 | + | ||
| 27 | +- (instancetype)initWithFrame:(CGRect)frame | ||
| 28 | +{ | ||
| 29 | + self = [super initWithFrame:frame]; | ||
| 30 | + if (self) { | ||
| 31 | + [self addSubview:self.slider1]; | ||
| 32 | + [self addSubview:self.slider2]; | ||
| 33 | + [self addSubview:self.slider3]; | ||
| 34 | + [self addSubview:self.effectPicker]; | ||
| 35 | + [self addSubview:self.filterGroupType]; | ||
| 36 | + | ||
| 37 | + _dataArr = @[@"小清新",@"靓丽",@"甜美可人",@"怀旧",@"蓝调",@"老照片"]; | ||
| 38 | + | ||
| 39 | + } | ||
| 40 | + return self; | ||
| 41 | +} | ||
| 42 | + | ||
| 43 | +#pragma mark - | ||
| 44 | +#pragma mark - SliderViewDelegate | ||
| 45 | + | ||
| 46 | +- (void)sliderValueChenged | ||
| 47 | +{ | ||
| 48 | + if (_filterViewBlock) { | ||
| 49 | + _filterViewBlock(_slider1.currentValue, _slider2.currentValue, _slider3.currentValue); | ||
| 50 | + } | ||
| 51 | +} | ||
| 52 | + | ||
| 53 | +- (void)onSegCtrl:(UISegmentedControl *)sender | ||
| 54 | +{ | ||
| 55 | + | ||
| 56 | + if (sender.selectedSegmentIndex == 0) { | ||
| 57 | + _slider1.hidden = YES; | ||
| 58 | + _slider2.hidden = YES; | ||
| 59 | + _slider3.hidden = YES; | ||
| 60 | + _effectPicker.hidden = YES; | ||
| 61 | + | ||
| 62 | + } else if (sender.selectedSegmentIndex == 1) { | ||
| 63 | + _slider1.hidden = NO; | ||
| 64 | + _slider2.hidden = YES; | ||
| 65 | + _slider3.hidden = YES; | ||
| 66 | + _effectPicker.hidden = YES; | ||
| 67 | + } else if (sender.selectedSegmentIndex == 2) { | ||
| 68 | + _slider1.hidden = NO; | ||
| 69 | + _slider2.hidden = NO; | ||
| 70 | + _slider3.hidden = NO; | ||
| 71 | + _effectPicker.hidden = YES; | ||
| 72 | + } else { | ||
| 73 | + _slider1.hidden = NO; | ||
| 74 | + _slider2.hidden = NO; | ||
| 75 | + _slider3.hidden = NO; | ||
| 76 | + _effectPicker.hidden = NO; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + _currentTypeBlock ? _currentTypeBlock(sender.selectedSegmentIndex) : nil; | ||
| 80 | + | ||
| 81 | +} | ||
| 82 | + | ||
| 83 | +#pragma mark - | ||
| 84 | +#pragma mark - effectPicker | ||
| 85 | +- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView | ||
| 86 | +{ | ||
| 87 | + return 1; | ||
| 88 | +} | ||
| 89 | + | ||
| 90 | +- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component | ||
| 91 | +{ | ||
| 92 | + return _dataArr.count; | ||
| 93 | +} | ||
| 94 | + | ||
| 95 | +- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component | ||
| 96 | +{ | ||
| 97 | + return _dataArr[row]; | ||
| 98 | +} | ||
| 99 | + | ||
| 100 | +- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component | ||
| 101 | +{ | ||
| 102 | + _currentIdxBlock ? _currentIdxBlock(row) : nil; | ||
| 103 | +} | ||
| 104 | + | ||
| 105 | +#pragma mark - | ||
| 106 | +#pragma mark - getter | ||
| 107 | + | ||
| 108 | +- (SliderView *)slider1 | ||
| 109 | +{ | ||
| 110 | + if (!_slider1) { | ||
| 111 | + _slider1 = [[SliderView alloc] initWithFrame:CGRectMake(8, 50, self.bounds.size.width-16, 24) title:@"磨皮"]; | ||
| 112 | + _slider1.delagate = self; | ||
| 113 | + } | ||
| 114 | + return _slider1; | ||
| 115 | +} | ||
| 116 | + | ||
| 117 | +- (SliderView *)slider2 | ||
| 118 | +{ | ||
| 119 | + if (!_slider2) { | ||
| 120 | + _slider2 = [[SliderView alloc] initWithFrame:CGRectMake(8, 80, self.bounds.size.width-16, 24) title:@"美白"]; | ||
| 121 | + _slider2.delagate = self; | ||
| 122 | + } | ||
| 123 | + return _slider2; | ||
| 124 | +} | ||
| 125 | + | ||
| 126 | +- (SliderView *)slider3 | ||
| 127 | +{ | ||
| 128 | + if (!_slider3) { | ||
| 129 | + _slider3 = [[SliderView alloc] initWithFrame:CGRectMake(8, 110, self.bounds.size.width-16, 24) title:@"特效"]; | ||
| 130 | + _slider3.delagate = self; | ||
| 131 | + } | ||
| 132 | + return _slider3; | ||
| 133 | +} | ||
| 134 | + | ||
| 135 | +- (UIPickerView *)effectPicker | ||
| 136 | +{ | ||
| 137 | + if (!_effectPicker) { | ||
| 138 | + _effectPicker = [[UIPickerView alloc] initWithFrame:CGRectMake(8, 130, self.bounds.size.width-16, 100)]; | ||
| 139 | + _effectPicker.showsSelectionIndicator=YES; | ||
| 140 | + _effectPicker.tintColor = [UIColor whiteColor]; | ||
| 141 | + _effectPicker.dataSource = self; | ||
| 142 | + _effectPicker.delegate = self; | ||
| 143 | + _effectPicker.hidden = YES; | ||
| 144 | + } | ||
| 145 | + return _effectPicker; | ||
| 146 | +} | ||
| 147 | + | ||
| 148 | +- (UISegmentedControl *)filterGroupType | ||
| 149 | +{ | ||
| 150 | + if (!_filterGroupType) { | ||
| 151 | + NSArray *items = @[ @"关", | ||
| 152 | + @"旧美颜", | ||
| 153 | + @"红润美颜", | ||
| 154 | + @"美颜特效", | ||
| 155 | + ]; | ||
| 156 | + | ||
| 157 | + _filterGroupType = [[UISegmentedControl alloc] initWithItems:items]; | ||
| 158 | + _filterGroupType.frame = CGRectMake(10, 0, self.bounds.size.width-20, 30); | ||
| 159 | + _filterGroupType.tintColor= [UIColor blackColor]; | ||
| 160 | + _filterGroupType.selectedSegmentIndex = 0; | ||
| 161 | + _filterGroupType.layer.cornerRadius = 5; | ||
| 162 | + _filterGroupType.selectedSegmentIndex = 1; | ||
| 163 | + [_filterGroupType addTarget:self action:@selector(onSegCtrl:) forControlEvents:UIControlEventValueChanged]; | ||
| 164 | + } | ||
| 165 | + return _filterGroupType; | ||
| 166 | +} | ||
| 167 | +@end |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/LiveSections/View/SliderView.h
0 → 100755
| 1 | +// | ||
| 2 | +// SliderView.h | ||
| 3 | +// CNLivePlayerSDKDemo | ||
| 4 | +// | ||
| 5 | +// Created by iOS on 16/12/21. | ||
| 6 | +// Copyright © 2016年 雷浩杰. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <UIKit/UIKit.h> | ||
| 10 | + | ||
| 11 | +@protocol SliderViewDelegate <NSObject> | ||
| 12 | + | ||
| 13 | +- (void)sliderValueChenged; | ||
| 14 | + | ||
| 15 | +@end | ||
| 16 | + | ||
| 17 | +@interface SliderView : UIView | ||
| 18 | + | ||
| 19 | +@property (nonatomic, strong) UILabel* nameL; // 滑块对应参数名称 | ||
| 20 | +@property (nonatomic, strong) UISlider* slider; // 滑块 | ||
| 21 | +@property (nonatomic, strong) UILabel* valueL; // 滑块当前的值 | ||
| 22 | +@property (nonatomic, assign, readonly) float currentValue; | ||
| 23 | +@property (nonatomic, assign) id<SliderViewDelegate> delagate; | ||
| 24 | + | ||
| 25 | +- (instancetype)initWithFrame:(CGRect)frame title:(NSString *)title; | ||
| 26 | + | ||
| 27 | +@end |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/LiveSections/View/SliderView.m
0 → 100755
| 1 | +// | ||
| 2 | +// SliderView.m | ||
| 3 | +// CNLivePlayerSDKDemo | ||
| 4 | +// | ||
| 5 | +// Created by iOS on 16/12/21. | ||
| 6 | +// Copyright © 2016年 雷浩杰. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "SliderView.h" | ||
| 10 | + | ||
| 11 | +@implementation SliderView | ||
| 12 | +{ | ||
| 13 | + NSString *_title; | ||
| 14 | +} | ||
| 15 | + | ||
| 16 | +- (instancetype)initWithFrame:(CGRect)frame title:(NSString *)title{ | ||
| 17 | + self = [super initWithFrame:frame]; | ||
| 18 | + if (self) { | ||
| 19 | + _title = title; | ||
| 20 | + [self addSubview:self.nameL]; | ||
| 21 | + [self addSubview:self.valueL]; | ||
| 22 | + [self addSubview:self.slider]; | ||
| 23 | + } | ||
| 24 | + return self; | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +- (float)currentValue | ||
| 28 | +{ | ||
| 29 | + return _slider.value; | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | +#pragma mark - | ||
| 33 | +#pragma mark - action | ||
| 34 | + | ||
| 35 | +- (void)onSlider:(UISlider *)slider | ||
| 36 | +{ | ||
| 37 | + _valueL.text = [NSString stringWithFormat:@"%d",(int)(slider.value * 100)]; | ||
| 38 | + if (self.delagate && [self.delagate respondsToSelector:@selector(sliderValueChenged)]) { | ||
| 39 | + [self.delagate sliderValueChenged]; | ||
| 40 | + } | ||
| 41 | +} | ||
| 42 | + | ||
| 43 | +#pragma mark - | ||
| 44 | +#pragma mark - getter | ||
| 45 | + | ||
| 46 | +- (UILabel *)nameL | ||
| 47 | +{ | ||
| 48 | + if (!_nameL) { | ||
| 49 | + _nameL = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 24)]; | ||
| 50 | + _nameL.text = _title; | ||
| 51 | + _nameL.textAlignment = NSTextAlignmentCenter; | ||
| 52 | + _nameL.textColor = [UIColor whiteColor]; | ||
| 53 | + _nameL.backgroundColor = [UIColor colorWithRed:192/255.0 green:192/255.0 blue:192/255.0 alpha:1]; | ||
| 54 | + _nameL.layer.cornerRadius = 5; | ||
| 55 | + _nameL.layer.masksToBounds = YES; | ||
| 56 | + } | ||
| 57 | + return _nameL; | ||
| 58 | +} | ||
| 59 | + | ||
| 60 | +- (UILabel *)valueL | ||
| 61 | +{ | ||
| 62 | + if (!_valueL) { | ||
| 63 | + _valueL = [[UILabel alloc] initWithFrame:CGRectMake(self.bounds.size.width-40, 0, 40, 24)]; | ||
| 64 | + _valueL.text = @"50"; | ||
| 65 | + _valueL.textAlignment = NSTextAlignmentCenter; | ||
| 66 | + _valueL.textColor = [UIColor whiteColor]; | ||
| 67 | + _valueL.backgroundColor = [UIColor colorWithRed:192/255.0 green:192/255.0 blue:192/255.0 alpha:1]; | ||
| 68 | + _valueL.layer.cornerRadius = 5; | ||
| 69 | + _valueL.layer.masksToBounds = YES; | ||
| 70 | + | ||
| 71 | + } | ||
| 72 | + return _valueL; | ||
| 73 | +} | ||
| 74 | + | ||
| 75 | +- (UISlider *)slider | ||
| 76 | +{ | ||
| 77 | + if (!_slider) { | ||
| 78 | + _slider = [[UISlider alloc] initWithFrame:CGRectMake(40, 0, self.bounds.size.width-80, 24)]; | ||
| 79 | + _slider.value = 0.5; | ||
| 80 | + [_slider addTarget:self action:@selector(onSlider:) forControlEvents:UIControlEventValueChanged]; | ||
| 81 | + } | ||
| 82 | + return _slider; | ||
| 83 | +} | ||
| 84 | +@end |
LiveVideoCloud/LiveVideoCloud/Info.plist
| @@ -6,6 +6,15 @@ | @@ -6,6 +6,15 @@ | ||
| 6 | <false/> | 6 | <false/> |
| 7 | <key>CFBundleDevelopmentRegion</key> | 7 | <key>CFBundleDevelopmentRegion</key> |
| 8 | <string>en</string> | 8 | <string>en</string> |
| 9 | + <key>NSAppTransportSecurity</key> | ||
| 10 | + <dict> | ||
| 11 | + <key>NSAllowsArbitraryLoads</key> | ||
| 12 | + <true/> | ||
| 13 | + </dict> | ||
| 14 | + <key>NSCameraUsageDescription</key> | ||
| 15 | + <string></string> | ||
| 16 | + <key>NSMicrophoneUsageDescription</key> | ||
| 17 | + <string></string> | ||
| 9 | <key>CFBundleExecutable</key> | 18 | <key>CFBundleExecutable</key> |
| 10 | <string>$(EXECUTABLE_NAME)</string> | 19 | <string>$(EXECUTABLE_NAME)</string> |
| 11 | <key>CFBundleIdentifier</key> | 20 | <key>CFBundleIdentifier</key> |