Commit 82321daa99f1c0bedce4c347e5960afd158bb8ac

Authored by 朱林
2 parents c5309b94 2d64d84c

Merge branch 'master' of bj.gitlab.cnlive.com:ios-team/LiveVideoCloud

Conflicts:
	LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/HomeViewController.m
Showing 43 changed files with 1465 additions and 566 deletions
LiveVideoCloud/LiveVideoCloud.xcodeproj/project.pbxproj
@@ -145,7 +145,6 @@ @@ -145,7 +145,6 @@
145 D2029D091E6EAE2E0027CD92 /* Foundation+Log.m in Sources */ = {isa = PBXBuildFile; fileRef = D2029CF21E6EAE2E0027CD92 /* Foundation+Log.m */; }; 145 D2029D091E6EAE2E0027CD92 /* Foundation+Log.m in Sources */ = {isa = PBXBuildFile; fileRef = D2029CF21E6EAE2E0027CD92 /* Foundation+Log.m */; };
146 D2029D0A1E6EAE2E0027CD92 /* ZXServerUrl.m in Sources */ = {isa = PBXBuildFile; fileRef = D2029CFE1E6EAE2E0027CD92 /* ZXServerUrl.m */; }; 146 D2029D0A1E6EAE2E0027CD92 /* ZXServerUrl.m in Sources */ = {isa = PBXBuildFile; fileRef = D2029CFE1E6EAE2E0027CD92 /* ZXServerUrl.m */; };
147 D2029D161E6EB00D0027CD92 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D2029D151E6EB00D0027CD92 /* AppDelegate.m */; }; 147 D2029D161E6EB00D0027CD92 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D2029D151E6EB00D0027CD92 /* AppDelegate.m */; };
148 - D207BE9E1E84BD68006A0CE8 /* BarrageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D207BE9D1E84BD68006A0CE8 /* BarrageManager.m */; };  
149 D207BEA11E84C1EC006A0CE8 /* AnimationBaseView.m in Sources */ = {isa = PBXBuildFile; fileRef = D207BEA01E84C1EC006A0CE8 /* AnimationBaseView.m */; }; 148 D207BEA11E84C1EC006A0CE8 /* AnimationBaseView.m in Sources */ = {isa = PBXBuildFile; fileRef = D207BEA01E84C1EC006A0CE8 /* AnimationBaseView.m */; };
150 D217A24A1E7B76C7003B44CB /* PresentView.m in Sources */ = {isa = PBXBuildFile; fileRef = D217A2471E7B76C7003B44CB /* PresentView.m */; }; 149 D217A24A1E7B76C7003B44CB /* PresentView.m in Sources */ = {isa = PBXBuildFile; fileRef = D217A2471E7B76C7003B44CB /* PresentView.m */; };
151 D217A24B1E7B76C7003B44CB /* PresentViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D217A2491E7B76C7003B44CB /* PresentViewCell.m */; }; 150 D217A24B1E7B76C7003B44CB /* PresentViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D217A2491E7B76C7003B44CB /* PresentViewCell.m */; };
@@ -192,14 +191,19 @@ @@ -192,14 +191,19 @@
192 D2888DB41E6EC154003A77C8 /* HomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888DB31E6EC154003A77C8 /* HomeViewController.m */; }; 191 D2888DB41E6EC154003A77C8 /* HomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888DB31E6EC154003A77C8 /* HomeViewController.m */; };
193 D2888DB71E6EC1B8003A77C8 /* LVCMyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888DB61E6EC1B8003A77C8 /* LVCMyViewController.m */; }; 192 D2888DB71E6EC1B8003A77C8 /* LVCMyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888DB61E6EC1B8003A77C8 /* LVCMyViewController.m */; };
194 D29D88481E88C53300543A03 /* LVCUGCLivePrepareView.m in Sources */ = {isa = PBXBuildFile; fileRef = D29D88471E88C53300543A03 /* LVCUGCLivePrepareView.m */; }; 193 D29D88481E88C53300543A03 /* LVCUGCLivePrepareView.m in Sources */ = {isa = PBXBuildFile; fileRef = D29D88471E88C53300543A03 /* LVCUGCLivePrepareView.m */; };
  194 + D29E81ED1E88DC5B008C9906 /* PriChatCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D29E81EC1E88DC5B008C9906 /* PriChatCell.m */; };
  195 + D2A089E81E89FA720071412C /* LVCUGCLivePlayerCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D2A089E71E89FA720071412C /* LVCUGCLivePlayerCell.m */; };
  196 + D2A089EB1E8A09CB0071412C /* LVCUGCLivePlayerModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D2A089EA1E8A09CB0071412C /* LVCUGCLivePlayerModel.m */; };
195 D2A803081E80BD6F009D6F1C /* TopToolView.m in Sources */ = {isa = PBXBuildFile; fileRef = D2A803071E80BD6F009D6F1C /* TopToolView.m */; }; 197 D2A803081E80BD6F009D6F1C /* TopToolView.m in Sources */ = {isa = PBXBuildFile; fileRef = D2A803071E80BD6F009D6F1C /* TopToolView.m */; };
196 D2B2ED7A1E88F90C00F7538A /* CNLiveChatManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B21E88F8E600B7C517 /* CNLiveChatManager.framework */; }; 198 D2B2ED7A1E88F90C00F7538A /* CNLiveChatManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B21E88F8E600B7C517 /* CNLiveChatManager.framework */; };
197 D2B2ED7B1E88F90C00F7538A /* CNLiveChatManager.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B21E88F8E600B7C517 /* CNLiveChatManager.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 199 D2B2ED7B1E88F90C00F7538A /* CNLiveChatManager.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B21E88F8E600B7C517 /* CNLiveChatManager.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
198 D2B2ED7C1E88F90F00F7538A /* CNLiveMsgTools.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B31E88F8E600B7C517 /* CNLiveMsgTools.framework */; }; 200 D2B2ED7C1E88F90F00F7538A /* CNLiveMsgTools.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B31E88F8E600B7C517 /* CNLiveMsgTools.framework */; };
199 D2B2ED7D1E88F90F00F7538A /* CNLiveMsgTools.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B31E88F8E600B7C517 /* CNLiveMsgTools.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 201 D2B2ED7D1E88F90F00F7538A /* CNLiveMsgTools.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B31E88F8E600B7C517 /* CNLiveMsgTools.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
  202 + D2B2ED801E88FC5200F7538A /* LVCUGCLiveEndView.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B2ED7F1E88FC5200F7538A /* LVCUGCLiveEndView.m */; };
200 D2B7B2511E8247D400ED084E /* ChatBarrageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B7B2501E8247D400ED084E /* ChatBarrageManager.m */; }; 203 D2B7B2511E8247D400ED084E /* ChatBarrageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B7B2501E8247D400ED084E /* ChatBarrageManager.m */; };
201 D2B7B2541E824B2D00ED084E /* ChatBarrageView.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B7B2531E824B2D00ED084E /* ChatBarrageView.m */; }; 204 D2B7B2541E824B2D00ED084E /* ChatBarrageView.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B7B2531E824B2D00ED084E /* ChatBarrageView.m */; };
202 D2B7B2571E8261EF00ED084E /* ChatBarrOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B7B2561E8261EF00ED084E /* ChatBarrOperation.m */; }; 205 D2B7B2571E8261EF00ED084E /* ChatBarrOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B7B2561E8261EF00ED084E /* ChatBarrOperation.m */; };
  206 + D2CC7B871E891AA50034B8BF /* LVCUGCLiveListController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2CC7B861E891AA50034B8BF /* LVCUGCLiveListController.m */; };
203 D2D236B41E88F8E600B7C517 /* CNLiveChatManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B21E88F8E600B7C517 /* CNLiveChatManager.framework */; }; 207 D2D236B41E88F8E600B7C517 /* CNLiveChatManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B21E88F8E600B7C517 /* CNLiveChatManager.framework */; };
204 D2D236B51E88F8E600B7C517 /* CNLiveMsgTools.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B31E88F8E600B7C517 /* CNLiveMsgTools.framework */; }; 208 D2D236B51E88F8E600B7C517 /* CNLiveMsgTools.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B31E88F8E600B7C517 /* CNLiveMsgTools.framework */; };
205 /* End PBXBuildFile section */ 209 /* End PBXBuildFile section */
@@ -531,8 +535,6 @@ @@ -531,8 +535,6 @@
531 D2029CFF1E6EAE2E0027CD92 /* UtilKits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UtilKits.h; sourceTree = "<group>"; }; 535 D2029CFF1E6EAE2E0027CD92 /* UtilKits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UtilKits.h; sourceTree = "<group>"; };
532 D2029D121E6EAF8D0027CD92 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; 536 D2029D121E6EAF8D0027CD92 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
533 D2029D151E6EB00D0027CD92 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; 537 D2029D151E6EB00D0027CD92 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
534 - D207BE9C1E84BD68006A0CE8 /* BarrageManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BarrageManager.h; sourceTree = "<group>"; };  
535 - D207BE9D1E84BD68006A0CE8 /* BarrageManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BarrageManager.m; sourceTree = "<group>"; };  
536 D207BE9F1E84C1EC006A0CE8 /* AnimationBaseView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnimationBaseView.h; sourceTree = "<group>"; }; 538 D207BE9F1E84C1EC006A0CE8 /* AnimationBaseView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnimationBaseView.h; sourceTree = "<group>"; };
537 D207BEA01E84C1EC006A0CE8 /* AnimationBaseView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AnimationBaseView.m; sourceTree = "<group>"; }; 539 D207BEA01E84C1EC006A0CE8 /* AnimationBaseView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AnimationBaseView.m; sourceTree = "<group>"; };
538 D217A2451E7B76C7003B44CB /* PresentModelAble.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PresentModelAble.h; sourceTree = "<group>"; }; 540 D217A2451E7B76C7003B44CB /* PresentModelAble.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PresentModelAble.h; sourceTree = "<group>"; };
@@ -621,14 +623,24 @@ @@ -621,14 +623,24 @@
621 D2888DB61E6EC1B8003A77C8 /* LVCMyViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCMyViewController.m; sourceTree = "<group>"; }; 623 D2888DB61E6EC1B8003A77C8 /* LVCMyViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCMyViewController.m; sourceTree = "<group>"; };
622 D29D88461E88C53300543A03 /* LVCUGCLivePrepareView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCUGCLivePrepareView.h; sourceTree = "<group>"; }; 624 D29D88461E88C53300543A03 /* LVCUGCLivePrepareView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCUGCLivePrepareView.h; sourceTree = "<group>"; };
623 D29D88471E88C53300543A03 /* LVCUGCLivePrepareView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCUGCLivePrepareView.m; sourceTree = "<group>"; }; 625 D29D88471E88C53300543A03 /* LVCUGCLivePrepareView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCUGCLivePrepareView.m; sourceTree = "<group>"; };
  626 + D29E81EB1E88DC5B008C9906 /* PriChatCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PriChatCell.h; sourceTree = "<group>"; };
  627 + D29E81EC1E88DC5B008C9906 /* PriChatCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PriChatCell.m; sourceTree = "<group>"; };
  628 + D2A089E61E89FA720071412C /* LVCUGCLivePlayerCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCUGCLivePlayerCell.h; sourceTree = "<group>"; };
  629 + D2A089E71E89FA720071412C /* LVCUGCLivePlayerCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCUGCLivePlayerCell.m; sourceTree = "<group>"; };
  630 + D2A089E91E8A09CB0071412C /* LVCUGCLivePlayerModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCUGCLivePlayerModel.h; sourceTree = "<group>"; };
  631 + D2A089EA1E8A09CB0071412C /* LVCUGCLivePlayerModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCUGCLivePlayerModel.m; sourceTree = "<group>"; };
624 D2A803061E80BD6F009D6F1C /* TopToolView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopToolView.h; sourceTree = "<group>"; }; 632 D2A803061E80BD6F009D6F1C /* TopToolView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopToolView.h; sourceTree = "<group>"; };
625 D2A803071E80BD6F009D6F1C /* TopToolView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopToolView.m; sourceTree = "<group>"; }; 633 D2A803071E80BD6F009D6F1C /* TopToolView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopToolView.m; sourceTree = "<group>"; };
  634 + D2B2ED7E1E88FC5200F7538A /* LVCUGCLiveEndView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCUGCLiveEndView.h; sourceTree = "<group>"; };
  635 + D2B2ED7F1E88FC5200F7538A /* LVCUGCLiveEndView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCUGCLiveEndView.m; sourceTree = "<group>"; };
626 D2B7B24F1E8247D400ED084E /* ChatBarrageManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChatBarrageManager.h; sourceTree = "<group>"; }; 636 D2B7B24F1E8247D400ED084E /* ChatBarrageManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChatBarrageManager.h; sourceTree = "<group>"; };
627 D2B7B2501E8247D400ED084E /* ChatBarrageManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChatBarrageManager.m; sourceTree = "<group>"; }; 637 D2B7B2501E8247D400ED084E /* ChatBarrageManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChatBarrageManager.m; sourceTree = "<group>"; };
628 D2B7B2521E824B2D00ED084E /* ChatBarrageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChatBarrageView.h; sourceTree = "<group>"; }; 638 D2B7B2521E824B2D00ED084E /* ChatBarrageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChatBarrageView.h; sourceTree = "<group>"; };
629 D2B7B2531E824B2D00ED084E /* ChatBarrageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChatBarrageView.m; sourceTree = "<group>"; }; 639 D2B7B2531E824B2D00ED084E /* ChatBarrageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChatBarrageView.m; sourceTree = "<group>"; };
630 D2B7B2551E8261EF00ED084E /* ChatBarrOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChatBarrOperation.h; sourceTree = "<group>"; }; 640 D2B7B2551E8261EF00ED084E /* ChatBarrOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChatBarrOperation.h; sourceTree = "<group>"; };
631 D2B7B2561E8261EF00ED084E /* ChatBarrOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChatBarrOperation.m; sourceTree = "<group>"; }; 641 D2B7B2561E8261EF00ED084E /* ChatBarrOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChatBarrOperation.m; sourceTree = "<group>"; };
  642 + D2CC7B851E891AA50034B8BF /* LVCUGCLiveListController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCUGCLiveListController.h; sourceTree = "<group>"; };
  643 + D2CC7B861E891AA50034B8BF /* LVCUGCLiveListController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCUGCLiveListController.m; sourceTree = "<group>"; };
632 D2D236B21E88F8E600B7C517 /* CNLiveChatManager.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLiveChatManager.framework; sourceTree = "<group>"; }; 644 D2D236B21E88F8E600B7C517 /* CNLiveChatManager.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLiveChatManager.framework; sourceTree = "<group>"; };
633 D2D236B31E88F8E600B7C517 /* CNLiveMsgTools.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLiveMsgTools.framework; sourceTree = "<group>"; }; 645 D2D236B31E88F8E600B7C517 /* CNLiveMsgTools.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLiveMsgTools.framework; sourceTree = "<group>"; };
634 /* End PBXFileReference section */ 646 /* End PBXFileReference section */
@@ -752,6 +764,8 @@ @@ -752,6 +764,8 @@
752 81A4831F1E88F4BF0097A80A /* LVCProgramModel.m */, 764 81A4831F1E88F4BF0097A80A /* LVCProgramModel.m */,
753 81A482FF1E88B0130097A80A /* LVCChatRoomModel.h */, 765 81A482FF1E88B0130097A80A /* LVCChatRoomModel.h */,
754 81A483001E88B0130097A80A /* LVCChatRoomModel.m */, 766 81A483001E88B0130097A80A /* LVCChatRoomModel.m */,
  767 + D2A089E91E8A09CB0071412C /* LVCUGCLivePlayerModel.h */,
  768 + D2A089EA1E8A09CB0071412C /* LVCUGCLivePlayerModel.m */,
