Commit 1a6759d44943e7eb232ad186c2cceec6d369560d

Authored by 王军波
1 parent 1294b520

开始collectionView

LiveVideoCloud/LiveVideoCloud.xcodeproj/project.pbxproj
@@ -188,6 +188,7 @@ @@ -188,6 +188,7 @@
188 D2888DB41E6EC154003A77C8 /* HomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888DB31E6EC154003A77C8 /* HomeViewController.m */; }; 188 D2888DB41E6EC154003A77C8 /* HomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888DB31E6EC154003A77C8 /* HomeViewController.m */; };
189 D2888DB71E6EC1B8003A77C8 /* LVCMyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888DB61E6EC1B8003A77C8 /* LVCMyViewController.m */; }; 189 D2888DB71E6EC1B8003A77C8 /* LVCMyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888DB61E6EC1B8003A77C8 /* LVCMyViewController.m */; };
190 D29D88481E88C53300543A03 /* LVCUGCLivePrepareView.m in Sources */ = {isa = PBXBuildFile; fileRef = D29D88471E88C53300543A03 /* LVCUGCLivePrepareView.m */; }; 190 D29D88481E88C53300543A03 /* LVCUGCLivePrepareView.m in Sources */ = {isa = PBXBuildFile; fileRef = D29D88471E88C53300543A03 /* LVCUGCLivePrepareView.m */; };
  191 + D2A089E81E89FA720071412C /* LVCUGCLivePlayerCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D2A089E71E89FA720071412C /* LVCUGCLivePlayerCell.m */; };
191 D2A803081E80BD6F009D6F1C /* TopToolView.m in Sources */ = {isa = PBXBuildFile; fileRef = D2A803071E80BD6F009D6F1C /* TopToolView.m */; }; 192 D2A803081E80BD6F009D6F1C /* TopToolView.m in Sources */ = {isa = PBXBuildFile; fileRef = D2A803071E80BD6F009D6F1C /* TopToolView.m */; };
192 D2B2ED7A1E88F90C00F7538A /* CNLiveChatManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B21E88F8E600B7C517 /* CNLiveChatManager.framework */; }; 193 D2B2ED7A1E88F90C00F7538A /* CNLiveChatManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B21E88F8E600B7C517 /* CNLiveChatManager.framework */; };
193 D2B2ED7B1E88F90C00F7538A /* CNLiveChatManager.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B21E88F8E600B7C517 /* CNLiveChatManager.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 194 D2B2ED7B1E88F90C00F7538A /* CNLiveChatManager.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B21E88F8E600B7C517 /* CNLiveChatManager.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
@@ -197,6 +198,7 @@ @@ -197,6 +198,7 @@
197 D2B7B2511E8247D400ED084E /* ChatBarrageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B7B2501E8247D400ED084E /* ChatBarrageManager.m */; }; 198 D2B7B2511E8247D400ED084E /* ChatBarrageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B7B2501E8247D400ED084E /* ChatBarrageManager.m */; };
198 D2B7B2541E824B2D00ED084E /* ChatBarrageView.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B7B2531E824B2D00ED084E /* ChatBarrageView.m */; }; 199 D2B7B2541E824B2D00ED084E /* ChatBarrageView.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B7B2531E824B2D00ED084E /* ChatBarrageView.m */; };
199 D2B7B2571E8261EF00ED084E /* ChatBarrOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B7B2561E8261EF00ED084E /* ChatBarrOperation.m */; }; 200 D2B7B2571E8261EF00ED084E /* ChatBarrOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B7B2561E8261EF00ED084E /* ChatBarrOperation.m */; };
  201 + D2CC7B871E891AA50034B8BF /* LVCUGCLiveListController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2CC7B861E891AA50034B8BF /* LVCUGCLiveListController.m */; };