755 ); 769 );
756 path = Model; 770 path = Model;
757 sourceTree = "<group>"; 771 sourceTree = "<group>";
@@ -1348,15 +1362,6 @@ @@ -1348,15 +1362,6 @@
1348 path = AppDelegate; 1362 path = AppDelegate;
1349 sourceTree = "<group>"; 1363 sourceTree = "<group>";
1350 }; 1364 };
1351 - D207BE9B1E84BD3E006A0CE8 /* BarrageManager */ = {  
1352 - isa = PBXGroup;  
1353 - children = (  
1354 - D207BE9C1E84BD68006A0CE8 /* BarrageManager.h */,  
1355 - D207BE9D1E84BD68006A0CE8 /* BarrageManager.m */,  
1356 - );  
1357 - path = BarrageManager;  
1358 - sourceTree = "<group>";  
1359 - };  
1360 D217A2441E7B76C7003B44CB /* Present */ = { 1365 D217A2441E7B76C7003B44CB /* Present */ = {
1361 isa = PBXGroup; 1366 isa = PBXGroup;
1362 children = ( 1367 children = (
@@ -1383,7 +1388,6 @@ @@ -1383,7 +1388,6 @@
1383 D22830F61E77C26C00627701 /* Chat */ = { 1388 D22830F61E77C26C00627701 /* Chat */ = {
1384 isa = PBXGroup; 1389 isa = PBXGroup;
1385 children = ( 1390 children = (
1386 - D207BE9B1E84BD3E006A0CE8 /* BarrageManager */,  
1387 D2B7B24E1E8247B500ED084E /* ChatBarrageManager */, 1391 D2B7B24E1E8247B500ED084E /* ChatBarrageManager */,
1388 D236968F1E7FC83800E4BF71 /* ChatMsgModel */, 1392 D236968F1E7FC83800E4BF71 /* ChatMsgModel */,
1389 D22830F71E77C27A00627701 /* ChatViews */, 1393 D22830F71E77C27A00627701 /* ChatViews */,
@@ -1450,6 +1454,8 @@ @@ -1450,6 +1454,8 @@
1450 children = ( 1454 children = (
1451 D24571611E83C40B00AA85D6 /* PrivateView.h */, 1455 D24571611E83C40B00AA85D6 /* PrivateView.h */,
1452 D24571621E83C40B00AA85D6 /* PrivateView.m */, 1456 D24571621E83C40B00AA85D6 /* PrivateView.m */,
  1457 + D29E81EB1E88DC5B008C9906 /* PriChatCell.h */,
  1458 + D29E81EC1E88DC5B008C9906 /* PriChatCell.m */,
1453 ); 1459 );
1454 path = PrivateView; 1460 path = PrivateView;
1455 sourceTree = "<group>"; 1461 sourceTree = "<group>";
@@ -1544,6 +1550,8 @@ @@ -1544,6 +1550,8 @@
1544 D25BF8791E7B8A82007FB138 /* SliderView.m */, 1550 D25BF8791E7B8A82007FB138 /* SliderView.m */,
1545 D29D88461E88C53300543A03 /* LVCUGCLivePrepareView.h */, 1551 D29D88461E88C53300543A03 /* LVCUGCLivePrepareView.h */,
1546 D29D88471E88C53300543A03 /* LVCUGCLivePrepareView.m */, 1552 D29D88471E88C53300543A03 /* LVCUGCLivePrepareView.m */,
  1553 + D2B2ED7E1E88FC5200F7538A /* LVCUGCLiveEndView.h */,
  1554 + D2B2ED7F1E88FC5200F7538A /* LVCUGCLiveEndView.m */,
1547 ); 1555 );
1548 path = View; 1556 path = View;
1549 sourceTree = "<group>"; 1557 sourceTree = "<group>";
@@ -1644,6 +1652,8 @@ @@ -1644,6 +1652,8 @@
1644 810B64E21E779AFE00133E15 /* LVCLivePlayerController.m */, 1652 810B64E21E779AFE00133E15 /* LVCLivePlayerController.m */,
1645 810B65081E77B39D00133E15 /* LVCFullScreenPlayerController.h */, 1653 810B65081E77B39D00133E15 /* LVCFullScreenPlayerController.h */,
1646 810B65091E77B39D00133E15 /* LVCFullScreenPlayerController.m */, 1654 810B65091E77B39D00133E15 /* LVCFullScreenPlayerController.m */,
  1655 + D2CC7B851E891AA50034B8BF /* LVCUGCLiveListController.h */,
  1656 + D2CC7B861E891AA50034B8BF /* LVCUGCLiveListController.m */,
1647 D25BF87E1E7BD266007FB138 /* LVCUGCLivePlayerController.h */, 1657 D25BF87E1E7BD266007FB138 /* LVCUGCLivePlayerController.h */,
1648 D25BF87F1E7BD266007FB138 /* LVCUGCLivePlayerController.m */, 1658 D25BF87F1E7BD266007FB138 /* LVCUGCLivePlayerController.m */,
1649 81A483151E88BED00097A80A /* LVCTVLiveViewController.h */, 1659 81A483151E88BED00097A80A /* LVCTVLiveViewController.h */,
@@ -1673,6 +1683,8 @@ @@ -1673,6 +1683,8 @@
1673 81A483041E88B32C0097A80A /* LVCHeaderRollCollectionViewCell.m */, 1683 81A483041E88B32C0097A80A /* LVCHeaderRollCollectionViewCell.m */,
1674 8112D42F1E7927A5002E00F6 /* LVCPlayerLoadingView.h */, 1684 8112D42F1E7927A5002E00F6 /* LVCPlayerLoadingView.h */,
1675 8112D4301E7927A5002E00F6 /* LVCPlayerLoadingView.m */, 1685 8112D4301E7927A5002E00F6 /* LVCPlayerLoadingView.m */,
  1686 + D2A089E61E89FA720071412C /* LVCUGCLivePlayerCell.h */,
  1687 + D2A089E71E89FA720071412C /* LVCUGCLivePlayerCell.m */,
1676 D25BF8811E7F775F007FB138 /* LVCUGCPlayerLoadingView.h */, 1688 D25BF8811E7F775F007FB138 /* LVCUGCPlayerLoadingView.h */,
1677 D25BF8821E7F775F007FB138 /* LVCUGCPlayerLoadingView.m */, 1689 D25BF8821E7F775F007FB138 /* LVCUGCPlayerLoadingView.m */,
1678 D25BF8911E7FBAEA007FB138 /* LVCUGCBackgroundView.h */, 1690 D25BF8911E7FBAEA007FB138 /* LVCUGCBackgroundView.h */,
@@ -1904,6 +1916,7 @@ @@ -1904,6 +1916,7 @@
1904 D2029C941E6EADE10027CD92 /* UIRefreshControl+AFNetworking.m in Sources */, 1916 D2029C941E6EADE10027CD92 /* UIRefreshControl+AFNetworking.m in Sources */,
1905 D2029C911E6EADE10027CD92 /* UIButton+AFNetworking.m in Sources */, 1917 D2029C911E6EADE10027CD92 /* UIButton+AFNetworking.m in Sources */,
1906 D2029C931E6EADE10027CD92 /* UIProgressView+AFNetworking.m in Sources */, 1918 D2029C931E6EADE10027CD92 /* UIProgressView+AFNetworking.m in Sources */,
  1919 + D2A089E81E89FA720071412C /* LVCUGCLivePlayerCell.m in Sources */,
1907 D2029C8D1E6EADE10027CD92 /* AFAutoPurgingImageCache.m in Sources */, 1920 D2029C8D1E6EADE10027CD92 /* AFAutoPurgingImageCache.m in Sources */,
1908 81A483111E88B8630097A80A /* LVCChannelDetailsModel.m in Sources */, 1921 81A483111E88B8630097A80A /* LVCChannelDetailsModel.m in Sources */,
1909 D2029D011E6EAE2E0027CD92 /* UIColor+HexString.m in Sources */, 1922 D2029D011E6EAE2E0027CD92 /* UIColor+HexString.m in Sources */,
@@ -1916,6 +1929,7 @@ @@ -1916,6 +1929,7 @@
1916 810B65061E779B1F00133E15 /* View+MASAdditions.m in Sources */, 1929 810B65061E779B1F00133E15 /* View+MASAdditions.m in Sources */,
1917 D2029D161E6EB00D0027CD92 /* AppDelegate.m in Sources */, 1930 D2029D161E6EB00D0027CD92 /* AppDelegate.m in Sources */,
1918 D2029CB71E6EADE10027CD92 /* NSData+ImageContentType.m in Sources */, 1931 D2029CB71E6EADE10027CD92 /* NSData+ImageContentType.m in Sources */,
  1932 + D29E81ED1E88DC5B008C9906 /* PriChatCell.m in Sources */,
1919 D2029CD01E6EADE10027CD92 /* SearchPresenter.m in Sources */, 1933 D2029CD01E6EADE10027CD92 /* SearchPresenter.m in Sources */,
1920 D2888DB71E6EC1B8003A77C8 /* LVCMyViewController.m in Sources */, 1934 D2888DB71E6EC1B8003A77C8 /* LVCMyViewController.m in Sources */,
1921 D2029CBE1E6EADE10027CD92 /* SDWebImagePrefetcher.m in Sources */, 1935 D2029CBE1E6EADE10027CD92 /* SDWebImagePrefetcher.m in Sources */,
@@ -1947,12 +1961,14 @@ @@ -1947,12 +1961,14 @@
1947 D2029CC41E6EADE10027CD92 /* UIImageView+WebCache.m in Sources */, 1961 D2029CC41E6EADE10027CD92 /* UIImageView+WebCache.m in Sources */,
1948 D236967E1E7F9E4100E4BF71 /* GiftPayButton.m in Sources */, 1962 D236967E1E7F9E4100E4BF71 /* GiftPayButton.m in Sources */,
1949 81A483081E88B6140097A80A /* UIView+ViewController.m in Sources */, 1963 81A483081E88B6140097A80A /* UIView+ViewController.m in Sources */,
  1964 + D2A089EB1E8A09CB0071412C /* LVCUGCLivePlayerModel.m in Sources */,
1950 D2029CC81E6EADE10027CD92 /* SVProgressAnimatedView.m in Sources */, 1965 D2029CC81E6EADE10027CD92 /* SVProgressAnimatedView.m in Sources */,
1951 D2029C961E6EADE10027CD92 /* MBProgressHUD.m in Sources */, 1966 D2029C961E6EADE10027CD92 /* MBProgressHUD.m in Sources */,
1952 810B65071E779B1F00133E15 /* ViewController+MASAdditions.m in Sources */, 1967 810B65071E779B1F00133E15 /* ViewController+MASAdditions.m in Sources */,
1953 D2029C9A1E6EADE10027CD92 /* MJProperty.m in Sources */, 1968 D2029C9A1E6EADE10027CD92 /* MJProperty.m in Sources */,
1954 D2029CB91E6EADE10027CD92 /* SDWebImageCompat.m in Sources */, 1969 D2029CB91E6EADE10027CD92 /* SDWebImageCompat.m in Sources */,
1955 D2029CB61E6EADE10027CD92 /* MKAnnotationView+WebCache.m in Sources */, 1970 D2029CB61E6EADE10027CD92 /* MKAnnotationView+WebCache.m in Sources */,
  1971 + D2B2ED801E88FC5200F7538A /* LVCUGCLiveEndView.m in Sources */,
1956 810B64FE1E779B1F00133E15 /* MASCompositeConstraint.m in Sources */, 1972 810B64FE1E779B1F00133E15 /* MASCompositeConstraint.m in Sources */,
1957 D2029C981E6EADE10027CD92 /* MJExtensionConst.m in Sources */, 1973 D2029C981E6EADE10027CD92 /* MJExtensionConst.m in Sources */,
1958 D2575C671E76A25400E3A8FC /* LVCInteractionController.m in Sources */, 1974 D2575C671E76A25400E3A8FC /* LVCInteractionController.m in Sources */,
@@ -2010,11 +2026,11 @@ @@ -2010,11 +2026,11 @@
2010 D217A24A1E7B76C7003B44CB /* PresentView.m in Sources */, 2026 D217A24A1E7B76C7003B44CB /* PresentView.m in Sources */,
2011 D22830F11E778C0F00627701 /* LiveBaseView.m in Sources */, 2027 D22830F11E778C0F00627701 /* LiveBaseView.m in Sources */,
2012 D2029CBA1E6EADE10027CD92 /* SDWebImageDecoder.m in Sources */, 2028 D2029CBA1E6EADE10027CD92 /* SDWebImageDecoder.m in Sources */,
2013 - D207BE9E1E84BD68006A0CE8 /* BarrageManager.m in Sources */,  
2014 8112D4311E7927A5002E00F6 /* LVCPlayerLoadingView.m in Sources */, 2029 8112D4311E7927A5002E00F6 /* LVCPlayerLoadingView.m in Sources */,
2015 D2029D081E6EAE2E0027CD92 /* ZXDeviceInfo.m in Sources */, 2030 D2029D081E6EAE2E0027CD92 /* ZXDeviceInfo.m in Sources */,
2016 D24571631E83C40B00AA85D6 /* PrivateView.m in Sources */, 2031 D24571631E83C40B00AA85D6 /* PrivateView.m in Sources */,
2017 D2029CC21E6EADE10027CD92 /* UIImage+WebP.m in Sources */, 2032 D2029CC21E6EADE10027CD92 /* UIImage+WebP.m in Sources */,
  2033 + D2CC7B871E891AA50034B8BF /* LVCUGCLiveListController.m in Sources */,
2018 D2029BCD1E6EADD70027CD92 /* BaseViewController.m in Sources */, 2034 D2029BCD1E6EADD70027CD92 /* BaseViewController.m in Sources */,
2019 810B64E01E779AE900133E15 /* LVCPlayer.m in Sources */, 2035 810B64E01E779AE900133E15 /* LVCPlayer.m in Sources */,
2020 810B64FF1E779B1F00133E15 /* MASConstraint.m in Sources */, 2036 810B64FF1E779B1F00133E15 /* MASConstraint.m in Sources */,
LiveVideoCloud/LiveVideoCloud/AppDelegate/AppDelegate.m
@@ -27,20 +27,20 @@ @@ -27,20 +27,20 @@
27 27
28 //初始化聊天SDK并连接服务器 28 //初始化聊天SDK并连接服务器
29 [[CNLiveChatManager sharedCNLiveChatManager] initWithAppKey:AppKey appId:AppId]; 29 [[CNLiveChatManager sharedCNLiveChatManager] initWithAppKey:AppKey appId:AppId];
30 - [[CNLiveChatManager sharedCNLiveChatManager] connectServerSuccess:^{  
31 - NSLog(@"连接服务器-----success"); 30 +// [[CNLiveChatManager sharedCNLiveChatManager] connectServerSuccess:^{
  31 +// NSLog(@"连接服务器-----success");
  32 +// } error:^(CNLiveChatConnectErrorCode errors) {
  33 +// NSLog(@"连接服务器失败-----%ld", errors);
  34 +// }];
  35 + // 20170327 20170328
  36 + CNLiveChatUserInfo *userInfo = [[CNLiveChatUserInfo alloc] initWithUserId:@"20170328" name:@"20170328" portrait:@""];
  37 + [[CNLiveChatManager sharedCNLiveChatManager] loginServer:userInfo success:^(NSString *userId) {
  38 + NSLog(@"连接服务器-----success");
  39 +
32 } error:^(CNLiveChatConnectErrorCode errors) { 40 } error:^(CNLiveChatConnectErrorCode errors) {
33 NSLog(@"连接服务器失败-----%ld", errors); 41 NSLog(@"连接服务器失败-----%ld", errors);
34 - }];;  
35 -  
36 - [self.window makeKeyAndVisible];  
37 -  
38 - [[CNLiveChatManager sharedCNLiveChatManager] initWithAppKey:AppKey appId:AppId];  
39 - [[CNLiveChatManager sharedCNLiveChatManager] connectServerSuccess:^{  
40 - NSLog(@"connectSuccess");  
41 - } error:^(CNLiveChatConnectErrorCode errors) {  
42 - NSLog(@"errors%ld",errors);  
43 }]; 42 }];
  43 + [self.window makeKeyAndVisible];
44 44
45 return YES; 45 return YES;
46 } 46 }
LiveVideoCloud/LiveVideoCloud/Classes/Helpers/Tools.h
@@ -27,6 +27,8 @@ typedef NS_ENUM(NSInteger, ShowMessageType) {//消息背景类型 @@ -27,6 +27,8 @@ typedef NS_ENUM(NSInteger, ShowMessageType) {//消息背景类型
27 27
28 + (void)closeBouces; 28 + (void)closeBouces;
29 29
  30 ++ (void)showNaviViewWithMessage:(NSString *_Nonnull)message;
  31 +
30 + (NSString *_Nullable)dictionaryToJson:(NSDictionary *_Nullable)dic; 32 + (NSString *_Nullable)dictionaryToJson:(NSDictionary *_Nullable)dic;
31 33
32 + (NSDictionary *_Nullable)dictionaryWithJsonString:(NSString *_Nullable)jsonString; 34 + (NSDictionary *_Nullable)dictionaryWithJsonString:(NSString *_Nullable)jsonString;
LiveVideoCloud/LiveVideoCloud/Classes/Helpers/Tools.m
@@ -83,6 +83,32 @@ @@ -83,6 +83,32 @@
83 }]; 83 }];
84 } 84 }
85 85
  86 ++ (void)showNaviViewWithMessage:(NSString *_Nonnull)message
  87 +{
  88 + UIImageView *bgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, - 60, SCREEN_WIDTH, 60)];
  89 + bgView.backgroundColor = [UIColor cyanColor];
  90 + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 25, SCREEN_WIDTH - 20, 30)];
  91 + label.text = message;
  92 + label.textAlignment = NSTextAlignmentCenter;
  93 + label.textColor = [UIColor whiteColor];
  94 + [bgView addSubview:label];
  95 + [[UIApplication sharedApplication].keyWindow addSubview:bgView];
  96 +
  97 + [UIView animateWithDuration:0.5 animations:^{
  98 + bgView.top = 0;
  99 + } completion:^(BOOL finished) {
  100 + NSTimer *timer = [NSTimer timerWithTimeInterval:3 repeats:NO block:^(NSTimer * _Nonnull timer) {
  101 + [UIView animateWithDuration:0.5 animations:^{
  102 + bgView.top = - 60;
  103 + } completion:^(BOOL finished) {
  104 + [bgView removeFromSuperview];
  105 + }];
  106 + }];
  107 + [[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
  108 + }];
  109 +}
  110 +
  111 +
86 /** 112 /**
87 把字典转换成格式化的JSON格式的字符串 113 把字典转换成格式化的JSON格式的字符串
88 114
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/AnimationBaseView.m
@@ -7,14 +7,14 @@ @@ -7,14 +7,14 @@
7 // 7 //
8 8
9 #import "AnimationBaseView.h" 9 #import "AnimationBaseView.h"
10 -#import "ChatBarrageView.h" 10 +
11 11
12 @implementation AnimationBaseView 12 @implementation AnimationBaseView
13 13
14 - (instancetype)initWithFrame:(CGRect)frame 14 - (instancetype)initWithFrame:(CGRect)frame
15 { 15 {
16 if (self = [super initWithFrame:frame]) { 16 if (self = [super initWithFrame:frame]) {
17 - self.backgroundColor = [UIColor redColor]; 17 +
18 self.clipsToBounds = YES; 18 self.clipsToBounds = YES;
19 } 19 }
20 return self; 20 return self;
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/BounceView.m
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 8
9 #import "BounceView.h" 9 #import "BounceView.h"
10 #import "userInfoModel.h" 10 #import "userInfoModel.h"
  11 +#import "LiveBaseView.h"
11 12
12 @interface BounceView () 13 @interface BounceView ()
13 14
@@ -60,21 +61,24 @@ @@ -60,21 +61,24 @@
60 - (void)closeClick 61 - (void)closeClick
61 { 62 {
62 [Tools closeBouces]; 63 [Tools closeBouces];
  64 + [[LiveBaseView liveBaseView] bounceBtnType:BounceBtnTypeHome model:_model];
63 } 65 }
64 66
65 - (void)aiteHeBtnClick 67 - (void)aiteHeBtnClick
66 { 68 {
67 - NSLog(@"aiteHeBtnClick"); 69 + [Tools closeBouces];
  70 + [[LiveBaseView liveBaseView] bounceBtnType:BounceBtnTypeAite model:_model];
68 } 71 }
69 72
70 - (void)privateChatClick 73 - (void)privateChatClick
71 { 74 {
72 - NSLog(@"privateChatClick"); 75 + [Tools closeBouces];
  76 + [[LiveBaseView liveBaseView] bounceBtnType:BounceBtnTypePriChat model:_model];
73 } 77 }
74 78
75 - (void)homeBtnClick 79 - (void)homeBtnClick
76 { 80 {
77 - NSLog(@"homeBtnClick"); 81 + [Tools closeBouces];
78 } 82 }
79 83
80 - (UIImageView *)icon 84 - (UIImageView *)icon
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Chat/BarrageManager/BarrageManager.h deleted 100644 → 0
1 -//  
2 -// BarrageManager.h  
3 -// LiveVideoCloud  
4 -//  
5 -// Created by 张旭 on 2017/3/24.  
6 -// Copyright © 2017年 cnlive. All rights reserved.  
7 -//  
8 -  
9 -#import <Foundation/Foundation.h>  
10 -@class chatMsgModel;  
11 -@class ChatBarrageView;  
12 -#import "AnimationBaseView.h"  
13 -@interface BarrageManager : NSObject <TouchPointDelegate>  
14 -  
15 -/**  
16 - 初始化管理类  
17 - @return 当前manager  
18 - */  
19 -+ (instancetype)sharedManager;  
20 -  
21 -- (ChatBarrageView *)addAnimationWithModel:(chatMsgModel *)model animContentView:(UIView *)animContentView;  
22 -  
23 -@end  
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Chat/BarrageManager/BarrageManager.m deleted 100644 → 0
1 -//  
2 -// BarrageManager.m  
3 -// LiveVideoCloud  
4 -//  
5 -// Created by 张旭 on 2017/3/24.  
6 -// Copyright © 2017年 cnlive. All rights reserved.  
7 -//  
8 -  
9 -#import "BarrageManager.h"  
10 -#import "chatMsgModel.h"  
11 -#import "ChatBarrageView.h"  
12 -  
13 -@interface BarrageManager ()<CAAnimationDelegate>  
14 -  
15 -@property (nonatomic ,strong) NSTimer * _Nullable timer;  
16 -@property (nonatomic ,strong) ChatBarrageView *_Nullable barrageView;  
17 -@property (nonatomic ,strong) AnimationBaseView * _Nullable animBaseView;  
18 -@property (nonatomic ,assign) CGRect barrCurrentRect;  
19 -  
20 -@end  
21 -@implementation BarrageManager  
22 -  
23 -/**  
24 - 初始化管理类  
25 - @return 当前manager  
26 - */  
27 -+ (instancetype)sharedManager{  
28 -  
29 - static BarrageManager *manager;  
30 -  
31 - static dispatch_once_t onceToken;  
32 - dispatch_once(&onceToken, ^{  
33 - manager = [[BarrageManager alloc] init];  
34 - });  
35 - return manager;  
36 -}  
37 -  
38 -//- (AnimationBaseView *)animBaseView  
39 -//{  
40 -// if (!_animBaseView)  
41 -// {  
42 -// _animBaseView = [[AnimationBaseView alloc] init];  
43 -// }  
44 -// return _animBaseView;  
45 -//}  
46 -  
47 -/**  
48 - 根据实际model添加动画  
49 -  
50 - @param model modelobj  
51 - */  
52 -- (ChatBarrageView *)addAnimationWithModel:(chatMsgModel *)model animContentView:(UIView *)animContentView  
53 -{  
54 - ChatBarrageView *barrageView = [ChatBarrageView barrageViewWithPoint:CGPointMake(SCREEN_WIDTH + 50, 100)];  
55 - barrageView.backgroundColor = [UIColor blackColor];  
56 - [animContentView addSubview:barrageView];  
57 - self.barrageView = barrageView;  
58 - self.animBaseView = (AnimationBaseView *)animContentView;  
59 -  
60 - barrageView.model = model;  
61 -  
62 - [self animationWithDuration:8  
63 - YValues:@[ @(SCREEN_WIDTH + 50), @(-(200))]  
64 - keyTimes:@[@0.0, @1.0]  
65 - timingFunctions:@[  
66 - [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear],  
67 - ]  
68 - addView:barrageView];  
69 - [self createTimer];  
70 - self.animBaseView.isBarrage = YES;  
71 -  
72 -// [UIView animateWithDuration:10 animations:^{  
73 -//  
74 -// barrageView.left = - 200;  
75 -// } completion:^(BOOL finished) {  
76 -// [self stopTimer];  
77 -// [barrageView removeFromSuperview];  
78 -// NSLog(@"finished");  
79 -// }];  
80 - return barrageView;  
81 -}  
82 -  
83 -// 实时监测 ,也可以用循环定时器  
84 -- (void)createTimer{  
85 - if (!self.timer) {  
86 - self.timer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(jianCe) userInfo:nil repeats:YES];  
87 - }  
88 -}  
89 -- (void) jianCe{  
90 - CGRect rect = [[self.barrageView.layer presentationLayer ]frame]; // view指动画中移动的view  
91 - self.barrCurrentRect = rect;  
92 -// NSLog(@"箭%@",NSStringFromCGRect(rect));  
93 -}  
94 -  
95 -- (void)stopTimer  
96 -{  
97 - if(self.timer)  
98 - {  
99 - [self.timer invalidate];  
100 - self.timer = nil;  
101 - }  
102 -}  
103 -  
104 -#pragma mark - touchPointDelegate  
105 -- (void)touchPoint:(CGPoint)touchPoint  
106 -{  
107 - CGFloat dxLeft = touchPoint.x - self.barrCurrentRect.origin.x;// >0  
108 - CGFloat dxRight = touchPoint.x - self.barrCurrentRect.origin.x - self.barrCurrentRect.size.width;// < 0  
109 - CGFloat dyLeft = touchPoint.y - self.barrCurrentRect.origin.y;// >0  
110 - CGFloat dyRight = touchPoint.y - self.barrCurrentRect.origin.y - self.barrCurrentRect.size.height;// <0  
111 -  
112 - if (dxLeft > 0 && dxRight < 0 && dyLeft > 0 && dyRight < 0) {  
113 - //在当前矩形区域内  
114 -// NSLog(@"在当前矩形区域内");  
115 - [self.barrageView barrageViewClickWithModel:self.barrageView.model];  
116 - }else  
117 - {  
118 -// NSLog(@"不在当前矩形区域内");  
119 - }  
120 -}  
121 -  
122 -- (void)animationWithDuration:(float)duration YValues:(NSArray *)YValues keyTimes:(NSArray *)keyTimes timingFunctions:(NSArray *)timingFunctions addView:(UIView *)addView{  
123 - CAKeyframeAnimation *rocketAnim = [CAKeyframeAnimation animation];  
124 - rocketAnim.keyPath = @"position.x";  
125 - rocketAnim.values = YValues;  
126 - rocketAnim.keyTimes = keyTimes;  
127 - rocketAnim.timingFunctions = timingFunctions;  
128 - rocketAnim.duration = duration;  
129 - rocketAnim.fillMode = kCAFillModeForwards;  
130 - rocketAnim.removedOnCompletion = NO;  
131 - rocketAnim.delegate = self;  
132 - [addView.layer addAnimation:rocketAnim forKey:@"positionY"];  
133 -}  
134 -  
135 -- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag{  
136 - NSLog(@"didStop");  
137 - [self stopTimer];  
138 - [self.barrageView removeFromSuperview];  
139 - self.animBaseView.isBarrage = NO;  
140 -}  
141 -@end  
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Chat/ChatBarrageManager/ChatBarrageView.h
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 8
9 #import "ChatBarrageAnimAction.h" 9 #import "ChatBarrageAnimAction.h"
10 10
  11 +