200 D2D236B41E88F8E600B7C517 /* CNLiveChatManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B21E88F8E600B7C517 /* CNLiveChatManager.framework */; }; 202 D2D236B41E88F8E600B7C517 /* CNLiveChatManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B21E88F8E600B7C517 /* CNLiveChatManager.framework */; };
201 D2D236B51E88F8E600B7C517 /* CNLiveMsgTools.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B31E88F8E600B7C517 /* CNLiveMsgTools.framework */; }; 203 D2D236B51E88F8E600B7C517 /* CNLiveMsgTools.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B31E88F8E600B7C517 /* CNLiveMsgTools.framework */; };
202 /* End PBXBuildFile section */ 204 /* End PBXBuildFile section */
@@ -610,6 +612,8 @@ @@ -610,6 +612,8 @@
610 D2888DB61E6EC1B8003A77C8 /* LVCMyViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCMyViewController.m; sourceTree = "<group>"; }; 612 D2888DB61E6EC1B8003A77C8 /* LVCMyViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCMyViewController.m; sourceTree = "<group>"; };
611 D29D88461E88C53300543A03 /* LVCUGCLivePrepareView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCUGCLivePrepareView.h; sourceTree = "<group>"; }; 613 D29D88461E88C53300543A03 /* LVCUGCLivePrepareView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCUGCLivePrepareView.h; sourceTree = "<group>"; };
612 D29D88471E88C53300543A03 /* LVCUGCLivePrepareView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCUGCLivePrepareView.m; sourceTree = "<group>"; }; 614 D29D88471E88C53300543A03 /* LVCUGCLivePrepareView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCUGCLivePrepareView.m; sourceTree = "<group>"; };
  615 + D2A089E61E89FA720071412C /* LVCUGCLivePlayerCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCUGCLivePlayerCell.h; sourceTree = "<group>"; };
  616 + D2A089E71E89FA720071412C /* LVCUGCLivePlayerCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCUGCLivePlayerCell.m; sourceTree = "<group>"; };
613 D2A803061E80BD6F009D6F1C /* TopToolView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopToolView.h; sourceTree = "<group>"; }; 617 D2A803061E80BD6F009D6F1C /* TopToolView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopToolView.h; sourceTree = "<group>"; };
614 D2A803071E80BD6F009D6F1C /* TopToolView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopToolView.m; sourceTree = "<group>"; }; 618 D2A803071E80BD6F009D6F1C /* TopToolView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopToolView.m; sourceTree = "<group>"; };
615 D2B2ED7E1E88FC5200F7538A /* LVCUGCLiveEndView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCUGCLiveEndView.h; sourceTree = "<group>"; }; 619 D2B2ED7E1E88FC5200F7538A /* LVCUGCLiveEndView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCUGCLiveEndView.h; sourceTree = "<group>"; };
@@ -620,6 +624,8 @@ @@ -620,6 +624,8 @@
620 D2B7B2531E824B2D00ED084E /* ChatBarrageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChatBarrageView.m; sourceTree = "<group>"; }; 624 D2B7B2531E824B2D00ED084E /* ChatBarrageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChatBarrageView.m; sourceTree = "<group>"; };
621 D2B7B2551E8261EF00ED084E /* ChatBarrOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChatBarrOperation.h; sourceTree = "<group>"; }; 625 D2B7B2551E8261EF00ED084E /* ChatBarrOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChatBarrOperation.h; sourceTree = "<group>"; };
622 D2B7B2561E8261EF00ED084E /* ChatBarrOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChatBarrOperation.m; sourceTree = "<group>"; }; 626 D2B7B2561E8261EF00ED084E /* ChatBarrOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChatBarrOperation.m; sourceTree = "<group>"; };
  627 + D2CC7B851E891AA50034B8BF /* LVCUGCLiveListController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCUGCLiveListController.h; sourceTree = "<group>"; };
  628 + D2CC7B861E891AA50034B8BF /* LVCUGCLiveListController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCUGCLiveListController.m; sourceTree = "<group>"; };
623 D2D236B21E88F8E600B7C517 /* CNLiveChatManager.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLiveChatManager.framework; sourceTree = "<group>"; }; 629 D2D236B21E88F8E600B7C517 /* CNLiveChatManager.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLiveChatManager.framework; sourceTree = "<group>"; };
624 D2D236B31E88F8E600B7C517 /* CNLiveMsgTools.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLiveMsgTools.framework; sourceTree = "<group>"; }; 630 D2D236B31E88F8E600B7C517 /* CNLiveMsgTools.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLiveMsgTools.framework; sourceTree = "<group>"; };
625 /* End PBXFileReference section */ 631 /* End PBXFileReference section */
@@ -1622,6 +1628,8 @@ @@ -1622,6 +1628,8 @@
1622 810B64E21E779AFE00133E15 /* LVCLivePlayerController.m */, 1628 810B64E21E779AFE00133E15 /* LVCLivePlayerController.m */,
1623 810B65081E77B39D00133E15 /* LVCFullScreenPlayerController.h */, 1629 810B65081E77B39D00133E15 /* LVCFullScreenPlayerController.h */,
1624 810B65091E77B39D00133E15 /* LVCFullScreenPlayerController.m */, 1630 810B65091E77B39D00133E15 /* LVCFullScreenPlayerController.m */,
  1631 + D2CC7B851E891AA50034B8BF /* LVCUGCLiveListController.h */,
  1632 + D2CC7B861E891AA50034B8BF /* LVCUGCLiveListController.m */,