11 @class AnimationBaseView; 12 @class AnimationBaseView;
12 @class chatMsgModel; 13 @class chatMsgModel;
13 @interface ChatBarrageView : ChatBarrageAnimAction 14 @interface ChatBarrageView : ChatBarrageAnimAction
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Chat/ChatMsgModel/chatMsgModel.h
@@ -21,4 +21,9 @@ @@ -21,4 +21,9 @@
21 @property (nonatomic) BOOL isMine;//消息是否是自己发送 21 @property (nonatomic) BOOL isMine;//消息是否是自己发送
22 @property (nonatomic ,copy) NSString * _Nullable ID;//唯一标识 22 @property (nonatomic ,copy) NSString * _Nullable ID;//唯一标识
23 23
  24 +/////
  25 +@property (nonatomic ,assign) CGFloat priCellHeight;
  26 +@property (nonatomic ,assign) CGFloat priCellWidth;
  27 +
  28 +
24 @end 29 @end
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Chat/ChatMsgModel/chatMsgModel.m
@@ -22,11 +22,29 @@ @@ -22,11 +22,29 @@
22 //文字 22 //文字
23 CGFloat textMaxW = self.cellWidth; 23 CGFloat textMaxW = self.cellWidth;
24 CGSize textMaxSize = CGSizeMake(textMaxW, MAXFLOAT); 24 CGSize textMaxSize = CGSizeMake(textMaxW, MAXFLOAT);
25 - CGSize textSize = [content boundingRectWithSize:textMaxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:14]} context:nil].size; 25 + CGSize textSize = [content boundingRectWithSize:textMaxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:kContentFont]} context:nil].size;
26 26
27 //底部空隙 27 //底部空隙
28 _cellHeight += textSize.height + ChatCellMargin; 28 _cellHeight += textSize.height + ChatCellMargin;
29 // NSLog(@"cellHeight = %f",_cellHeight); 29 // NSLog(@"cellHeight = %f",_cellHeight);
30 return _cellHeight; 30 return _cellHeight;
31 } 31 }
  32 +
  33 +- (CGFloat)priCellHeight
  34 +{
  35 + //如果计算过高度,直接返回
  36 + if (_priCellHeight) return _priCellHeight;
  37 +
  38 + _priCellHeight = 10;
  39 + NSString *content = self.content;
  40 + //文字
  41 + CGFloat textMaxW = self.priCellWidth;
  42 + CGSize textMaxSize = CGSizeMake(textMaxW, MAXFLOAT);
  43 + CGSize textSize = [content boundingRectWithSize:textMaxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:kContentFont]} context:nil].size;
  44 +
  45 + //底部空隙
  46 + _priCellHeight += textSize.height + 10;
  47 +// NSLog(@"pricellHeight = %f",_priCellHeight);
  48 + return _priCellHeight;
  49 +}
32 @end 50 @end
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftViews/GiftListView.m
@@ -111,6 +111,7 @@ @@ -111,6 +111,7 @@
111 - (void)sendClick 111 - (void)sendClick
112 { 112 {
113 NSLog(@"sendClick"); 113 NSLog(@"sendClick");
  114 + [Tools showNaviViewWithMessage:@"请先充值钻石哦"];
114 } 115 }
115 116
116 - (void)payClick 117 - (void)payClick
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/LVCInteractionController.m
@@ -32,7 +32,7 @@ @@ -32,7 +32,7 @@
32 { 32 {
33 if (!_liveBaseView) 33 if (!_liveBaseView)
34 { 34 {
35 - _liveBaseView = [[LiveBaseView alloc] initWithFrame:SCREEN_RECT]; 35 + _liveBaseView = [LiveBaseView liveBaseView];
36 _liveBaseView.viewController = self; 36 _liveBaseView.viewController = self;
37 _liveBaseView.backgroundColor = [UIColor clearColor]; 37 _liveBaseView.backgroundColor = [UIColor clearColor];
38 } 38 }
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/LiveBaseView.h
@@ -9,9 +9,25 @@ @@ -9,9 +9,25 @@
9 #import "BaseView.h" 9 #import "BaseView.h"
10 @class PresentView; 10 @class PresentView;
11 @class AnimationBaseView; 11 @class AnimationBaseView;
  12 +
  13 +typedef NS_ENUM(NSInteger, BounceBtnType) {//弹窗按钮类型
  14 + BounceBtnTypeAite = 1,//@TA按钮点击
  15 + BounceBtnTypePriChat ,//私聊按钮点击
  16 + BounceBtnTypeHome ,//主页按钮点击
  17 +};
  18 +
  19 +typedef NS_ENUM(NSInteger, JumpControllerType) {//跳转控制器类型
  20 + JumpControllerTypePresent = 1,//present
  21 + JumpControllerTypePush //push
  22 +};
12 @interface LiveBaseView : BaseView 23 @interface LiveBaseView : BaseView
13 24
  25 +@property (nonatomic) JumpControllerType jumpType;
14 @property (nonatomic ,strong) UIViewController * _Nullable viewController; 26 @property (nonatomic ,strong) UIViewController * _Nullable viewController;
15 @property (nonatomic ,strong ,readonly) PresentView * _Nullable presentView; 27 @property (nonatomic ,strong ,readonly) PresentView * _Nullable presentView;
16 @property (nonatomic ,strong ,readonly) AnimationBaseView * _Nullable animationBaseView; 28 @property (nonatomic ,strong ,readonly) AnimationBaseView * _Nullable animationBaseView;
  29 +
  30 ++ (instancetype _Nullable)liveBaseView;
  31 +
  32 +- (void)bounceBtnType:(BounceBtnType)btnType model:(userInfoModel *_Nonnull)model;
17 @end 33 @end
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/LiveBaseView.m
@@ -20,7 +20,6 @@ @@ -20,7 +20,6 @@
20 #import "ChatBarrageManager.h" 20 #import "ChatBarrageManager.h"
21 #import "userInfoModel.h" 21 #import "userInfoModel.h"
22 #import "PrivateView.h" 22 #import "PrivateView.h"
23 -//#import "BarrageManager.h"  
24 #import "ChatBarrageView.h" 23 #import "ChatBarrageView.h"
25 #import "AnimationBaseView.h" 24 #import "AnimationBaseView.h"
26 25
@@ -35,7 +34,7 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 @@ -35,7 +34,7 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型
35 PopTypePriMessage //私信弹窗 34 PopTypePriMessage //私信弹窗
36 }; 35 };
37 36
38 -@interface LiveBaseView ()<bottomBtnDeledate,PresentViewDelegate,UIScrollViewDelegate,UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate,userClickDelegate,CNLiveChatManagerDelegate> 37 +@interface LiveBaseView ()<bottomBtnDeledate,PresentViewDelegate,UIScrollViewDelegate,UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate,userClickDelegate,CNLiveChatManagerDelegate,PopViewDelegate>
39 38
40 @property (nonatomic ,strong ) UIScrollView * _Nullable scrollView; 39 @property (nonatomic ,strong ) UIScrollView * _Nullable scrollView;
41 @property (nonatomic ,strong ,readwrite) AnimationBaseView * _Nullable animationBaseView;//展示层View 40 @property (nonatomic ,strong ,readwrite) AnimationBaseView * _Nullable animationBaseView;//展示层View
@@ -53,14 +52,23 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 @@ -53,14 +52,23 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型
53 @property (nonatomic ,assign ) CGFloat offsetHeight; 52 @property (nonatomic ,assign ) CGFloat offsetHeight;
54 @property (nonatomic ,strong ) UISwitch * _Nullable barrageSwitch; 53 @property (nonatomic ,strong ) UISwitch * _Nullable barrageSwitch;
55 @property (nonatomic ,strong ) ChatBarrageManager * _Nullable chatManager; 54 @property (nonatomic ,strong ) ChatBarrageManager * _Nullable chatManager;
56 -//@property (nonatomic ,strong ) BarrageManager * _Nullable barrManager;  
57 -  
58 -@property (nonatomic ,strong) ChatBarrageView * _Nullable barrageView; 55 +@property (nonatomic ,strong ) ChatBarrageView * _Nullable barrageView;
59 56
60 @end 57 @end
61 58
62 @implementation LiveBaseView 59 @implementation LiveBaseView
63 60
  61 ++ (instancetype _Nullable)liveBaseView
  62 +{
  63 + static LiveBaseView *liveBaseView;
  64 +
  65 + static dispatch_once_t onceToken;
  66 + dispatch_once(&onceToken, ^{
  67 + liveBaseView = [[LiveBaseView alloc] initWithFrame:SCREEN_RECT];
  68 + });
  69 + return liveBaseView;
  70 +}
  71 +
64 - (instancetype)initWithFrame:(CGRect)frame 72 - (instancetype)initWithFrame:(CGRect)frame
65 { 73 {
66 if (self = [super initWithFrame:frame]) { 74 if (self = [super initWithFrame:frame]) {
@@ -94,23 +102,35 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 @@ -94,23 +102,35 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型
94 return self; 102 return self;
95 } 103 }
96 104
  105 +- (void)dealloc
  106 +{
  107 + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
  108 + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil];
  109 +}
  110 +
97 - (void)keyboardWillShow:(NSNotification *)notify { 111 - (void)keyboardWillShow:(NSNotification *)notify {
98 -  
99 - NSDictionary *userInfo = notify.userInfo;  
100 - CGRect newFrameKeyboard = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];//变化前的frame  
101 - [UIView animateWithDuration:0.25 animations:^{  
102 - self.animationBaseView.top = - newFrameKeyboard.size.height + self.bottomToolView.height;  
103 - }];  
104 - self.bottomToolView.hidden = YES; 112 + NSString *class = [[NSUserDefaults standardUserDefaults] objectForKey:keyboard];
  113 + if ([class isEqualToString:NSStringFromClass([self class])])
  114 + {
  115 + NSDictionary *userInfo = notify.userInfo;
  116 + CGRect newFrameKeyboard = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];//变化前的frame
  117 + [UIView animateWithDuration:0.25 animations:^{
  118 + self.animationBaseView.top = - newFrameKeyboard.size.height + self.bottomToolView.height;
  119 + }];
  120 + self.bottomToolView.hidden = YES;
  121 + }
105 } 122 }
106 123
107 - (void)keyboardWillHidden:(NSNotification *)notify { 124 - (void)keyboardWillHidden:(NSNotification *)notify {
108 -  
109 - [UIView animateWithDuration:0.1 animations:^{  
110 - self.animationBaseView.top = 0;  
111 - [self.animationBaseView setNeedsDisplay];  
112 - }];  
113 - self.bottomToolView.hidden = NO; 125 + NSString *class = [[NSUserDefaults standardUserDefaults] objectForKey:keyboard];
  126 + if ([class isEqualToString:NSStringFromClass([self class])])
  127 + {
  128 + [UIView animateWithDuration:0.1 animations:^{
  129 + self.animationBaseView.top = 0;
  130 + [self.animationBaseView setNeedsDisplay];
  131 + }];
  132 + self.bottomToolView.hidden = NO;
  133 + }
114 } 134 }
115 135
116 - (void)createCommentsView { 136 - (void)createCommentsView {
@@ -211,9 +231,34 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 @@ -211,9 +231,34 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型
211 textField.text = @""; 231 textField.text = @"";
212 } 232 }
213 [textField resignFirstResponder]; 233 [textField resignFirstResponder];
  234 +