1625 D25BF87E1E7BD266007FB138 /* LVCUGCLivePlayerController.h */, 1633 D25BF87E1E7BD266007FB138 /* LVCUGCLivePlayerController.h */,
1626 D25BF87F1E7BD266007FB138 /* LVCUGCLivePlayerController.m */, 1634 D25BF87F1E7BD266007FB138 /* LVCUGCLivePlayerController.m */,
1627 81A483151E88BED00097A80A /* LVCTVLiveViewController.h */, 1635 81A483151E88BED00097A80A /* LVCTVLiveViewController.h */,
@@ -1650,6 +1658,8 @@ @@ -1650,6 +1658,8 @@
1650 81A483041E88B32C0097A80A /* LVCHeaderRollCollectionViewCell.m */, 1658 81A483041E88B32C0097A80A /* LVCHeaderRollCollectionViewCell.m */,
1651 8112D42F1E7927A5002E00F6 /* LVCPlayerLoadingView.h */, 1659 8112D42F1E7927A5002E00F6 /* LVCPlayerLoadingView.h */,
1652 8112D4301E7927A5002E00F6 /* LVCPlayerLoadingView.m */, 1660 8112D4301E7927A5002E00F6 /* LVCPlayerLoadingView.m */,
  1661 + D2A089E61E89FA720071412C /* LVCUGCLivePlayerCell.h */,
  1662 + D2A089E71E89FA720071412C /* LVCUGCLivePlayerCell.m */,
1653 D25BF8811E7F775F007FB138 /* LVCUGCPlayerLoadingView.h */, 1663 D25BF8811E7F775F007FB138 /* LVCUGCPlayerLoadingView.h */,
1654 D25BF8821E7F775F007FB138 /* LVCUGCPlayerLoadingView.m */, 1664 D25BF8821E7F775F007FB138 /* LVCUGCPlayerLoadingView.m */,
1655 D25BF8911E7FBAEA007FB138 /* LVCUGCBackgroundView.h */, 1665 D25BF8911E7FBAEA007FB138 /* LVCUGCBackgroundView.h */,
@@ -1881,6 +1891,7 @@ @@ -1881,6 +1891,7 @@
1881 D2029C941E6EADE10027CD92 /* UIRefreshControl+AFNetworking.m in Sources */, 1891 D2029C941E6EADE10027CD92 /* UIRefreshControl+AFNetworking.m in Sources */,
1882 D2029C911E6EADE10027CD92 /* UIButton+AFNetworking.m in Sources */, 1892 D2029C911E6EADE10027CD92 /* UIButton+AFNetworking.m in Sources */,
1883 D2029C931E6EADE10027CD92 /* UIProgressView+AFNetworking.m in Sources */, 1893 D2029C931E6EADE10027CD92 /* UIProgressView+AFNetworking.m in Sources */,
  1894 + D2A089E81E89FA720071412C /* LVCUGCLivePlayerCell.m in Sources */,
1884 D2029C8D1E6EADE10027CD92 /* AFAutoPurgingImageCache.m in Sources */, 1895 D2029C8D1E6EADE10027CD92 /* AFAutoPurgingImageCache.m in Sources */,
1885 81A483111E88B8630097A80A /* LVCChannelDetailsModel.m in Sources */, 1896 81A483111E88B8630097A80A /* LVCChannelDetailsModel.m in Sources */,
1886 D2029D011E6EAE2E0027CD92 /* UIColor+HexString.m in Sources */, 1897 D2029D011E6EAE2E0027CD92 /* UIColor+HexString.m in Sources */,
@@ -1989,6 +2000,7 @@ @@ -1989,6 +2000,7 @@
1989 D2029D081E6EAE2E0027CD92 /* ZXDeviceInfo.m in Sources */, 2000 D2029D081E6EAE2E0027CD92 /* ZXDeviceInfo.m in Sources */,
1990 D24571631E83C40B00AA85D6 /* PrivateView.m in Sources */, 2001 D24571631E83C40B00AA85D6 /* PrivateView.m in Sources */,
1991 D2029CC21E6EADE10027CD92 /* UIImage+WebP.m in Sources */, 2002 D2029CC21E6EADE10027CD92 /* UIImage+WebP.m in Sources */,
  2003 + D2CC7B871E891AA50034B8BF /* LVCUGCLiveListController.m in Sources */,
1992 D2029BCD1E6EADD70027CD92 /* BaseViewController.m in Sources */, 2004 D2029BCD1E6EADD70027CD92 /* BaseViewController.m in Sources */,
1993 810B64E01E779AE900133E15 /* LVCPlayer.m in Sources */, 2005 810B64E01E779AE900133E15 /* LVCPlayer.m in Sources */,
1994 810B64FF1E779B1F00133E15 /* MASConstraint.m in Sources */, 2006 810B64FF1E779B1F00133E15 /* MASConstraint.m in Sources */,
LiveVideoCloud/LiveVideoCloud/Classes/Sections/LiveSections/Controller/LVCLiveViewController.m
@@ -13,9 +13,6 @@ @@ -13,9 +13,6 @@
13 #import "LVCUGCLivePrepareView.h" 13 #import "LVCUGCLivePrepareView.h"
14 #import "LVCUGCLiveEndView.h" 14 #import "LVCUGCLiveEndView.h"
15 15
16 -#define KAppId @"60_irn9edco29"  
17 -#define KAppKey @"69fe70bda67e059286ad509d9f5377f815955645b52f94"  
18 -  
19 @interface LVCLiveViewController ()<UIGestureRecognizerDelegate> { 16 @interface LVCLiveViewController ()<UIGestureRecognizerDelegate> {
20 17
21 BOOL _isStreaming; 18 BOOL _isStreaming;
@@ -59,8 +56,6 @@ @@ -59,8 +56,6 @@
59 // 初始化推流 56 // 初始化推流
60 NSString *activityId = [NSString stringWithFormat:@"%d%d%d%d%d",arc4random()%9,arc4random()%9,arc4random()%9,arc4random()%9,arc4random()%9]; 57 NSString *activityId = [NSString stringWithFormat:@"%d%d%d%d%d",arc4random()%9,arc4random()%9,arc4random()%9,arc4random()%9,arc4random()%9];
61 58
62 - [[CNLiveWebcastManager manager] initWithAppId:KAppId appKey:KAppKey];  
63 -  
64 _kitCN = [[CNLiveGPUStreamerKit alloc] initWithDefaultConfigWithActivityId:activityId channelId:@"iOStest" isHorizontalScreen:@"0"]; 59 _kitCN = [[CNLiveGPUStreamerKit alloc] initWithDefaultConfigWithActivityId:activityId channelId:@"iOStest" isHorizontalScreen:@"0"];
65 60
66 // _kitCN.activityName = @"iOS test"; 61 // _kitCN.activityName = @"iOS test";
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/HomeViewController.m
@@ -12,6 +12,7 @@ @@ -12,6 +12,7 @@
12 #import "LVCLivePlayerController.h" 12 #import "LVCLivePlayerController.h"
13 #import "LVCUGCLivePlayerController.h" 13 #import "LVCUGCLivePlayerController.h"
14 #import "LVCTVLiveViewController.h" 14 #import "LVCTVLiveViewController.h"
  15 +#import "LVCUGCLiveListController.h"
15 16
16 @interface HomeViewController () 17 @interface HomeViewController ()
17 18
@@ -50,6 +51,11 @@ @@ -50,6 +51,11 @@
50 [UGCLiveBtn setTitle:@"UGC直播" forState:UIControlStateNormal]; 51 [UGCLiveBtn setTitle:@"UGC直播" forState:UIControlStateNormal];
51 [UGCLiveBtn addTarget:self action:@selector(UGCLiveAction) forControlEvents:UIControlEventTouchUpInside]; 52 [UGCLiveBtn addTarget:self action:@selector(UGCLiveAction) forControlEvents:UIControlEventTouchUpInside];
52 [self.view addSubview:UGCLiveBtn]; 53 [self.view addSubview:UGCLiveBtn];
  54 + UIButton *UGCLiveListBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  55 + UGCLiveListBtn.frame = CGRectMake(0, 300, self.view.width, 40);
  56 + [UGCLiveListBtn setTitle:@"UGC直播列表" forState:UIControlStateNormal];
  57 + [UGCLiveListBtn addTarget:self action:@selector(UGCLiveListAction) forControlEvents:UIControlEventTouchUpInside];
  58 + [self.view addSubview:UGCLiveListBtn];
53 59
54 [[UIApplication sharedApplication].keyWindow addSubview:self.interactionBtn]; 60 [[UIApplication sharedApplication].keyWindow addSubview:self.interactionBtn];
55 } 61 }
@@ -67,6 +73,12 @@ @@ -67,6 +73,12 @@
67 [self.navigationController pushViewController:UGCLiveVC animated:YES]; 73 [self.navigationController pushViewController:UGCLiveVC animated:YES];
68 } 74 }
69 75
  76 +- (void)UGCLiveListAction
  77 +{
  78 + LVCUGCLiveListController *listVC = [[LVCUGCLiveListController alloc] init];
  79 + [self.navigationController pushViewController:listVC animated:YES];
  80 +}
  81 +