214 return YES; 235 return YES;
215 } 236 }
216 237
  238 +- (void)bounceBtnType:(BounceBtnType)btnType model:(userInfoModel *_Nonnull)model
  239 +{
  240 + switch (btnType) {
  241 + case BounceBtnTypeAite:
  242 + {
  243 + [self bottomActionWithType:BtnClickTypeChat button:nil];
  244 + _commentText.text = [NSString stringWithFormat:@"@%@ ",model.name];
  245 + }
  246 + break;
  247 + case BounceBtnTypePriChat:
  248 + {
  249 + [self bottomActionWithType:BtnClickTypePriChat button:nil];
  250 + }
  251 + break;
  252 + case BounceBtnTypeHome:
  253 + {
  254 +
  255 + }
  256 + break;
  257 + default:
  258 + break;
  259 + }
  260 +}
  261 +
217 #pragma mark - bottomBtnActionDelegate 262 #pragma mark - bottomBtnActionDelegate
218 - (void)bottomActionWithType:(BtnClickType)btnType button:(UIButton *)button 263 - (void)bottomActionWithType:(BtnClickType)btnType button:(UIButton *)button
219 { 264 {
@@ -223,7 +268,8 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 @@ -223,7 +268,8 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型
223 case BtnClickTypeChat: 268 case BtnClickTypeChat:
224 { 269 {
225 self.popType = PopTypeChat; 270 self.popType = PopTypeChat;
226 - 271 + [[NSUserDefaults standardUserDefaults] setObject:NSStringFromClass([self class]) forKey:keyboard];
  272 + [[NSUserDefaults standardUserDefaults] synchronize];
227 [self showCommentText]; 273 [self showCommentText];
228 } 274 }
229 break; 275 break;
@@ -232,6 +278,8 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 @@ -232,6 +278,8 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型
232 self.popType = PopTypePriMessage; 278 self.popType = PopTypePriMessage;
233 [self hiddenView:YES]; 279 [self hiddenView:YES];
234 [self showPrivateView]; 280 [self showPrivateView];
  281 + [[NSUserDefaults standardUserDefaults] setObject:NSStringFromClass([PrivateView class]) forKey:keyboard];
  282 + [[NSUserDefaults standardUserDefaults] synchronize];
235 } 283 }
236 break; 284 break;
237 case BtnClickTypeGift: 285 case BtnClickTypeGift:
@@ -251,9 +299,15 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 @@ -251,9 +299,15 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型
251 - (void)showPrivateView 299 - (void)showPrivateView
252 { 300 {
253 PrivateView *privateView = [PrivateView privateView]; 301 PrivateView *privateView = [PrivateView privateView];
254 - privateView.backgroundColor = [UIColor yellowColor]; 302 + privateView.backgroundColor = [UIColor whiteColor];
255 [self addSubview:privateView]; 303 [self addSubview:privateView];
  304 + privateView.delegate = self;
256 self.giftPopView = privateView; 305 self.giftPopView = privateView;
  306 + [UIView animateWithDuration:0.5 animations:^{
  307 + privateView.top -= 300;
  308 + } completion:^(BOOL finished) {
  309 +
  310 + }];
257 } 311 }
258 312
259 - (void)hiddenView:(BOOL)isHidden 313 - (void)hiddenView:(BOOL)isHidden
@@ -288,12 +342,21 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 @@ -288,12 +342,21 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型
288 break; 342 break;
289 case PopTypePriMessage: 343 case PopTypePriMessage:
290 { 344 {
291 - [UIView animateWithDuration:0.25 animations:^{  
292 -  
293 - self.giftPopView.frame = CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT);  
294 - [self hiddenView:NO];  
295 - } completion:^(BOOL finished) {  
296 - }]; 345 + if (((PrivateView *)self.giftPopView).isEditing) {
  346 + //正在编辑
  347 + [(PrivateView *)self.giftPopView endCurrentEditing];
  348 +
  349 + }else//已结束编辑
  350 + {
  351 + [UIView animateWithDuration:0.25 animations:^{
  352 +
  353 + self.giftPopView.frame = CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, 300);
  354 + [self hiddenView:NO];
  355 + } completion:^(BOOL finished) {
  356 +
  357 + [self.giftPopView removeFromSuperview];
  358 + }];
  359 + }
297 } 360 }
298 break; 361 break;
299 default: 362 default:
@@ -301,7 +364,6 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 @@ -301,7 +364,6 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型
301 } 364 }
302 } 365 }
303 366
304 -  
305 #pragma mark - buttonClick触摸屏幕关闭方法 367 #pragma mark - buttonClick触摸屏幕关闭方法
306 - (void)tapGestureClick:(UITapGestureRecognizer *)gesture 368 - (void)tapGestureClick:(UITapGestureRecognizer *)gesture
307 { 369 {
@@ -312,7 +374,20 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 @@ -312,7 +374,20 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型
312 374
313 - (void)closeAction 375 - (void)closeAction
314 { 376 {
315 - [self.viewController.navigationController popViewControllerAnimated:YES]; 377 + switch (self.jumpType) {
  378 + case JumpControllerTypePresent:
  379 + {
  380 + [self.viewController dismissViewControllerAnimated:YES completion:nil];
  381 + }
  382 + break;
  383 + case JumpControllerTypePush:
  384 + {
  385 + [self.viewController.navigationController popViewControllerAnimated:YES];
  386 + }
  387 + break;
  388 + default:
  389 + break;
  390 + }
316 } 391 }
317 392
318 - (void)sendClick 393 - (void)sendClick
@@ -345,6 +420,12 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 @@ -345,6 +420,12 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型
345 }]; 420 }];
346 } 421 }
347 422
  423 +#pragma mark - PriClosePopViewDelegate
  424 +- (void)closeCurrentPopView
  425 +{
  426 + [self clearCurrentPopView];
  427 +}
  428 +