70 - (void)interactionAction 82 - (void)interactionAction
71 { 83 {
72 LVCInteractionController *intVC = [[LVCInteractionController alloc] init]; 84 LVCInteractionController *intVC = [[LVCInteractionController alloc] init];
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,18 @@ @@ -10,18 +10,18 @@
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 +
  19 +@property (nonatomic, strong) UICollectionView *collectionView;
18 20
19 @property (nonatomic, strong) CNLiveMoviePlayerController *player;// 播放器 21 @property (nonatomic, strong) CNLiveMoviePlayerController *player;// 播放器
20 22
21 @property (nonatomic, strong) LVCUGCBackgroundView *bgView; // 背景视图 23 @property (nonatomic, strong) LVCUGCBackgroundView *bgView; // 背景视图
22 24
23 -@property (nonatomic, strong) LVCUGCPlayerLoadingView *loadingView; // 加载视图  
24 -  
25 @end 25 @end
26 26
27 @implementation LVCUGCLivePlayerController 27 @implementation LVCUGCLivePlayerController
@@ -45,14 +45,12 @@ @@ -45,14 +45,12 @@
45 45
46 self.view.backgroundColor = [UIColor whiteColor]; 46 self.view.backgroundColor = [UIColor whiteColor];
47 47
48 - [self.view addSubview:self.loadingView];  
49 [self.view addSubview:self.bgView]; 48 [self.view addSubview:self.bgView];
  49 + [self.view addSubview:self.collectionView];
50 50
51 //添加播放器通知 51 //添加播放器通知
52 [self installMovieNotificationObservers]; 52 [self installMovieNotificationObservers];
53 53
54 - [[CNLiveWebcastManager manager] initWithAppId:KAppId appKey:KAppKey];  
55 -  
56 //直播播放 54 //直播播放
57 _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:@"iOStest" 55 _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:@"iOStest"
58 authSuccess:^{ 56 authSuccess:^{
@@ -110,7 +108,7 @@ @@ -110,7 +108,7 @@
110 108
111 } 109 }
112 110
113 -#pragma mark - 移除通知 111 +#pragma mark - 移除通知 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
114 - (void)removeMovieNotificationObservers 112 - (void)removeMovieNotificationObservers
115 { 113 {
116 [[NSNotificationCenter defaultCenter]removeObserver:self 114 [[NSNotificationCenter defaultCenter]removeObserver:self
@@ -188,9 +186,9 @@ @@ -188,9 +186,9 @@
188 { 186 {
189 if (_player) { 187 if (_player) {
190 NSLog(@"isPreparedToPlay"); 188 NSLog(@"isPreparedToPlay");
191 - if (_loadingView) {  
192 - [_loadingView removeFromSuperview];  
193 - } 189 +// if (_loadingView) {
  190 +// [_loadingView removeFromSuperview];
  191 +// }
194 } 192 }
195 } 193 }
196 194
@@ -251,20 +249,52 @@ @@ -251,20 +249,52 @@
251 249
252 } 250 }
253 251
254 -#pragma mark - getter  
255 -- (LVCUGCPlayerLoadingView *)loadingView { 252 +#pragma mark - UICollectionViewDelegate, UICollectionViewDataSource !!!!!!!!!!!!!!!!!!!!!!!!!!!
  253 +- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
  254 +
  255 + return 1;
  256 +}
  257 +
  258 +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
  259 +
  260 + return 4;
  261 +}
  262 +
  263 +- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
  264 +
  265 + LVCUGCLivePlayerCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellId forIndexPath:indexPath];
  266 +
  267 + return cell;
  268 +}
  269 +
  270 +- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
  271 +
  272 +
  273 +}
  274 +
  275 +
  276 +#pragma mark - getMethod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  277 +- (UICollectionView *)collectionView {
256 278
257 - if (!_loadingView) {  
258 - _loadingView = [[LVCUGCPlayerLoadingView alloc] initWithFrame:self.view.bounds bgImageURLStr:@""]; 279 + if (!_collectionView) {
  280 + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
  281 + layout.minimumLineSpacing = 0;
  282 + layout.minimumInteritemSpacing = 0;
  283 + layout.itemSize = self.view.bounds.size;
  284 + _collectionView = [[UICollectionView alloc] initWithFrame:self.view.bounds collectionViewLayout:layout];
  285 + _collectionView.pagingEnabled = YES;
  286 + _collectionView.showsHorizontalScrollIndicator = NO;
  287 + _collectionView.dataSource = self;
  288 + _collectionView.delegate = self;
  289 + [_collectionView registerClass:[LVCUGCLivePlayerCell class] forCellWithReuseIdentifier:cellId];
259 } 290 }
260 - return _loadingView; 291 + return _collectionView;
261 } 292 }
262 293
263 - (LVCUGCBackgroundView *)bgView { 294 - (LVCUGCBackgroundView *)bgView {
264 295
265 if (!_bgView) { 296 if (!_bgView) {
266 - _bgView = [[LVCUGCBackgroundView alloc] init];  
267 - _bgView.backgroundColor = [UIColor whiteColor]; 297 + _bgView = [[LVCUGCBackgroundView alloc] initWithFrame:self.view.bounds];
268 _bgView.hidden = YES; 298 _bgView.hidden = YES;
269 } 299 }
270 return _bgView; 300 return _bgView;
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 +@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 + [self addSubview:self.loadingView];
  19 + }
  20 + return self;
  21 +}
  22 +
  23 +#pragma mark - GetMethod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  24 +- (LVCUGCPlayerLoadingView *)loadingView {
  25 +
  26 + if (!_loadingView) {
  27 + _loadingView = [[LVCUGCPlayerLoadingView alloc] initWithFrame:self.contentView.bounds bgImageURLStr:@""];
  28 + }
  29 + return _loadingView;
  30 +}
  31 +
  32 +@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 }