348 #pragma mark - CNLiveChatManagerDelegate 429 #pragma mark - CNLiveChatManagerDelegate
349 /** 430 /**
350 连接状态的的监听器 431 连接状态的的监听器
@@ -387,40 +468,70 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 @@ -387,40 +468,70 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型
387 - (void)onReceived:(CNLiveChatMessage *)message 468 - (void)onReceived:(CNLiveChatMessage *)message
388 { 469 {
389 // NSLog(@"onReceived"); 470 // NSLog(@"onReceived");
390 - NSDictionary *JSONDic = [Tools dictionaryWithJsonString:message.messageContent];  
391 - NSString *content = [JSONDic objectForKey:message_content];  
392 -  
393 - //将消息显示到列表中  
394 - chatMsgModel *model = [[chatMsgModel alloc] init];  
395 - model.name = message.userInfo.name;  
396 - model.content = content;  
397 - model.ID = message.targetId;  
398 - model.icon = message.userInfo.portraitUri;  
399 - model.cellWidth = self.chatTableView.width - 20;  
400 - [self.chatMsgArray addObject:model];  
401 - [self.chatTableView reloadData];  
402 -  
403 - NSInteger section = [self.chatTableView numberOfSections];  
404 - if (section < 1) return;  
405 - NSInteger row = [self.chatTableView numberOfRowsInSection:section - 1];  
406 - if (row < 1) return;  
407 - NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row - 1 inSection:section - 1];  
408 - [self.chatTableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES];  
409 - [self.chatTableView reloadData];  
410 -  
411 - NSInteger isBarrage = [[JSONDic objectForKey:message_barrage] integerValue];  
412 -  
413 - if (isBarrage) {//此条消息飘弹幕  
414 -  
415 - chatMsgModel *barrageModel = [[chatMsgModel alloc] init];  
416 - barrageModel.name = message.userInfo.name;  
417 - barrageModel.content = content;  
418 - barrageModel.icon = message.userInfo.portraitUri;  
419 -// self.barrageView = [self.barrManager addAnimationWithModel:barrageModel animContentView:self.animationBaseView];  
420 - [self.chatManager addAnimationWithModel:barrageModel animContentView:self.animationBaseView];//self.barrageView = 471 + switch (message.conversationType) {
  472 + case CNLive_ConversationType_CHATROOM:
  473 + {
  474 + NSDictionary *JSONDic = [Tools dictionaryWithJsonString:message.messageContent];
  475 + NSString *content = [JSONDic objectForKey:message_content];
  476 +
  477 + //将消息显示到列表中
  478 + chatMsgModel *model = [[chatMsgModel alloc] init];
  479 + model.name = message.userInfo.name;
  480 + model.content = content;
  481 + model.ID = message.targetId;
  482 + model.icon = message.userInfo.portraitUri;
  483 + model.cellWidth = self.chatTableView.width - 20;
  484 + [self.chatMsgArray addObject:model];
  485 + [self.chatTableView reloadData];
  486 +
  487 + NSInteger section = [self.chatTableView numberOfSections];
  488 + if (section < 1) return;
  489 + NSInteger row = [self.chatTableView numberOfRowsInSection:section - 1];
  490 + if (row < 1) return;
  491 + NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row - 1 inSection:section - 1];
  492 + [self.chatTableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES];
  493 + [self.chatTableView reloadData];
  494 +
  495 + NSInteger isBarrage = [[JSONDic objectForKey:message_barrage] integerValue];
  496 +
  497 + if (isBarrage) {//此条消息飘弹幕
  498 +
  499 + chatMsgModel *barrageModel = [[chatMsgModel alloc] init];
  500 + barrageModel.name = message.userInfo.name;
  501 + barrageModel.content = content;
  502 + barrageModel.icon = message.userInfo.portraitUri;
  503 + [self.chatManager addAnimationWithModel:barrageModel animContentView:self.animationBaseView];
  504 + }
  505 + }
  506 + break;
  507 + case CNLive_ConversationType_PRIVATE:
  508 + {
  509 + NSDictionary *JSONDic = [Tools dictionaryWithJsonString:message.messageContent];
  510 + NSString *content = [JSONDic objectForKey:message_content];
  511 + PrivateView *privateView = [PrivateView privateView];
421 512
422 - self.animationBaseView.delegate = self.chatManager;  
423 -// self.animationBaseView.barrageView = self.barrageView; 513 + //将消息显示到列表中
  514 + chatMsgModel *model = [[chatMsgModel alloc] init];
  515 + model.name = message.userInfo.name;
  516 + model.isMine = NO;
  517 + model.content = content;
  518 + model.ID = message.targetId;
  519 + model.icon = message.userInfo.portraitUri;
  520 + model.priCellWidth = privateView.tableView.width * 0.5 - 30;
  521 + [privateView.chatArray addObject:model];
  522 + [privateView.tableView reloadData];
  523 +
  524 + NSInteger section = [privateView.tableView numberOfSections];
  525 + if (section < 1) return;
  526 + NSInteger row = [privateView.tableView numberOfRowsInSection:section - 1];
  527 + if (row < 1) return;
  528 + NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row - 1 inSection:section - 1];
  529 + [privateView.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES];
  530 + [privateView.tableView reloadData];
  531 + }
  532 + break;
  533 + default:
  534 + break;
424 } 535 }
425 } 536 }
426 537
@@ -558,8 +669,7 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 @@ -558,8 +669,7 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型
558 { 669 {
559 if (!_topToolsView) 670 if (!_topToolsView)
560 { 671 {
561 - _topToolsView = [[TopToolView alloc] initWithFrame:CGRectMake(10, 20, 150, 30)];  
562 - _topToolsView.backgroundColor = ZXRandomColor; 672 + _topToolsView = [[TopToolView alloc] initWithFrame:CGRectMake(10, 20, 100, 30) isHost:NO];
563 } 673 }
564 return _topToolsView; 674 return _topToolsView;
565 } 675 }
@@ -575,7 +685,6 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 @@ -575,7 +685,6 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型
575 tableView.showsHorizontalScrollIndicator = NO; 685 tableView.showsHorizontalScrollIndicator = NO;
576 tableView.bounces = NO; 686 tableView.bounces = NO;
577 tableView.backgroundColor = [UIColor clearColor]; 687 tableView.backgroundColor = [UIColor clearColor];
578 - tableView.separatorStyle = UITableViewCellSeparatorStyleNone;  
579 _chatTableView = tableView; 688 _chatTableView = tableView;
580 } 689 }
581 return _chatTableView; 690 return _chatTableView;
@@ -629,14 +738,6 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 @@ -629,14 +738,6 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型
629 return _giftListView; 738 return _giftListView;
630 } 739 }
631 740
632 -//- (BarrageManager *)barrManager  
633 -//{  
634 -// if (!_barrManager)  
635 -// {  
636 -// _barrManager = [BarrageManager sharedManager];  
637 -// }  
638 -// return _barrManager;  
639 -//}  
640 - (ChatBarrageManager *)chatManager 741 - (ChatBarrageManager *)chatManager
641 { 742 {
642 if (!_chatManager) 743 if (!_chatManager)
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/PrivateView/PriChatCell.h 0 → 100644
  1 +//
  2 +// PriChatCell.h
  3 +// LiveVideoCloud
  4 +//
  5 +// Created by 张旭 on 2017/3/27.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "BaseTableViewCell.h"
  10 +
  11 +@class chatMsgModel;
  12 +@interface PriChatCell : BaseTableViewCell
  13 +
  14 +@end
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/PrivateView/PriChatCell.m 0 → 100644
  1 +//
  2 +// PriChatCell.m
  3 +// LiveVideoCloud
  4 +//
  5 +// Created by 张旭 on 2017/3/27.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "PriChatCell.h"
  10 +#import "chatMsgModel.h"
  11 +
  12 +#define CHAT_POP_WIDTH 260
  13 +
  14 +@interface PriChatCell ()
  15 +
  16 +@property (nonatomic ,strong) chatMsgModel * _Nullable model;
  17 +@property (nonatomic ,strong) UIImageView * _Nullable icon;
  18 +@property (nonatomic ,strong) UILabel * _Nullable content;
  19 +
  20 +@end
  21 +
  22 +@implementation PriChatCell
  23 +
  24 +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  25 +{
  26 + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  27 + if (self) {
  28 + self.backgroundColor = [UIColor clearColor];
  29 + self.selectionStyle = UITableViewCellSelectionStyleNone;
  30 + }
  31 + return self;
  32 +}
  33 +
  34 +- (void)loadUIWithModel:(chatMsgModel *)model
  35 +{
  36 + _model = model;
  37 + [self bindView];
  38 + [self.icon sd_setImageWithURL:[NSURL URLWithString:model.icon] placeholderImage:nil];
  39 + self.content.text = model.content;
  40 + CGSize size = [self.content labelSizeWithWidth:_model.priCellWidth];
  41 + if (_model.isMine) {
  42 + if (_model.priCellHeight < 37) {//1行 // 36.7
  43 +
  44 + self.content.frame = CGRectMake(self.width - 30 - size.width - 10, 2.5, size.width, size.height);//self.height - 5
  45 + self.content.textAlignment = NSTextAlignmentRight;
  46 + self.content.centerY = self.icon.centerY;
  47 + }else
  48 + {
  49 + self.content.frame = CGRectMake(self.width - 30 - size.width - 10, 10, size.width, size.height);//self.height - 5
  50 + self.content.textAlignment = NSTextAlignmentLeft;
  51 + }
  52 + }else
  53 + {
  54 + if (_model.priCellHeight < 37) {//1行
  55 + self.icon.frame = CGRectMake(5, 6, 25, 25);
  56 + self.icon.centerY = (self.height - 25)*0.5 + 12.5;//13.353516;
  57 + self.content.frame = CGRectMake(5 + 30 + 10, 2.5, size.width, size.height);//self.height - 5
  58 + self.content.textAlignment = NSTextAlignmentLeft;
  59 + self.content.centerY = self.icon.centerY;
  60 + }else
  61 + {
  62 + self.icon.frame = CGRectMake(5, 6, 25, 25);
  63 + self.icon.centerY = (self.height - 25)*0.5 + 12.5;//13.353516;
  64 + self.content.frame = CGRectMake(5 + 30 + 10, 10, size.width, size.height);//self.height - 5
  65 + self.content.textAlignment = NSTextAlignmentLeft;
  66 + }
  67 + }
  68 +}
  69 +
  70 +- (void)bindView
  71 +{
  72 + if (_model.isMine) {
  73 + self.icon.frame = CGRectMake(self.width - 30, 6, 25, 25);
  74 + NSLog(@"self.icon.centerY%f,%f",self.height * 0.5,_model.priCellHeight);//13.353516 21.707031 155.363281
  75 + self.icon.centerY = (self.height - 25)*0.5 + 12.5;//13.353516;
  76 + self.content.frame = CGRectMake(self.width - 30 - CHAT_POP_WIDTH, 2.5, CHAT_POP_WIDTH - 10, self.height - 5);
  77 + self.content.backgroundColor = [UIColor blueColorZX];
  78 +
  79 + }else{
  80 + self.icon.frame = CGRectMake(5, 6, 25, 25);
  81 + self.icon.centerY = (self.height - 25)*0.5 + 12.5;//13.353516;
  82 + self.content.frame = CGRectMake(5 + 30, 2.5, CHAT_POP_WIDTH, self.height - 5);
  83 + self.content.backgroundColor = [UIColor greenColor];
  84 + }
  85 +}
  86 +
  87 +#pragma mark - getter
  88 +- (UILabel * _Nullable)content
  89 +{
  90 + if (!_content)
  91 + {
  92 + _content = [[UILabel alloc] init];
  93 + _content.textAlignment = NSTextAlignmentLeft;
  94 + _content.textColor = [UIColor blackColor];
  95 + _content.numberOfLines = 0;
  96 + _content.font = [UIFont systemFontOfSize:kContentFont];
  97 + [self addSubview:_content];
  98 + }
  99 + return _content;
  100 +}
  101 +
  102 +- (UIImageView * _Nullable)icon
  103 +{
  104 + if (!_icon)
  105 + {
  106 + _icon = [[UIImageView alloc] init];
  107 + _icon.layer.masksToBounds = YES;
  108 + _icon.layer.cornerRadius = 15.f;
  109 + [self addSubview:_icon];
  110 + }
  111 + return _icon;
  112 +}
  113 +
  114 +- (void)awakeFromNib {
  115 + [super awakeFromNib];
  116 + // Initialization code
  117 +}
  118 +
  119 +- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  120 + [super setSelected:selected animated:animated];
  121 +
  122 + // Configure the view for the selected state
  123 +}
  124 +
  125 +@end
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/PrivateView/PrivateView.h
@@ -8,8 +8,24 @@ @@ -8,8 +8,24 @@
8 8
9 #import <UIKit/UIKit.h> 9 #import <UIKit/UIKit.h>
10 10
  11 +
  12 +@protocol PopViewDelegate <NSObject>
  13 +
  14 +- (void)closeCurrentPopView;
  15 +
  16 +@end
  17 +
11 @interface PrivateView : UIView 18 @interface PrivateView : UIView
12 19
13 -+ (instancetype)privateView; 20 ++ (instancetype _Nonnull)privateView;
  21 +
  22 +- (void)endCurrentEditing;
  23 +
  24 +@property (nonatomic ,assign) BOOL isEditing;
  25 +
  26 +@property (nonatomic ,strong) _Nonnull id <PopViewDelegate> delegate;
  27 +@property (nonatomic ,strong) UITableView * _Nullable tableView;
  28 +
  29 +@property (nonatomic ,strong) NSMutableArray * _Nullable chatArray;
14 30
15 @end 31 @end
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/PrivateView/PrivateView.m
@@ -7,13 +7,261 @@ @@ -7,13 +7,261 @@
7 // 7 //
8 8
9 #import "PrivateView.h" 9 #import "PrivateView.h"
  10 +#import "PriChatCell.h"
  11 +#import "chatMsgModel.h"
  12 +
  13 +@interface PrivateView ()<UITextFieldDelegate,UITableViewDelegate,UITableViewDataSource>
  14 +
  15 +@property (nonatomic ,strong) UILabel * _Nullable nameLbl;
  16 +@property (nonatomic ,strong) UIButton * _Nullable closeBtn;
  17 +
  18 +@property (nonatomic ,strong) UIImageView * _Nullable bottomTool;
  19 +@property (nonatomic ,strong) UIButton * _Nullable sendBtn;
  20 +@property (nonatomic ,strong) UITextField * _Nullable textField;
  21 +
  22 +@end
10 23
11 @implementation PrivateView 24 @implementation PrivateView
12 25
  26 +static NSString *message_content = @"message_content";
  27 +
13 + (instancetype)privateView 28 + (instancetype)privateView
14 { 29 {
15 - return [[PrivateView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT - 300, SCREEN_WIDTH, 300)]; 30 + static PrivateView *privateView;
  31 +
  32 + static dispatch_once_t onceToken;
  33 + dispatch_once(&onceToken, ^{
  34 + privateView = [[PrivateView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, 300)];
  35 + });
  36 + return privateView;
  37 +}
  38 +
  39 +- (instancetype)initWithFrame:(CGRect)frame
  40 +{
  41 + if (self = [super initWithFrame:frame]) {
  42 +
  43 + [self addSubview:self.tableView];
  44 + [self addSubview:self.nameLbl];
  45 + [self.bottomTool addSubview:self.sendBtn];
  46 + [self.bottomTool addSubview:self.textField];
  47 +
  48 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
  49 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHidden:) name:UIKeyboardWillHideNotification object:nil];
  50 + }
  51 + return self;
  52 +}
  53 +
  54 +- (void)closeAction
  55 +{
  56 + if ([self.delegate respondsToSelector:@selector(closeCurrentPopView)]) {
  57 + [self.delegate closeCurrentPopView];
  58 + }
  59 +}
  60 +
  61 +- (void)sendClick
  62 +{
  63 + [self textFieldShouldReturn:self.textField];
  64 +}
  65 +
  66 +- (void)dealloc
  67 +{
  68 + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
  69 + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil];
  70 +}
  71 +
  72 +- (void)keyboardWillShow:(NSNotification *)notify {
  73 +
  74 + NSString *class = [[NSUserDefaults standardUserDefaults] objectForKey:keyboard];
  75 + if ([class isEqualToString:NSStringFromClass([self class])])
  76 + {
  77 + NSDictionary *userInfo = notify.userInfo;
  78 + CGRect newFrameKeyboard = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];//变化前的frame
  79 + [UIView animateWithDuration:0.25 animations:^{
  80 + self.top = SCREEN_HEIGHT - newFrameKeyboard.size.height - self.height;
  81 + }];
  82 + self.isEditing = YES;
  83 + NSLog(@"showtop:%f",self.top);
  84 + }
  85 +}
  86 +
  87 +- (void)keyboardWillHidden:(NSNotification *)notify {
  88 + NSString *class = [[NSUserDefaults standardUserDefaults] objectForKey:keyboard];
  89 + if ([class isEqualToString:NSStringFromClass([self class])])
  90 + {
  91 + [UIView animateWithDuration:0.1 animations:^{
  92 + self.top = SCREEN_HEIGHT - 300;
  93 + }];
  94 + NSLog(@"hiddentop:%f",self.top);
  95 + self.isEditing = NO;
  96 + }
  97 +}
  98 +
  99 +#pragma mark - UITextFieldDelegate
  100 +- (BOOL)textFieldShouldReturn:(UITextField *)textField
  101 +{
  102 + if (![textField.text isEqualToString:@""]) {
  103 +
  104 + NSDictionary *dic = @{message_content:textField.text};
  105 + weakself
  106 + NSString *message = [Tools dictionaryToJson:dic];
  107 + [[CNLiveChatManager sharedCNLiveChatManager] sendMessage:message type:CNLive_ConversationType_PRIVATE targetId:@"20170327" success:^(CNLiveChatMessage *message) {
  108 +
  109 + dispatch_async(dispatch_get_main_queue(), ^{
  110 + strongself
  111 + NSDictionary *JSONDic = [Tools dictionaryWithJsonString:message.messageContent];
  112 + NSString *content = [JSONDic objectForKey:message_content];
  113 +
  114 + //将消息显示到列表中
  115 + chatMsgModel *model = [[chatMsgModel alloc] init];
  116 + model.name = message.userInfo.name;
  117 + model.isMine = YES;
  118 + model.content = content;
  119 + model.ID = message.targetId;
  120 + model.icon = message.userInfo.portraitUri;
  121 + model.priCellWidth = self.tableView.width * 0.5 - 30;
  122 + // model.sendTime;//发送时间
  123 + [self.chatArray addObject:model];
  124 + [self.tableView reloadData];
  125 +
  126 + NSInteger section = [self.tableView numberOfSections];
  127 + if (section < 1) return;
  128 + NSInteger row = [self.tableView numberOfRowsInSection:section - 1];
  129 + if (row < 1) return;
  130 + NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row - 1 inSection:section - 1];
  131 + [self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES];
  132 + [self.tableView reloadData];
  133 +
  134 + });
  135 + } error:^(CNLiveChatErrorCode errors, NSString *messageId, NSString *targetId) {
  136 + NSLog(@"%@",messageId);
  137 + }];
  138 +
  139 + textField.text = @"";
  140 + }
  141 + [textField resignFirstResponder];
  142 + return YES;
  143 +}
  144 +
  145 +- (void)endCurrentEditing
  146 +{
  147 + self.top = SCREEN_HEIGHT - 300;
  148 + [self.textField resignFirstResponder];
  149 +}
  150 +
  151 +#pragma mark - 私聊消息列表
  152 +#pragma mark - UITableViewDataSource
  153 +
  154 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  155 +{
  156 + return self.chatArray.count;
  157 +}
  158 +
  159 +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  160 +{
  161 + PriChatCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([PriChatCell class]) forIndexPath:indexPath];
  162 + [cell loadUIWithModel:self.chatArray[indexPath.row]];
  163 + return cell;
  164 +}
  165 +
  166 +#pragma mark - UITableViewDelegate
  167 +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  168 +{
  169 + return [self.chatArray[indexPath.row] priCellHeight];
16 } 170 }
  171 +
  172 +- (NSMutableArray *)chatArray
  173 +{
  174 + if (!_chatArray)
  175 + {
  176 + _chatArray = [[NSMutableArray alloc] init];
  177 + }
  178 + return _chatArray;
  179 +}
  180 +
  181 +- (UILabel *)nameLbl
  182 +{
  183 + if (!_nameLbl)
  184 + {
  185 + _nameLbl = [[UILabel alloc] initWithFrame:CGRectMake(100, 5, self.width - 100, 30)];
  186 + _nameLbl.centerX = self.width * 0.5;
  187 + _nameLbl.text = @"哈哈哈主播的名字";
  188 + [_nameLbl setTextColor:[UIColor cyanColor]];
  189 + _nameLbl.numberOfLines = 1;
  190 + _nameLbl.textAlignment = NSTextAlignmentCenter;
  191 + }
  192 + return _nameLbl;
  193 +}
  194 +
  195 +- (UIButton *)closeBtn
  196 +{
  197 + if (!_closeBtn)
  198 + {
  199 + UIButton *closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  200 + closeBtn.frame = CGRectMake(SCREEN_WIDTH - 41,10, 31, 30);
  201 + [closeBtn setImage:[UIImage imageNamed:@"close"] forState:UIControlStateNormal];
  202 + [closeBtn setImage:[UIImage imageNamed:@"close"] forState:UIControlStateHighlighted];
  203 + [closeBtn addTarget:self action:@selector(closeAction) forControlEvents:UIControlEventTouchUpInside];
  204 + _closeBtn = closeBtn;
  205 + [self addSubview:_closeBtn];
  206 +
  207 + }
  208 + return _closeBtn;
  209 +}
  210 +
  211 +- (UITableView *)tableView
  212 +{
  213 + if (!_tableView)
  214 + {
  215 + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.closeBtn.bottom + 10, self.width, self.height - self.closeBtn.bottom - 10 - self.bottomTool.height)];
  216 + [_tableView registerClass:[PriChatCell class] forCellReuseIdentifier:NSStringFromClass([PriChatCell class])];
  217 + _tableView.delegate = self;
  218 + _tableView.dataSource = self;
  219 + _tableView.showsVerticalScrollIndicator = NO;
  220 + _tableView.showsHorizontalScrollIndicator = NO;
  221 + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  222 + _tableView.bounces = NO;
  223 + _tableView.backgroundColor = [UIColor clearColor];
  224 + }
  225 + return _tableView;
  226 +}
  227 +
  228 +- (UIImageView *)bottomTool
  229 +{
  230 + if (!_bottomTool)
  231 + {
  232 + _bottomTool = [[UIImageView alloc] initWithFrame:CGRectMake(0, self.height - 40, self.width, 40)];
  233 + _bottomTool.image = [[UIImage imageNamed:@"priToolBg"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0) resizingMode:UIImageResizingModeStretch];
  234 + _bottomTool.userInteractionEnabled = YES;
  235 +
  236 + [self addSubview:_bottomTool];
  237 + }
  238 + return _bottomTool;
  239 +}
  240 +
  241 +- (UIButton *)sendBtn
  242 +{
  243 + if (!_sendBtn)
  244 + {
  245 + _sendBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.bottomTool.width - 60, 4, 60, self.bottomTool.height - 8)];
  246 + [_sendBtn setTitle:@"发送" forState:UIControlStateNormal];
  247 + [_sendBtn setTitleColor:[UIColor cyanColor] forState:UIControlStateNormal];
  248 + [_sendBtn addTarget:self action:@selector(sendClick) forControlEvents:UIControlEventTouchUpInside];
  249 + }
  250 + return _sendBtn;
  251 +}
  252 +
  253 +- (UITextField *)textField
  254 +{
  255 + if (!_textField)
  256 + {
  257 + _textField = [[UITextField alloc] initWithFrame:CGRectMake(4, 4, self.bottomTool.width - self.sendBtn.width - 8, self.bottomTool.height - 8)];
  258 + _textField.borderStyle = UITextBorderStyleLine;
  259 + _textField.returnKeyType = UIReturnKeySend;
  260 + _textField.delegate = self;
  261 + }
  262 + return _textField;
  263 +}
  264 +
17 /* 265 /*
18 // Only override drawRect: if you perform custom drawing. 266 // Only override drawRect: if you perform custom drawing.
19 // An empty implementation adversely affects performance during animation. 267 // An empty implementation adversely affects performance during animation.
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/TopToolView/TopToolView.h
@@ -8,7 +8,10 @@ @@ -8,7 +8,10 @@
8 8
9 #import <UIKit/UIKit.h> 9 #import <UIKit/UIKit.h>
10 10
  11 +@class userInfoModel;
11 @interface TopToolView : UIView 12 @interface TopToolView : UIView
12 13
13 -- (instancetype)initWithFrame:(CGRect)frame isHost:(BOOL)isHost; 14 +- (instancetype _Nonnull)initWithFrame:(CGRect)frame isHost:(BOOL)isHost;
  15 +
  16 +@property (nonatomic ,strong) userInfoModel * _Nullable model;
14 @end 17 @end
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/TopToolView/TopToolView.m
@@ -7,26 +7,96 @@ @@ -7,26 +7,96 @@
7 // 7 //
8 8
9 #import "TopToolView.h" 9 #import "TopToolView.h"
  10 +#import "userInfoModel.h"
  11 +
  12 +@interface TopToolView ()
  13 +
  14 +@property (nonatomic ,strong) UIImageView * _Nullable icon;
  15 +@property (nonatomic ,strong) UIImageView * _Nullable bgView;
  16 +@property (nonatomic ,strong) UILabel * _Nullable stateLbl;
  17 +//@property (nonatomic ,strong) UILabel * _Nullable numberLbl;
  18 +
  19 +@end
10 20
11 @implementation TopToolView 21 @implementation TopToolView
12 22
13 - (instancetype)initWithFrame:(CGRect)frame isHost:(BOOL)isHost 23 - (instancetype)initWithFrame:(CGRect)frame isHost:(BOOL)isHost
14 { 24 {
15 if (self = [super initWithFrame:frame]) { 25 if (self = [super initWithFrame:frame]) {
16 - 26 +
  27 + [self addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapClick:)]];
  28 + [self addSubview:self.bgView];
  29 + [self addSubview:self.stateLbl];
17 if (isHost) { 30 if (isHost) {
18 //主播端没有自己头像 31 //主播端没有自己头像
19 32
20 -  
21 }else 33 }else
22 {//观众端有主播头像 34 {//观众端有主播头像
23 -  
24 - 35 + [self addSubview:self.icon];
25 } 36 }
26 } 37 }
27 return self; 38 return self;
28 } 39 }
29 40
  41 +- (void)setModel:(userInfoModel *)model
  42 +{
  43 + _model = model;
  44 + [_icon zx_setHeader:model.icon];
  45 +}
  46 +
  47 +- (void)tapClick:(UITapGestureRecognizer *)gesture
  48 +{
  49 + userInfoModel *userModel = [[userInfoModel alloc ]init];
  50 + userModel.name = @"职业主播";
  51 + userModel.icon = @"http://b.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=f0c5c08030d3d539c16807c70fb7c566/8ad4b31c8701a18bbef9f231982f07082838feba.jpg";
  52 + userModel.sign = @"哈哈啊哈哈啊哈哈,这是我的签名~";
  53 + userModel.uId = @"123124";
  54 +
  55 + [Tools showBouncedWithModel:userModel callBackBlock:^(UIView * _Nullable bounceView) {
  56 +
  57 + }];
  58 +}
  59 +
  60 +- (UIImageView *)icon
  61 +{
  62 + if (!_icon)
  63 + {
  64 + _icon = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
  65 + _icon.backgroundColor = ZXRandomColor;
  66 + _icon.layer.masksToBounds = YES;
  67 + _icon.layer.cornerRadius = _icon.height * 0.5;
  68 + [_icon zx_setHeader:@"http://b.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=f0c5c08030d3d539c16807c70fb7c566/8ad4b31c8701a18bbef9f231982f07082838feba.jpg"];
  69 + }
  70 + return _icon;
  71 +}
  72 +
  73 +- (UIImageView *)bgView
  74 +{
  75 + if (!_bgView)
  76 + {
  77 + _bgView = [[UIImageView alloc] initWithFrame:self.bounds];
  78 + _bgView.backgroundColor = ZXRandomColor;
  79 + _bgView.layer.masksToBounds = YES;
  80 + _bgView.layer.cornerRadius = _bgView.height * 0.5;
  81 +
  82 + }
  83 + return _bgView;
  84 +}
  85 +
  86 +- (UILabel *)stateLbl
  87 +{
  88 + if (!_stateLbl)
  89 + {
  90 + _stateLbl = [[UILabel alloc] initWithFrame:CGRectMake(self.icon.right + 5, 0, 60, 20)];
  91 + _stateLbl.textAlignment = NSTextAlignmentCenter;
  92 + _stateLbl.textColor = [UIColor whiteColor];
  93 + _stateLbl.text = @"直播";//直播 精彩回放
  94 + _stateLbl.height = [_stateLbl labelSize].height;
  95 + _stateLbl.font = [UIFont systemFontOfSize:kDetailContentFont];
  96 + }
  97 + return _stateLbl;
  98 +}
  99 +
30 /* 100 /*
31 // Only override drawRect: if you perform custom drawing. 101 // Only override drawRect: if you perform custom drawing.
32 // An empty implementation adversely affects performance during animation. 102 // An empty implementation adversely affects performance during animation.
LiveVideoCloud/LiveVideoCloud/Classes/Sections/LiveSections/Controller/LVCLiveViewController.m
@@ -11,11 +11,13 @@ @@ -11,11 +11,13 @@
11 #import <CNLivePlayerSDK/CNLiveWebcastManager.h> 11 #import <CNLivePlayerSDK/CNLiveWebcastManager.h>
12 #import "FilterFunctionView.h" 12 #import "FilterFunctionView.h"
13 #import "LVCUGCLivePrepareView.h" 13 #import "LVCUGCLivePrepareView.h"
  14 +#import "LiveBaseView.h"
  15 +#import "LVCUGCLiveEndView.h"
14 16
15 -#define KAppId @"60_irn9edco29"  
16 -#define KAppKey @"69fe70bda67e059286ad509d9f5377f815955645b52f94"  
17 -  
18 -@interface LVCLiveViewController ()<UIGestureRecognizerDelegate> 17 +@interface LVCLiveViewController ()<UIGestureRecognizerDelegate> {
  18 +
  19 + BOOL _isStreaming;
  20 +}
19 21
20 @property (nonatomic, strong) LVCUGCLivePrepareView *prepareView; 22 @property (nonatomic, strong) LVCUGCLivePrepareView *prepareView;
21 23
@@ -33,6 +35,10 @@ @@ -33,6 +35,10 @@
33 35
34 @property (nonatomic, strong) UIButton *openFlashButton; 36 @property (nonatomic, strong) UIButton *openFlashButton;
35 37
  38 +@property (nonatomic ,strong) LiveBaseView * _Nullable liveBaseView;
  39 +
  40 +@property (nonatomic, strong) LVCUGCLiveEndView *endView;
  41 +
36 @end 42 @end
37 43
38 @implementation LVCLiveViewController 44 @implementation LVCLiveViewController
@@ -43,6 +49,7 @@ @@ -43,6 +49,7 @@
43 self.view.backgroundColor = [UIColor blueColor]; 49 self.view.backgroundColor = [UIColor blueColor];
44 50
45 [self.view addSubview:self.captureView]; 51 [self.view addSubview:self.captureView];
  52 +
46 [self.view addSubview:self.prepareView]; 53 [self.view addSubview:self.prepareView];
47 [self.view addSubview:self.quitButton]; 54 [self.view addSubview:self.quitButton];
48 [self.view addSubview:self.changeCameraButton]; 55 [self.view addSubview:self.changeCameraButton];
@@ -53,8 +60,6 @@ @@ -53,8 +60,6 @@
53 // 初始化推流 60 // 初始化推流
54 NSString *activityId = [NSString stringWithFormat:@"%d%d%d%d%d",arc4random()%9,arc4random()%9,arc4random()%9,arc4random()%9,arc4random()%9]; 61 NSString *activityId = [NSString stringWithFormat:@"%d%d%d%d%d",arc4random()%9,arc4random()%9,arc4random()%9,arc4random()%9,arc4random()%9];
55 62
56 - [[CNLiveWebcastManager manager] initWithAppId:KAppId appKey:KAppKey];  
57 -  
58 _kitCN = [[CNLiveGPUStreamerKit alloc] initWithDefaultConfigWithActivityId:activityId channelId:@"iOStest" isHorizontalScreen:@"0"]; 63 _kitCN = [[CNLiveGPUStreamerKit alloc] initWithDefaultConfigWithActivityId:activityId channelId:@"iOStest" isHorizontalScreen:@"0"];
59 64
60 // _kitCN.activityName = @"iOS test"; 65 // _kitCN.activityName = @"iOS test";
@@ -101,13 +106,32 @@ @@ -101,13 +106,32 @@
101 106
102 } 107 }
103 108
  109 +- (LiveBaseView *)liveBaseView
  110 +{
  111 + if (!_liveBaseView)
  112 + {
  113 + _liveBaseView = [LiveBaseView liveBaseView];
  114 + _liveBaseView.jumpType = JumpControllerTypePresent;
  115 + _liveBaseView.viewController = self;
  116 + _liveBaseView.backgroundColor = [UIColor clearColor];
  117 + }
  118 + return _liveBaseView;
  119 +}
  120 +
104 #pragma mark - UIButton Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 121 #pragma mark - UIButton Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
105 - (void)startCapture:(UIButton *)button { // 开始推流 122 - (void)startCapture:(UIButton *)button { // 开始推流
  123 +
  124 + [_quitButton removeFromSuperview];
106 125
  126 + _isStreaming = YES;
  127 +
107 [_prepareView removeFromSuperview]; 128 [_prepareView removeFromSuperview];
108 129
109 [_kitCN startStream:^{ 130 [_kitCN startStream:^{
110 NSLog(@"开启推流成功 ------- success"); 131 NSLog(@"开启推流成功 ------- success");
  132 +
  133 + [self.view insertSubview:self.liveBaseView atIndex:1];
  134 +
111 } failure:^(NSDictionary *errorDic) { 135 } failure:^(NSDictionary *errorDic) {
112 NSString *str=[[NSMutableString alloc] initWithData:errorDic[@"errorMessage"] encoding:NSUTF8StringEncoding]; 136 NSString *str=[[NSMutableString alloc] initWithData:errorDic[@"errorMessage"] encoding:NSUTF8StringEncoding];
113 NSLog(@"%@",str); 137 NSLog(@"%@",str);
@@ -172,19 +196,31 @@ @@ -172,19 +196,31 @@
172 196
173 - (void)quitBtnClick { // 退出 197 - (void)quitBtnClick { // 退出
174 198
  199 + if (_isStreaming) {
  200 + [self.view addSubview:self.endView];
  201 + } else {
  202 + if (_kitCN.captureState == CNLiveCaptureStateCapturing) {
  203 + [_kitCN stopPreview];
  204 + }
  205 + [self dismissViewControllerAnimated:YES completion:nil];
  206 + }
  207 +}
  208 +
  209 +- (void)continueButtonClick {
  210 +
  211 + [_endView removeFromSuperview];
  212 +}
  213 +
  214 +- (void)endButtonClick {
  215 +
175 if (_kitCN.streamState == CNLiveStreamStateConnected) { 216 if (_kitCN.streamState == CNLiveStreamStateConnected) {
176 [_kitCN stopStream]; 217 [_kitCN stopStream];
177 } 218 }
178 - if (_kitCN.captureState == CNLiveCaptureStateCapturing) {  
179 - [_kitCN stopPreview];  
180 - }  
181 -  
182 [self dismissViewControllerAnimated:YES completion:nil]; 219 [self dismissViewControllerAnimated:YES completion:nil];
183 } 220 }
184 221
185 222
186 -#pragma mark - UIGestureRecognizer Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
187 - 223 +#pragma mark - UIGestureRecognizer Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
188 - (void)onTap:(UIGestureRecognizer *)sender { //对焦与曝光 224 - (void)onTap:(UIGestureRecognizer *)sender { //对焦与曝光
189 225
190 CGPoint current = [sender locationInView:self.view]; 226 CGPoint current = [sender locationInView:self.view];
@@ -197,8 +233,7 @@ @@ -197,8 +233,7 @@
197 } 233 }
198 } 234 }
199 235
200 -#pragma mark - notification !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
201 - 236 +#pragma mark - notification !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
202 - (void)enterBg { // 进入后台 237 - (void)enterBg { // 进入后台
203 238
204 [_kitCN appEnterBackground]; 239 [_kitCN appEnterBackground];
@@ -461,6 +496,18 @@ @@ -461,6 +496,18 @@
461 return _openFilterButton; 496 return _openFilterButton;
462 } 497 }
463 498
  499 +- (LVCUGCLiveEndView *)endView {
  500 +
  501 + if (!_endView) {
  502 + _endView = [[LVCUGCLiveEndView alloc] initWithFrame:CGRectMake(20, SCREEN_HEIGHT * 0.3, SCREEN_WIDTH - 40, SCREEN_WIDTH - 40)];
  503 + _endView.layer.cornerRadius = 20;
  504 + _endView.layer.masksToBounds = YES;
  505 + [_endView.continueButton addTarget:self action:@selector(continueButtonClick) forControlEvents:UIControlEventTouchUpInside];
  506 + [_endView.endButton addTarget:self action:@selector(endButtonClick) forControlEvents:UIControlEventTouchUpInside];
  507 + }
  508 + return _endView;
  509 +}
  510 +
464 #pragma mark - Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 511 #pragma mark - Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
465 - (void)addObservers { 512 - (void)addObservers {
466 513
@@ -482,25 +529,6 @@ @@ -482,25 +529,6 @@
482 object:nil]; 529 object:nil];
483 } 530 }
484 531
485 -- (UIButton *)addButton:(NSString*)title  
486 - frame:(CGRect)frame  
487 - action:(SEL)action {  
488 - UIButton * button;  
489 - button = [UIButton buttonWithType:UIButtonTypeCustom];  
490 - button.frame = frame;  
491 - [button setTitle: title forState: UIControlStateNormal];  
492 - [button addTarget:self action:action forControlEvents:UIControlEventTouchUpInside];  
493 - button.titleLabel.font = [UIFont systemFontOfSize:15];  
494 - [button setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal];  
495 - button.layer.cornerRadius = 10;  
496 - button.layer.masksToBounds = YES;  
497 - button.layer.borderColor = [UIColor blackColor].CGColor;  
498 - button.layer.borderWidth = 1;  
499 - [self.captureView addSubview:button];  
500 - return button;  
501 -  
502 -}  
503 -  
504 - (UIButton *)createButtonWithFrame:(CGRect)frame image:(NSString *)image selected:(NSString *)selected { 532 - (UIButton *)createButtonWithFrame:(CGRect)frame image:(NSString *)image selected:(NSString *)selected {
505 533
506 UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; 534 UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
LiveVideoCloud/LiveVideoCloud/Classes/Sections/LiveSections/View/LVCUGCLiveEndView.h 0 → 100644
  1 +//
  2 +// LVCUGCLiveEndView.h
  3 +// LiveVideoCloud
  4 +//
  5 +// Created by cnliveJunBo on 17/3/27.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +@interface LVCUGCLiveEndView : UIView
  12 +
  13 +@property (nonatomic, strong) UIButton *continueButton;
  14 +
  15 +@property (nonatomic, strong) UIButton *endButton;
  16 +
  17 +@end
LiveVideoCloud/LiveVideoCloud/Classes/Sections/LiveSections/View/LVCUGCLiveEndView.m 0 → 100644
  1 +//
  2 +// LVCUGCLiveEndView.m
  3 +// LiveVideoCloud
  4 +//
  5 +// Created by cnliveJunBo on 17/3/27.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "LVCUGCLiveEndView.h"
  10 +
  11 +#define selfLength self.bounds.size.width
  12 +
  13 +@interface LVCUGCLiveEndView()
  14 +
  15 +@property (nonatomic, strong) UIImageView *iconView;
  16 +
  17 +@property (nonatomic, strong) UILabel *infoLabel;
  18 +@property (nonatomic, strong) UILabel *attentionLabel;
  19 +
  20 +@end
  21 +
  22 +@implementation LVCUGCLiveEndView
  23 +
  24 +- (instancetype)initWithFrame:(CGRect)frame
  25 +{
  26 + self = [super initWithFrame:frame];
  27 + if (self) {
  28 + self.backgroundColor = [UIColor whiteColor];
  29 + [self addSubview:self.iconView];
  30 + [self addSubview:self.infoLabel];
  31 + [self addSubview:self.attentionLabel];
  32 + [self addSubview:self.continueButton];
  33 + [self addSubview:self.endButton];
  34 + }
  35 + return self;
  36 +}
  37 +
  38 +#pragma mark - GetMethod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  39 +- (UIImageView *)iconView {
  40 +
  41 + if (!_iconView) {
  42 + NSString *path = [[NSBundle mainBundle] pathForResource:@"头像" ofType:@"jpg"];
  43 + UIImage *image = [UIImage imageWithContentsOfFile:path];
  44 + _iconView = [[UIImageView alloc] initWithImage:image];
  45 + _iconView.frame = CGRectMake((selfLength - 50) * 0.5, 20, 50, 50);
  46 + _iconView.layer.cornerRadius = 25;
  47 + _iconView.layer.masksToBounds = YES;
  48 + }
  49 + return _iconView;
  50 +}
  51 +
  52 +- (UILabel *)infoLabel {
  53 +
  54 + if (!_infoLabel) {
  55 + _infoLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, selfLength * 0.3, selfLength, 20)];
  56 + _infoLabel.text = @"10000人看过你的直播~";
  57 + _infoLabel.textAlignment = NSTextAlignmentCenter;
  58 + _infoLabel.textColor = [UIColor grayColor];
  59 + }
  60 + return _infoLabel;
  61 +}
  62 +
  63 +- (UILabel *)attentionLabel {
  64 +
  65 + if (!_attentionLabel) {
  66 + _attentionLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, selfLength * 0.5, selfLength, 30)];
  67 + _attentionLabel.text = @"确定要结束直播吗?";
  68 + _attentionLabel.textAlignment = NSTextAlignmentCenter;
  69 + _attentionLabel.textColor = [UIColor orangeColor];
  70 + _attentionLabel.font = [UIFont systemFontOfSize:21];
  71 + }
  72 + return _attentionLabel;
  73 +}
  74 +
  75 +- (UIButton *)continueButton {
  76 +
  77 + if (!_continueButton) {
  78 + _continueButton = [UIButton buttonWithType:UIButtonTypeCustom];
  79 + _continueButton.frame = CGRectMake(15, selfLength * 0.7, selfLength * 0.4, 35);
  80 + [_continueButton setTitle:@"继续" forState:UIControlStateNormal];
  81 + [_continueButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  82 + [_continueButton setTitleColor:[UIColor blackColor] forState:UIControlStateHighlighted];
  83 + _continueButton.backgroundColor = [UIColor redColor];
  84 + _continueButton.layer.cornerRadius = 17.5;
  85 + _continueButton.layer.masksToBounds = YES;
  86 + }
  87 + return _continueButton;
  88 +}
  89 +
  90 +- (UIButton *)endButton {
  91 +
  92 + if (!_endButton) {
  93 + _endButton = [UIButton buttonWithType:UIButtonTypeCustom];
  94 + _endButton.frame = CGRectMake(selfLength * 0.6 - 15, selfLength * 0.7, selfLength * 0.4, 35);
  95 + [_endButton setTitle:@"结束" forState:UIControlStateNormal];
  96 + [_endButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  97 + [_endButton setTitleColor:[UIColor blackColor] forState:UIControlStateHighlighted];
  98 + _endButton.backgroundColor = [UIColor redColor];
  99 + _endButton.layer.cornerRadius = 17.5;
  100 + _endButton.layer.masksToBounds = YES;
  101 + }
  102 + return _endButton;
  103 +}
  104 +
  105 +@end
LiveVideoCloud/LiveVideoCloud/Classes/Sections/LiveSections/View/LVCUGCLivePrepareView.m
@@ -49,11 +49,9 @@ @@ -49,11 +49,9 @@
49 49
50 if (!_titleTextField) { 50 if (!_titleTextField) {
51 _titleTextField = [[UITextField alloc] initWithFrame:CGRectMake(110, SCREEN_HEIGHT * 0.35 + 50, SCREEN_WIDTH - 120, 30)]; 51 _titleTextField = [[UITextField alloc] initWithFrame:CGRectMake(110, SCREEN_HEIGHT * 0.35 + 50, SCREEN_WIDTH - 120, 30)];
52 -  
53 - NSMutableAttributedString *placeholder = [[NSMutableAttributedString alloc]initWithString:@"起个名字开始直播~"];  
54 -  
55 -  
56 - _titleTextField.attributedPlaceholder = placeholder; 52 +
  53 + UIColor *color = [UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1];
  54 + _titleTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"起个名字开始直播~" attributes:@{NSForegroundColorAttributeName: color}];
57 55
58 _titleTextField.font = [UIFont systemFontOfSize:19]; 56 _titleTextField.font = [UIFont systemFontOfSize:19];
59 } 57 }
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/HomeViewController.m
@@ -8,31 +8,17 @@ @@ -8,31 +8,17 @@
8 8
9 #import "HomeViewController.h" 9 #import "HomeViewController.h"
10 #import "LVCLivePlayerController.h" 10 #import "LVCLivePlayerController.h"
11 -#import "LVCInteractionController.h"  
12 #import "LVCLivePlayerController.h" 11 #import "LVCLivePlayerController.h"
13 #import "LVCUGCLivePlayerController.h" 12 #import "LVCUGCLivePlayerController.h"
14 -#import "LVCLivePlayerController.h" 13 +#import "LVCTVLiveViewController.h"
  14 +#import "LVCUGCLiveListController.h"
15 15
16 @interface HomeViewController () 16 @interface HomeViewController ()
17 17
18 -@property (nonatomic ,strong) UIButton * _Nullable interactionBtn;  
19 -  
20 @end 18 @end
21 19
22 @implementation HomeViewController 20 @implementation HomeViewController
23 21
24 -- (void)viewWillAppear:(BOOL)animated  
25 -{  
26 - [super viewWillAppear:animated];  
27 - [[UIApplication sharedApplication].keyWindow addSubview:self.interactionBtn];  
28 -}  
29 -  
30 -- (void)viewWillDisappear:(BOOL)animated  
31 -{  
32 - [super viewWillDisappear:animated];  
33 - [self.interactionBtn removeFromSuperview];  
34 -}  
35 -  
36 - (void)viewDidLoad { 22 - (void)viewDidLoad {
37 [super viewDidLoad]; 23 [super viewDidLoad];
38 // Do any additional setup after loading the view. 24 // Do any additional setup after loading the view.
@@ -51,13 +37,17 @@ @@ -51,13 +37,17 @@
51 [UGCLiveBtn addTarget:self action:@selector(UGCLiveAction) forControlEvents:UIControlEventTouchUpInside]; 37 [UGCLiveBtn addTarget:self action:@selector(UGCLiveAction) forControlEvents:UIControlEventTouchUpInside];
52 [self.view addSubview:UGCLiveBtn]; 38 [self.view addSubview:UGCLiveBtn];
53 39
54 - [[UIApplication sharedApplication].keyWindow addSubview:self.interactionBtn]; 40 + UIButton *UGCLiveListBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  41 + UGCLiveListBtn.frame = CGRectMake(0, 300, self.view.width, 40);
  42 + [UGCLiveListBtn setTitle:@"UGC直播列表" forState:UIControlStateNormal];
  43 + [UGCLiveListBtn addTarget:self action:@selector(UGCLiveListAction) forControlEvents:UIControlEventTouchUpInside];
  44 + [self.view addSubview:UGCLiveListBtn];
55 } 45 }
56 46
57 - (void)liveAction 47 - (void)liveAction
58 { 48 {
59 - LVCLivePlayerController *liveVC = [[LVCLivePlayerController alloc] init];  
60 - self.navigationController.navigationBar.hidden = YES; 49 + LVCTVLiveViewController *liveVC = [[LVCTVLiveViewController alloc] init];
  50 +// self.navigationController.navigationBar.hidden = YES;
61 [self.navigationController pushViewController:liveVC animated:YES]; 51 [self.navigationController pushViewController:liveVC animated:YES];
62 } 52 }
63 53
@@ -67,26 +57,10 @@ @@ -67,26 +57,10 @@
67 [self.navigationController pushViewController:UGCLiveVC animated:YES]; 57 [self.navigationController pushViewController:UGCLiveVC animated:YES];
68 } 58 }
69 59
70 -- (void)interactionAction  
71 -{  
72 - LVCInteractionController *intVC = [[LVCInteractionController alloc] init];  
73 - self.navigationController.navigationBar.hidden = YES;  
74 - [self.navigationController pushViewController:intVC animated:YES];  
75 -}  
76 -  
77 -  
78 -- (UIButton *)interactionBtn 60 +- (void)UGCLiveListAction
79 { 61 {
80 - if (!_interactionBtn)  
81 - {  
82 - UIButton *interactionBtn = [UIButton buttonWithType:UIButtonTypeCustom];  
83 - interactionBtn.frame = CGRectMake(200, 400, 50, 30);  
84 - [interactionBtn setTitle:@"互动" forState:UIControlStateNormal];  
85 - [interactionBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];  
86 - [interactionBtn addTarget:self action:@selector(interactionAction) forControlEvents:UIControlEventTouchUpInside];  
87 - _interactionBtn = interactionBtn;  
88 - }  
89 - return _interactionBtn; 62 + LVCUGCLiveListController *listVC = [[LVCUGCLiveListController alloc] init];
  63 + [self.navigationController pushViewController:listVC animated:YES];
90 } 64 }
91 65
92 - (void)didReceiveMemoryWarning { 66 - (void)didReceiveMemoryWarning {
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCUGCLiveListController.h 0 → 100644
  1 +//
  2 +// LVCUGCLiveListController.h
  3 +// LiveVideoCloud
  4 +//
  5 +// Created by cnliveJunBo on 17/3/27.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +@interface LVCUGCLiveListController : UIViewController
  12 +
  13 +@end
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCUGCLiveListController.m 0 → 100644
  1 +//
  2 +// LVCUGCLiveListController.m
  3 +// LiveVideoCloud
  4 +//
  5 +// Created by cnliveJunBo on 17/3/27.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "LVCUGCLiveListController.h"
  10 +#import "CommonCrypto/CommonDigest.h"
  11 +
  12 +@interface LVCUGCLiveListController ()
  13 +
  14 +@end
  15 +
  16 +@implementation LVCUGCLiveListController
  17 +
  18 +- (void)viewDidLoad {
  19 + [super viewDidLoad];
  20 + self.view.backgroundColor = [UIColor whiteColor];
  21 +
  22 + [self loadData];
  23 +}
  24 +
  25 +- (void)loadData {
  26 +
  27 + NSInteger time = [[NSDate date] timeIntervalSince1970];
  28 + NSString *timeString = [NSString stringWithFormat:@"%ld", (long)time];
  29 + NSMutableDictionary *parameter=[@{@"platform_id": [NSBundle mainBundle].bundleIdentifier,
  30 + @"timestamp": timeString,
  31 + @"appId": AppId} mutableCopy];
  32 + NSString *string = [NSString stringWithFormat:@"%@&key=%@", [self sortParameters:parameter], AppKey];
  33 + NSString *signString = [[self sha1:string] uppercaseString];
  34 + [parameter setObject:signString forKey:@"sign"];
  35 +
  36 + [[AFHTTPSessionManager manager] GET:@"http://api.cnlive.com/open/api2/live_epg/sp/activityList4App" parameters:parameter progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
  37 +
  38 + NSLog(@"%@",responseObject);
  39 +
  40 + } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
  41 +
  42 + NSLog(@"%@",error);
  43 + }];
  44 +
  45 +}
  46 +
  47 +//sha1加密
  48 +- (NSString*)sha1:(NSString *)string
  49 +{
  50 + NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
  51 +
  52 + uint8_t digest[CC_SHA1_DIGEST_LENGTH];
  53 +
  54 + CC_SHA1(data.bytes, data.length, digest);
  55 +
  56 + NSMutableString* output = [NSMutableString stringWithCapacity:CC_SHA1_DIGEST_LENGTH * 2];
  57 +
  58 + for(int i = 0; i < CC_SHA1_DIGEST_LENGTH; i++)
  59 + [output appendFormat:@"%02x", digest[i]];
  60 +
  61 + while ([[output substringToIndex:1] isEqualToString:@"0"]) {
  62 + output = [[NSMutableString alloc] initWithString:[output substringFromIndex:1]];
  63 + }
  64 +
  65 + return output;
  66 +}
  67 +//参数排序
  68 +- (NSString *)sortParameters:(NSDictionary*)parameters
  69 +{
  70 + //对所有传入参数按照字段名的 ASCII 码从小到大排序
  71 + NSArray *keyArr=[parameters allKeys];
  72 + NSArray *arr = [keyArr sortedArrayUsingSelector:@selector(compare:)];
  73 +
  74 + NSMutableString *string1 = [[NSMutableString alloc]init];
  75 + for (int i=0; i<arr.count; i++) {
  76 +
  77 + NSString *parametersString = parameters[[arr objectAtIndex:i]];
  78 + if (parametersString.length > 0) {
  79 + [string1 appendString:[NSString stringWithFormat:@"%@=%@&",[arr objectAtIndex:i],parameters[[arr objectAtIndex:i]]]];
  80 + }
  81 + }
  82 +
  83 + if (string1.length > 0) {
  84 + [string1 deleteCharactersInRange:NSMakeRange(string1.length-1, 1)];
  85 + }
  86 +
  87 + return string1;
  88 +}
  89 +
  90 +- (void)didReceiveMemoryWarning {
  91 + [super didReceiveMemoryWarning];
  92 + // Dispose of any resources that can be recreated.
  93 +}
  94 +
  95 +@end
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCUGCLivePlayerController.m
@@ -10,18 +10,16 @@ @@ -10,18 +10,16 @@
10 #import <CNLivePlayerSDK/CNLiveWebcastManager.h> 10 #import <CNLivePlayerSDK/CNLiveWebcastManager.h>
11 #import "LVCUGCPlayerLoadingView.h" 11 #import "LVCUGCPlayerLoadingView.h"
12 #import "LVCUGCBackgroundView.h" 12 #import "LVCUGCBackgroundView.h"
  13 +#import "LVCUGCLivePlayerCell.h"
13 14
14 -#define KAppId @"60_irn9edco29"  
15 -#define KAppKey @"69fe70bda67e059286ad509d9f5377f815955645b52f94" 15 +static NSString *cellId = @"cellId";
16 16
17 -@interface LVCUGCLivePlayerController () 17 +@interface LVCUGCLivePlayerController ()<UICollectionViewDelegate, UICollectionViewDataSource>
18 18
19 -@property (nonatomic, strong) CNLiveMoviePlayerController *player;// 播放器 19 +@property (nonatomic, strong) UICollectionView *collectionView;
20 20
21 @property (nonatomic, strong) LVCUGCBackgroundView *bgView; // 背景视图 21 @property (nonatomic, strong) LVCUGCBackgroundView *bgView; // 背景视图
22 22
23 -@property (nonatomic, strong) LVCUGCPlayerLoadingView *loadingView; // 加载视图  
24 -  
25 @end 23 @end
26 24
27 @implementation LVCUGCLivePlayerController 25 @implementation LVCUGCLivePlayerController
@@ -45,226 +43,62 @@ @@ -45,226 +43,62 @@
45 43
46 self.view.backgroundColor = [UIColor whiteColor]; 44 self.view.backgroundColor = [UIColor whiteColor];
47 45
48 - [self.view addSubview:self.loadingView];  
49 [self.view addSubview:self.bgView]; 46 [self.view addSubview:self.bgView];
  47 + [self.view addSubview:self.collectionView];
50 48
51 - //添加播放器通知  
52 - [self installMovieNotificationObservers];  
53 -  
54 - [[CNLiveWebcastManager manager] initWithAppId:KAppId appKey:KAppKey];  
55 -  
56 - //直播播放  
57 - _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:@"iOStest"  
58 - authSuccess:^{  
59 -  
60 - _player.videoDecoderMode = CNLiveMovieVideoDecoderMode_AUTO;  
61 - _player.view.frame = self.view.bounds;  
62 - _player.shouldAutoplay = YES;  
63 - [_player prepareToPlay];  
64 - [self.view addSubview:_player.view];  
65 - [self.view sendSubviewToBack:_player.view];  
66 -  
67 - } authFailed:^(NSDictionary *errorInfo) {  
68 - NSLog(@"初始化直播播放器失败:%@", errorInfo);  
69 -  
70 -  
71 - } getAnchorStatusResult:^(BOOL result) {  
72 -  
73 - NSLog(@"-------------获取主播状态%d", result ? YES : NO);  
74 -  
75 - }];  
76 } 49 }
77 50
78 -#pragma mark - 添加通知监听 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
79 --(void)installMovieNotificationObservers //添加视频播放通知  
80 -{  
81 - //视频加载状态改变  
82 - [[NSNotificationCenter defaultCenter] addObserver:self  
83 - selector:@selector(loadStateDidChange:)  
84 - name:MPMoviePlayerLoadStateDidChangeNotification  
85 - object:nil];  
86 -  
87 - //视频播放错误及结束原因  
88 - [[NSNotificationCenter defaultCenter] addObserver:self  
89 - selector:@selector(moviePlayBackDidFinish:)  
90 - name:MPMoviePlayerPlaybackDidFinishNotification  
91 - object:nil];  
92 -  
93 - //视频缓冲至可播放状态  
94 - [[NSNotificationCenter defaultCenter] addObserver:self  
95 - selector:@selector(mediaIsPreparedToPlayDidChange:)  
96 - name:MPMediaPlaybackIsPreparedToPlayDidChangeNotification  
97 - object:nil];  
98 -  
99 - //视频播放状态改变  
100 - [[NSNotificationCenter defaultCenter] addObserver:self  
101 - selector:@selector(moviePlayBackStateDidChange:)  
102 - name:MPMoviePlayerPlaybackStateDidChangeNotification  
103 - object:nil];  
104 -  
105 -  
106 - //获取主播状态通知(点播和普通播放不需要注册该通知)  
107 - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(anchorStatusChanged:)  
108 - name:CNLiveAnchorStatusChangedNotification  
109 - object:nil]; 51 +#pragma mark - UICollectionViewDelegate, UICollectionViewDataSource !!!!!!!!!!!!!!!!!!!!!!!!!!!
  52 +- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
110 53
  54 + return 1;
111 } 55 }
112 56
113 -#pragma mark - 移除通知  
114 -- (void)removeMovieNotificationObservers  
115 -{  
116 - [[NSNotificationCenter defaultCenter]removeObserver:self  
117 - name:MPMoviePlayerLoadStateDidChangeNotification  
118 - object:nil];  
119 - [[NSNotificationCenter defaultCenter]removeObserver:self  
120 - name:MPMoviePlayerPlaybackDidFinishNotification  
121 - object:nil];  
122 - [[NSNotificationCenter defaultCenter]removeObserver:self  
123 - name:MPMediaPlaybackIsPreparedToPlayDidChangeNotification  
124 - object:nil];  
125 - [[NSNotificationCenter defaultCenter]removeObserver:self  
126 - name:MPMoviePlayerPlaybackStateDidChangeNotification  
127 - object:nil]; 57 +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
128 58
129 - [[NSNotificationCenter defaultCenter]removeObserver:self  
130 - name:CNLiveAnchorStatusChangedNotification  
131 - object:nil];  
132 -}  
133 -  
134 -#pragma mark - 通知 Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
135 -//视频加载状态改变  
136 -- (void)loadStateDidChange:(NSNotification *)notification  
137 -{  
138 - if (_player) {  
139 - MPMovieLoadState loadState = _player.loadState;  
140 - if ((loadState & MPMovieLoadStatePlaythroughOK) != 0) {  
141 -  
142 - NSLog(@"loadStateDidChange: MPMovieLoadStatePlaythroughOK: %d\n", (int)loadState);  
143 -  
144 - } else if ((loadState & MPMovieLoadStateStalled) != 0) {  
145 - NSLog(@"loadStateDidChange: MPMovieLoadStateStalled: %d\n", (int)loadState);  
146 -  
147 - } else {  
148 - NSLog(@"loadStateDidChange: ???: %d\n", (int)loadState);  
149 - }  
150 - }  
151 -}  
152 -  
153 -//视频播放错误及结束原因  
154 -- (void)moviePlayBackDidFinish:(NSNotification *)notification  
155 -{  
156 - if (_player) {  
157 - int reason = [[[notification userInfo] valueForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey] intValue];  
158 - if (MPMovieFinishReasonPlaybackError == reason) {  
159 -  
160 -  
161 - } else {  
162 -  
163 - }  
164 -  
165 - switch (reason)  
166 - {  
167 - case MPMovieFinishReasonPlaybackEnded:  
168 - NSLog(@"playbackStateDidChange: MPMovieFinishReasonPlaybackEnded: %d\n", reason);  
169 - break;  
170 -  
171 - case MPMovieFinishReasonUserExited:  
172 - NSLog(@"playbackStateDidChange: MPMovieFinishReasonUserExited: %d\n", reason);  
173 - break;  
174 -  
175 - case MPMovieFinishReasonPlaybackError:  
176 - NSLog(@"playbackStateDidChange: MPMovieFinishReasonPlaybackError: %d\n", reason);  
177 - break;  
178 -  
179 - default:  
180 - NSLog(@"playbackPlayBackDidFinish: ???: %d\n", reason);  
181 - break;  
182 - }  
183 - }  
184 -}  
185 -  
186 -//视频缓冲至可播放状态  
187 -- (void)mediaIsPreparedToPlayDidChange:(NSNotification *)notification  
188 -{  
189 - if (_player) {  
190 - NSLog(@"isPreparedToPlay");  
191 - if (_loadingView) {  
192 - [_loadingView removeFromSuperview];  
193 - }  
194 - } 59 + return 4;
195 } 60 }
196 61
197 -//视频播放状态改变  
198 -- (void)moviePlayBackStateDidChange:(NSNotification *)notification  
199 -{  
200 - if (_player) {  
201 -  
202 - switch (_player.playbackState) {  
203 - case MPMoviePlaybackStateStopped: {  
204 -  
205 - NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStateStopped");  
206 - break;  
207 - }  
208 - case MPMoviePlaybackStatePlaying: {  
209 -  
210 - NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStatePlaying");  
211 - break;  
212 - }  
213 - case MPMoviePlaybackStatePaused:  
214 -  
215 - NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStatePaused");  
216 - break;  
217 - case MPMoviePlaybackStateInterrupted:  
218 -  
219 - NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStateInterrupted");  
220 - break;  
221 - case MPMoviePlaybackStateSeekingForward:  
222 -  
223 - NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStateSeekingForward");  
224 - break;  
225 - case MPMoviePlaybackStateSeekingBackward:  
226 -  
227 - NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStateSeekingBackward");  
228 - break;  
229 - default:  
230 -  
231 - NSLog(@"moviePlayBackStateDidChange : %ld", (long)_player.playbackState);  
232 - break;  
233 - }  
234 - } 62 +- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
  63 +
  64 + LVCUGCLivePlayerCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellId forIndexPath:indexPath];
  65 +
  66 + return cell;
235 } 67 }
236 68
237 -  
238 -  
239 -// 获取主播状态通知  
240 -- (void)anchorStatusChanged:(NSNotification *)notification  
241 -{  
242 - if (_player.anchorStatus == 2) { // 已结束  
243 -  
244 - }  
245 - _bgView.anchorStatus = _player.anchorStatus; 69 +- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
  70 +
  71 + NSLog(@"一直");
246 } 72 }
247 73
248 -//重新连接获取主播状态  
249 -- (void)anchorStatusConnectFailed  
250 -{ 74 +- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
251 75
  76 + NSLog(@"停止");
252 } 77 }
253 78
254 -#pragma mark - getter  
255 -- (LVCUGCPlayerLoadingView *)loadingView {  
256 -  
257 - if (!_loadingView) {  
258 - _loadingView = [[LVCUGCPlayerLoadingView alloc] initWithFrame:self.view.bounds bgImageURLStr:@""]; 79 +
  80 +#pragma mark - getMethod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  81 +- (UICollectionView *)collectionView {
  82 +
  83 + if (!_collectionView) {
  84 + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
  85 + layout.minimumLineSpacing = 0;
  86 + layout.minimumInteritemSpacing = 0;
  87 + layout.itemSize = self.view.bounds.size;
  88 + _collectionView = [[UICollectionView alloc] initWithFrame:self.view.bounds collectionViewLayout:layout];
  89 + _collectionView.pagingEnabled = YES;
  90 + _collectionView.showsHorizontalScrollIndicator = NO;
  91 + _collectionView.dataSource = self;
  92 + _collectionView.delegate = self;
  93 + [_collectionView registerClass:[LVCUGCLivePlayerCell class] forCellWithReuseIdentifier:cellId];
259 } 94 }
260 - return _loadingView; 95 + return _collectionView;
261 } 96 }
262 97
263 - (LVCUGCBackgroundView *)bgView { 98 - (LVCUGCBackgroundView *)bgView {
264 99
265 if (!_bgView) { 100 if (!_bgView) {
266 - _bgView = [[LVCUGCBackgroundView alloc] init];  
267 - _bgView.backgroundColor = [UIColor whiteColor]; 101 + _bgView = [[LVCUGCBackgroundView alloc] initWithFrame:self.view.bounds];
268 _bgView.hidden = YES; 102 _bgView.hidden = YES;
269 } 103 }
270 return _bgView; 104 return _bgView;
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Model/LVCUGCLivePlayerModel.h 0 → 100644
  1 +//
  2 +// LVCUGCLivePlayerModel.h
  3 +// LiveVideoCloud
  4 +//
  5 +// Created by cnliveJunBo on 17/3/28.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +@interface LVCUGCLivePlayerModel : NSObject
  12 +
  13 +@end
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Model/LVCUGCLivePlayerModel.m 0 → 100644
  1 +//
  2 +// LVCUGCLivePlayerModel.m
  3 +// LiveVideoCloud
  4 +//
  5 +// Created by cnliveJunBo on 17/3/28.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "LVCUGCLivePlayerModel.h"
  10 +
  11 +@implementation LVCUGCLivePlayerModel
  12 +
  13 +@end
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCUGCBackgroundView.h
@@ -12,4 +12,6 @@ @@ -12,4 +12,6 @@
12 12
13 @property (nonatomic, assign) int anchorStatus; //设置主播状态 13 @property (nonatomic, assign) int anchorStatus; //设置主播状态
14 14
  15 +@property (nonatomic, strong) UIButton *backButton;
  16 +
15 @end 17 @end
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCUGCBackgroundView.m
@@ -16,8 +16,6 @@ @@ -16,8 +16,6 @@
16 16
17 @property (nonatomic, strong) UILabel *playInfoLabel; 17 @property (nonatomic, strong) UILabel *playInfoLabel;
18 18
19 -@property (nonatomic, strong) UIButton *backButton;  
20 -  
21 @end 19 @end
22 20
23 @implementation LVCUGCBackgroundView 21 @implementation LVCUGCBackgroundView
@@ -27,6 +25,7 @@ @@ -27,6 +25,7 @@
27 { 25 {
28 self = [super initWithFrame:frame]; 26 self = [super initWithFrame:frame];
29 if (self) { 27 if (self) {
  28 + self.backgroundColor = [UIColor whiteColor];
30 [self addSubview:self.iconView]; 29 [self addSubview:self.iconView];
31 [self addSubview:self.nicknameLabel]; 30 [self addSubview:self.nicknameLabel];
32 [self addSubview:self.playInfoLabel]; 31 [self addSubview:self.playInfoLabel];
@@ -66,7 +65,7 @@ @@ -66,7 +65,7 @@
66 NSString *path = [[NSBundle mainBundle] pathForResource:@"头像" ofType:@"jpg"]; 65 NSString *path = [[NSBundle mainBundle] pathForResource:@"头像" ofType:@"jpg"];
67 UIImage *image = [UIImage imageWithContentsOfFile:path]; 66 UIImage *image = [UIImage imageWithContentsOfFile:path];
68 _iconView = [[UIImageView alloc] initWithImage:image]; 67 _iconView = [[UIImageView alloc] initWithImage:image];
69 - _iconView.frame = CGRectMake((SCREEN_WIDTH - 100) * 0.5, 200, 100, 100); 68 + _iconView.frame = CGRectMake((SCREEN_WIDTH - 100) * 0.5, SCREEN_HEIGHT * 0.2, 100, 100);
70 _iconView.layer.cornerRadius = 50; 69 _iconView.layer.cornerRadius = 50;
71 _iconView.layer.masksToBounds = YES; 70 _iconView.layer.masksToBounds = YES;
72 } 71 }
@@ -76,9 +75,9 @@ @@ -76,9 +75,9 @@
76 - (UILabel *)nicknameLabel { 75 - (UILabel *)nicknameLabel {
77 76
78 if (!_nicknameLabel) { 77 if (!_nicknameLabel) {
79 - _nicknameLabel = [[UILabel alloc] initWithFrame:CGRectMake((SCREEN_WIDTH - 100) * 0.5, 310, 100, 30)]; 78 + _nicknameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT * 0.2 + 110, SCREEN_WIDTH, 30)];
80 _nicknameLabel.textAlignment = NSTextAlignmentCenter; 79 _nicknameLabel.textAlignment = NSTextAlignmentCenter;
81 - _nicknameLabel.text = @"奥斯卡大家发你看"; 80 + _nicknameLabel.text = @"这是我的昵称哦";
82 } 81 }
83 return _nicknameLabel; 82 return _nicknameLabel;
84 } 83 }
@@ -86,9 +85,10 @@ @@ -86,9 +85,10 @@
86 - (UILabel *)playInfoLabel { 85 - (UILabel *)playInfoLabel {
87 86
88 if (!_playInfoLabel) { 87 if (!_playInfoLabel) {
89 - _playInfoLabel = [[UILabel alloc] initWithFrame:CGRectMake((SCREEN_WIDTH - 100) * 0.5, 350, 100, 50)]; 88 + _playInfoLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT * 0.5, SCREEN_WIDTH, 30)];
90 _playInfoLabel.textAlignment = NSTextAlignmentCenter; 89 _playInfoLabel.textAlignment = NSTextAlignmentCenter;
91 - _playInfoLabel.font = [UIFont systemFontOfSize:18]; 90 + _playInfoLabel.font = [UIFont systemFontOfSize:22];
  91 + _playInfoLabel.textColor = [UIColor orangeColor];
92 } 92 }
93 return _playInfoLabel; 93 return _playInfoLabel;
94 } 94 }
@@ -97,12 +97,15 @@ @@ -97,12 +97,15 @@
97 97
98 if (!_backButton) { 98 if (!_backButton) {
99 _backButton = [UIButton buttonWithType:UIButtonTypeCustom]; 99 _backButton = [UIButton buttonWithType:UIButtonTypeCustom];
100 - _backButton.frame = CGRectMake((SCREEN_WIDTH - 200) * 0.5, 410, 200, 40); 100 + _backButton.frame = CGRectMake(20, SCREEN_HEIGHT * 0.65, SCREEN_WIDTH - 40, 40);
101 _backButton.layer.cornerRadius = 20; 101 _backButton.layer.cornerRadius = 20;
102 _backButton.layer.masksToBounds = YES; 102 _backButton.layer.masksToBounds = YES;
103 - _backButton.titleLabel.text = @"返回列表"; 103 + [_backButton setTitle:@"返回列表" forState:UIControlStateNormal];
104 _backButton.titleLabel.textAlignment = NSTextAlignmentCenter; 104 _backButton.titleLabel.textAlignment = NSTextAlignmentCenter;
105 - _backButton.titleLabel.font = [UIFont systemFontOfSize:18]; 105 + _backButton.titleLabel.font = [UIFont systemFontOfSize:20];
  106 + _backButton.backgroundColor = [UIColor redColor];
  107 + [_backButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  108 + [_backButton setTitleColor:[UIColor blackColor] forState:UIControlStateHighlighted];
106 } 109 }
107 return _backButton; 110 return _backButton;
108 } 111 }
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCUGCLivePlayerCell.h 0 → 100644
  1 +//
  2 +// LVCUGCLivePlayerCell.h
  3 +// LiveVideoCloud
  4 +//
  5 +// Created by cnliveJunBo on 17/3/28.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +#import "LVCUGCPlayerLoadingView.h"
  11 +
  12 +@interface LVCUGCLivePlayerCell : UICollectionViewCell
  13 +
  14 +@property (nonatomic, strong) LVCUGCPlayerLoadingView *loadingView;
  15 +
  16 +@property (nonatomic, strong) CNLiveMoviePlayerController *player; // 播放器
  17 +
  18 +@end
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCUGCLivePlayerCell.m 0 → 100644
  1 +//
  2 +// LVCUGCLivePlayerCell.m
  3 +// LiveVideoCloud
  4 +//
  5 +// Created by cnliveJunBo on 17/3/28.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "LVCUGCLivePlayerCell.h"
  10 +
  11 +@implementation LVCUGCLivePlayerCell
  12 +
  13 +- (instancetype)initWithFrame:(CGRect)frame
  14 +{
  15 + self = [super initWithFrame:frame];
  16 + if (self) {
  17 + self.contentView.backgroundColor = [UIColor whiteColor];
  18 +
  19 + [self installMovieNotificationObservers];
  20 + [self addSubview:self.loadingView];
  21 + }
  22 + return self;
  23 +}
  24 +
  25 +#pragma mark - GetMethod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  26 +- (LVCUGCPlayerLoadingView *)loadingView {
  27 +
  28 + if (!_loadingView) {
  29 + _loadingView = [[LVCUGCPlayerLoadingView alloc] initWithFrame:self.contentView.bounds bgImageURLStr:@""];
  30 + }
  31 + return _loadingView;
  32 +}
  33 +
  34 +- (CNLiveMoviePlayerController *)player {
  35 +
  36 + if (!_player) {
  37 + _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:@"iOStest"
  38 + authSuccess:^{
  39 +
  40 + _player.videoDecoderMode = CNLiveMovieVideoDecoderMode_AUTO;
  41 + _player.view.frame = self.contentView.bounds;
  42 + _player.shouldAutoplay = YES;
  43 + [_player prepareToPlay];
  44 + [self.contentView addSubview:_player.view];
  45 + [self.contentView sendSubviewToBack:_player.view];
  46 +
  47 + } authFailed:^(NSDictionary *errorInfo) {
  48 + NSLog(@"初始化直播播放器失败:%@", errorInfo);
  49 +
  50 +
  51 + } getAnchorStatusResult:^(BOOL result) {
  52 +
  53 + NSLog(@"-------------获取主播状态%d", result ? YES : NO);
  54 +
  55 + }];
  56 + }
  57 + return _player;
  58 +}
  59 +
  60 +#pragma mark - 添加通知监听 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  61 +-(void)installMovieNotificationObservers //添加视频播放通知
  62 +{
  63 + //视频加载状态改变
  64 + [[NSNotificationCenter defaultCenter] addObserver:self
  65 + selector:@selector(loadStateDidChange:)
  66 + name:MPMoviePlayerLoadStateDidChangeNotification
  67 + object:nil];
  68 +
  69 + //视频播放错误及结束原因
  70 + [[NSNotificationCenter defaultCenter] addObserver:self
  71 + selector:@selector(moviePlayBackDidFinish:)
  72 + name:MPMoviePlayerPlaybackDidFinishNotification
  73 + object:nil];
  74 +
  75 + //视频缓冲至可播放状态
  76 + [[NSNotificationCenter defaultCenter] addObserver:self
  77 + selector:@selector(mediaIsPreparedToPlayDidChange:)
  78 + name:MPMediaPlaybackIsPreparedToPlayDidChangeNotification
  79 + object:nil];
  80 +
  81 + //视频播放状态改变
  82 + [[NSNotificationCenter defaultCenter] addObserver:self
  83 + selector:@selector(moviePlayBackStateDidChange:)
  84 + name:MPMoviePlayerPlaybackStateDidChangeNotification
  85 + object:nil];
  86 +
  87 +
  88 + //获取主播状态通知(点播和普通播放不需要注册该通知)
  89 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(anchorStatusChanged:)
  90 + name:CNLiveAnchorStatusChangedNotification
  91 + object:nil];
  92 +
  93 +}
  94 +
  95 +#pragma mark - 通知 Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  96 +//视频加载状态改变
  97 +- (void)loadStateDidChange:(NSNotification *)notification
  98 +{
  99 + if (_player) {
  100 + MPMovieLoadState loadState = _player.loadState;
  101 + if ((loadState & MPMovieLoadStatePlaythroughOK) != 0) {
  102 +
  103 + NSLog(@"loadStateDidChange: MPMovieLoadStatePlaythroughOK: %d\n", (int)loadState);
  104 +
  105 + } else if ((loadState & MPMovieLoadStateStalled) != 0) {
  106 + NSLog(@"loadStateDidChange: MPMovieLoadStateStalled: %d\n", (int)loadState);
  107 +
  108 + } else {
  109 + NSLog(@"loadStateDidChange: ???: %d\n", (int)loadState);
  110 + }
  111 + }
  112 +}
  113 +
  114 +//视频播放错误及结束原因
  115 +- (void)moviePlayBackDidFinish:(NSNotification *)notification
  116 +{
  117 + if (_player) {
  118 + int reason = [[[notification userInfo] valueForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey] intValue];
  119 + if (MPMovieFinishReasonPlaybackError == reason) {
  120 +
  121 +
  122 + } else {
  123 +
  124 + }
  125 +
  126 + switch (reason)
  127 + {
  128 + case MPMovieFinishReasonPlaybackEnded:
  129 + NSLog(@"playbackStateDidChange: MPMovieFinishReasonPlaybackEnded: %d\n", reason);
  130 + break;
  131 +
  132 + case MPMovieFinishReasonUserExited:
  133 + NSLog(@"playbackStateDidChange: MPMovieFinishReasonUserExited: %d\n", reason);
  134 + break;
  135 +
  136 + case MPMovieFinishReasonPlaybackError:
  137 + NSLog(@"playbackStateDidChange: MPMovieFinishReasonPlaybackError: %d\n", reason);
  138 + break;
  139 +
  140 + default:
  141 + NSLog(@"playbackPlayBackDidFinish: ???: %d\n", reason);
  142 + break;
  143 + }
  144 + }
  145 +}
  146 +
  147 +//视频缓冲至可播放状态
  148 +- (void)mediaIsPreparedToPlayDidChange:(NSNotification *)notification
  149 +{
  150 + if (_player) {
  151 + NSLog(@"isPreparedToPlay");
  152 + // if (_loadingView) {
  153 + // [_loadingView removeFromSuperview];
  154 + // }
  155 + }
  156 +}
  157 +
  158 +//视频播放状态改变
  159 +- (void)moviePlayBackStateDidChange:(NSNotification *)notification
  160 +{
  161 + if (_player) {
  162 +
  163 + switch (_player.playbackState) {
  164 + case MPMoviePlaybackStateStopped: {
  165 +
  166 + NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStateStopped");
  167 + break;
  168 + }
  169 + case MPMoviePlaybackStatePlaying: {
  170 +
  171 + NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStatePlaying");
  172 + break;
  173 + }
  174 + case MPMoviePlaybackStatePaused:
  175 +
  176 + NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStatePaused");
  177 + break;
  178 + case MPMoviePlaybackStateInterrupted:
  179 +
  180 + NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStateInterrupted");
  181 + break;
  182 + case MPMoviePlaybackStateSeekingForward:
  183 +
  184 + NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStateSeekingForward");
  185 + break;
  186 + case MPMoviePlaybackStateSeekingBackward:
  187 +
  188 + NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStateSeekingBackward");
  189 + break;
  190 + default:
  191 +
  192 + NSLog(@"moviePlayBackStateDidChange : %ld", (long)_player.playbackState);
  193 + break;
  194 + }
  195 + }
  196 +}
  197 +
  198 +
  199 +
  200 +// 获取主播状态通知
  201 +- (void)anchorStatusChanged:(NSNotification *)notification
  202 +{
  203 + if (_player.anchorStatus == 2) { // 已结束
  204 +
  205 + }
  206 +// _bgView.anchorStatus = _player.anchorStatus;
  207 +}
  208 +
  209 +//重新连接获取主播状态
  210 +- (void)anchorStatusConnectFailed
  211 +{
  212 +
  213 +}
  214 +
  215 +#pragma mark - 移除通知 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  216 +- (void)removeMovieNotificationObservers
  217 +{
  218 + [[NSNotificationCenter defaultCenter]removeObserver:self
  219 + name:MPMoviePlayerLoadStateDidChangeNotification
  220 + object:nil];
  221 + [[NSNotificationCenter defaultCenter]removeObserver:self
  222 + name:MPMoviePlayerPlaybackDidFinishNotification
  223 + object:nil];
  224 + [[NSNotificationCenter defaultCenter]removeObserver:self
  225 + name:MPMediaPlaybackIsPreparedToPlayDidChangeNotification
  226 + object:nil];
  227 + [[NSNotificationCenter defaultCenter]removeObserver:self
  228 + name:MPMoviePlayerPlaybackStateDidChangeNotification
  229 + object:nil];
  230 +
  231 + [[NSNotificationCenter defaultCenter]removeObserver:self
  232 + name:CNLiveAnchorStatusChangedNotification
  233 + object:nil];
  234 +}
  235 +
  236 +@end
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCUGCPlayerLoadingView.m
@@ -24,6 +24,7 @@ @@ -24,6 +24,7 @@
24 { 24 {
25 self = [super initWithFrame:frame]; 25 self = [super initWithFrame:frame];
26 if (self) { 26 if (self) {
  27 + self.backgroundColor = [UIColor whiteColor];
27 _bgImageURLStr = bgImageURLStr; 28 _bgImageURLStr = bgImageURLStr;
28 [self addSubview:self.bgImageView]; 29 [self addSubview:self.bgImageView];
29 } 30 }
LiveVideoCloud/LiveVideoCloud/UtilKits/Const/ZXConst.m
@@ -23,3 +23,4 @@ CGFloat const kContentFont = 14.0; @@ -23,3 +23,4 @@ CGFloat const kContentFont = 14.0;
23 23
24 /** 详细内容字体字号 */ 24 /** 详细内容字体字号 */
25 CGFloat const kDetailContentFont = 12.0; 25 CGFloat const kDetailContentFont = 12.0;
  26 +
LiveVideoCloud/LiveVideoCloud/UtilKits/Macro/Macros/NotificationMacro.h
@@ -16,5 +16,4 @@ @@ -16,5 +16,4 @@
16 /** 标题按钮重复点击的通知 */ 16 /** 标题按钮重复点击的通知 */
17 static NSString *const ZXTitleButtonDidRepeatClickNotification = @"ZXTitleButtonDidRepeatClickNotification"; 17 static NSString *const ZXTitleButtonDidRepeatClickNotification = @"ZXTitleButtonDidRepeatClickNotification";
18 18
19 -  
20 #endif /* NotificationMacro_h */ 19 #endif /* NotificationMacro_h */
LiveVideoCloud/LiveVideoCloud/UtilKits/Macro/Macros/UserDefaultKeyMacro.h
@@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
16 /** 用户搜索信息key */ 16 /** 用户搜索信息key */
17 static NSString *const UserInfoAllKeys = @"UserInfoAllKeys"; 17 static NSString *const UserInfoAllKeys = @"UserInfoAllKeys";
18 18
19 - 19 +/** 当前键盘监听者 */
  20 +static NSString *const keyboard = @"keyboard";
20 21
21 #endif /* UserDefaultKeyMacro_h */ 22 #endif /* UserDefaultKeyMacro_h */
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/close.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "idiom" : "universal",
  9 + "scale" : "2x"
  10 + },
  11 + {
  12 + "idiom" : "universal",
  13 + "scale" : "3x"
  14 + },
  15 + {
  16 + "idiom" : "iphone",
  17 + "scale" : "1x"
  18 + },
  19 + {
  20 + "idiom" : "iphone",
  21 + "filename" : "close.png",
  22 + "scale" : "2x"
  23 + },
  24 + {
  25 + "idiom" : "iphone",
  26 + "scale" : "3x"
  27 + }
  28 + ],
  29 + "info" : {
  30 + "version" : 1,
  31 + "author" : "xcode"
  32 + }
  33 +}
0 \ No newline at end of file 34 \ No newline at end of file
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/close.imageset/close.png 0 → 100644

2.47 KB

LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/priToolBg.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "filename" : "priToolBg.png",
  6 + "scale" : "1x"
  7 + }
  8 + ],
  9 + "info" : {
  10 + "version" : 1,
  11 + "author" : "xcode"
  12 + }
  13 +}
0 \ No newline at end of file 14 \ No newline at end of file
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/priToolBg.imageset/priToolBg.png 0 → 100644

1.53 KB