Commit 1d41702dacafaf040246126a9698ad27b83ccfdc

Authored by 朱林
2 parents 45591957 7e4f59a6

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

Conflicts:
	LiveVideoCloud/LiveVideoCloud/AppDelegate/AppDelegate.m
	LiveVideoCloud/LiveVideoCloud/Classes/Sections/LiveSections/Controller/LVCLiveViewController.m
Showing 39 changed files with 780 additions and 355 deletions
LiveVideoCloud/LiveVideoCloud.xcodeproj/project.pbxproj
... ... @@ -192,6 +192,8 @@
192 192 D29E81ED1E88DC5B008C9906 /* PriChatCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D29E81EC1E88DC5B008C9906 /* PriChatCell.m */; };
193 193 D2A089E81E89FA720071412C /* LVCUGCLivePlayerCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D2A089E71E89FA720071412C /* LVCUGCLivePlayerCell.m */; };
194 194 D2A089EB1E8A09CB0071412C /* LVCUGCLivePlayerModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D2A089EA1E8A09CB0071412C /* LVCUGCLivePlayerModel.m */; };
  195 + D2A089EE1E8A336A0071412C /* LiveLIstService.m in Sources */ = {isa = PBXBuildFile; fileRef = D2A089ED1E8A336A0071412C /* LiveLIstService.m */; };
  196 + D2A089F11E8A41120071412C /* LVCUGCLiveListModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D2A089F01E8A41120071412C /* LVCUGCLiveListModel.m */; };
195 197 D2A803081E80BD6F009D6F1C /* TopToolView.m in Sources */ = {isa = PBXBuildFile; fileRef = D2A803071E80BD6F009D6F1C /* TopToolView.m */; };
196 198 D2B2ED7A1E88F90C00F7538A /* CNLiveChatManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B21E88F8E600B7C517 /* CNLiveChatManager.framework */; };
197 199 D2B2ED7B1E88F90C00F7538A /* CNLiveChatManager.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B21E88F8E600B7C517 /* CNLiveChatManager.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
... ... @@ -204,6 +206,7 @@
204 206 D2CC7B871E891AA50034B8BF /* LVCUGCLiveListController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2CC7B861E891AA50034B8BF /* LVCUGCLiveListController.m */; };
205 207 D2D236B41E88F8E600B7C517 /* CNLiveChatManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B21E88F8E600B7C517 /* CNLiveChatManager.framework */; };
206 208 D2D236B51E88F8E600B7C517 /* CNLiveMsgTools.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B31E88F8E600B7C517 /* CNLiveMsgTools.framework */; };
  209 + D2D7D18D1E8A581000217771 /* timg.jpeg in Resources */ = {isa = PBXBuildFile; fileRef = D2D7D18C1E8A581000217771 /* timg.jpeg */; };
207 210 /* End PBXBuildFile section */
208 211  
209 212 /* Begin PBXContainerItemProxy section */
... ... @@ -623,6 +626,10 @@
623 626 D2A089E71E89FA720071412C /* LVCUGCLivePlayerCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCUGCLivePlayerCell.m; sourceTree = "<group>"; };
624 627 D2A089E91E8A09CB0071412C /* LVCUGCLivePlayerModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCUGCLivePlayerModel.h; sourceTree = "<group>"; };
625 628 D2A089EA1E8A09CB0071412C /* LVCUGCLivePlayerModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCUGCLivePlayerModel.m; sourceTree = "<group>"; };
  629 + D2A089EC1E8A336A0071412C /* LiveLIstService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LiveLIstService.h; sourceTree = "<group>"; };
  630 + D2A089ED1E8A336A0071412C /* LiveLIstService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LiveLIstService.m; sourceTree = "<group>"; };
  631 + D2A089EF1E8A41120071412C /* LVCUGCLiveListModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCUGCLiveListModel.h; sourceTree = "<group>"; };
  632 + D2A089F01E8A41120071412C /* LVCUGCLiveListModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCUGCLiveListModel.m; sourceTree = "<group>"; };
626 633 D2A803061E80BD6F009D6F1C /* TopToolView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopToolView.h; sourceTree = "<group>"; };
627 634 D2A803071E80BD6F009D6F1C /* TopToolView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopToolView.m; sourceTree = "<group>"; };
628 635 D2B2ED7E1E88FC5200F7538A /* LVCUGCLiveEndView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCUGCLiveEndView.h; sourceTree = "<group>"; };
... ... @@ -637,6 +644,7 @@
637 644 D2CC7B861E891AA50034B8BF /* LVCUGCLiveListController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCUGCLiveListController.m; sourceTree = "<group>"; };
638 645 D2D236B21E88F8E600B7C517 /* CNLiveChatManager.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLiveChatManager.framework; sourceTree = "<group>"; };
639 646 D2D236B31E88F8E600B7C517 /* CNLiveMsgTools.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLiveMsgTools.framework; sourceTree = "<group>"; };
  647 + D2D7D18C1E8A581000217771 /* timg.jpeg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = timg.jpeg; sourceTree = "<group>"; };
640 648 /* End PBXFileReference section */
641 649  
642 650 /* Begin PBXFrameworksBuildPhase section */
... ... @@ -754,6 +762,8 @@
754 762 81A4831F1E88F4BF0097A80A /* LVCProgramModel.m */,
755 763 81A482FF1E88B0130097A80A /* LVCChatRoomModel.h */,
756 764 81A483001E88B0130097A80A /* LVCChatRoomModel.m */,
  765 + D2A089EF1E8A41120071412C /* LVCUGCLiveListModel.h */,
  766 + D2A089F01E8A41120071412C /* LVCUGCLiveListModel.m */,
757 767 D2A089E91E8A09CB0071412C /* LVCUGCLivePlayerModel.h */,
758 768 D2A089EA1E8A09CB0071412C /* LVCUGCLivePlayerModel.m */,
759 769 );
... ... @@ -1567,6 +1577,7 @@
1567 1577 D25BF88C1E7F7F77007FB138 /* Images */ = {
1568 1578 isa = PBXGroup;
1569 1579 children = (
  1580 + D2D7D18C1E8A581000217771 /* timg.jpeg */,
1570 1581 D25BF88F1E7F7F8F007FB138 /* UGCLoading.jpeg */,
1571 1582 D25BF8A41E80EC76007FB138 /* 头像.jpg */,
1572 1583 );
... ... @@ -1650,6 +1661,8 @@
1650 1661 81A483161E88BED00097A80A /* LVCTVLiveViewController.m */,
1651 1662 81A483181E88E19C0097A80A /* LVCMoreProgramViewController.h */,
1652 1663 81A483191E88E19C0097A80A /* LVCMoreProgramViewController.m */,
  1664 + D2A089EC1E8A336A0071412C /* LiveLIstService.h */,
  1665 + D2A089ED1E8A336A0071412C /* LiveLIstService.m */,
1653 1666 );
1654 1667 path = Controller;
1655 1668 sourceTree = "<group>";
... ... @@ -1851,6 +1864,7 @@
1851 1864 D2575C801E76A4F300E3A8FC /* resource.bundle in Resources */,
1852 1865 D2029B941E6EAAA50027CD92 /* LaunchScreen.storyboard in Resources */,
1853 1866 D2029B911E6EAAA50027CD92 /* animation.xcassets in Resources */,
  1867 + D2D7D18D1E8A581000217771 /* timg.jpeg in Resources */,
1854 1868 D2029CB01E6EADE10027CD92 /* MJRefresh.bundle in Resources */,
1855 1869 D2575C7C1E76A4F300E3A8FC /* NHFighterView.nib in Resources */,
1856 1870 D25BF87D1E7B8C78007FB138 /* KSYGPUResource.bundle in Resources */,
... ... @@ -1903,6 +1917,7 @@
1903 1917 8130911E1E84C0F0005F0BFF /* LVCMessage.m in Sources */,
1904 1918 D23696841E7FC6A900E4BF71 /* chatListCell.m in Sources */,
1905 1919 D2029CAF1E6EADE10027CD92 /* MJRefreshStateHeader.m in Sources */,
  1920 + D2A089EE1E8A336A0071412C /* LiveLIstService.m in Sources */,
1906 1921 D2029C941E6EADE10027CD92 /* UIRefreshControl+AFNetworking.m in Sources */,
1907 1922 D2029C911E6EADE10027CD92 /* UIButton+AFNetworking.m in Sources */,
1908 1923 D2029C931E6EADE10027CD92 /* UIProgressView+AFNetworking.m in Sources */,
... ... @@ -1976,6 +1991,7 @@
1976 1991 D2029C991E6EADE10027CD92 /* MJFoundation.m in Sources */,
1977 1992 D2575C461E76857100E3A8FC /* LVCAnimationManager.m in Sources */,
1978 1993 D2029C8A1E6EADE10027CD92 /* AFURLRequestSerialization.m in Sources */,
  1994 + D2A089F11E8A41120071412C /* LVCUGCLiveListModel.m in Sources */,
1979 1995 D2029D041E6EAE2E0027CD92 /* UILabel+ContentSize.m in Sources */,
1980 1996 D25530031E79115100DF38A5 /* AnimQueueManager.m in Sources */,
1981 1997 D2029C871E6EADE10027CD92 /* AFHTTPSessionManager.m in Sources */,
... ...
LiveVideoCloud/LiveVideoCloud/AppDelegate/AppDelegate.m
... ... @@ -9,6 +9,9 @@
9 9 #import "AppDelegate.h"
10 10 #import "ZXTabBarController.h"
11 11  
  12 +#define KAppId @"60_irn9edco29"
  13 +#define KAppKey @"69fe70bda67e059286ad509d9f5377f815955645b52f94"
  14 +
12 15 @interface AppDelegate ()
13 16  
14 17 @end
... ...
LiveVideoCloud/LiveVideoCloud/Classes/SDK/AFNetworking/AFURLResponseSerialization.m
... ... @@ -223,7 +223,7 @@ static id AFJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingO
223 223 return nil;
224 224 }
225 225  
226   - self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", nil];
  226 + self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", @"text/html", @"text/plain", nil];
227 227  
228 228 return self;
229 229 }
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/BottomToolView/BottomToolView.m
... ... @@ -13,6 +13,7 @@
13 13 @property (nonatomic ,strong) UIButton * _Nullable chatBtn;
14 14 @property (nonatomic ,strong) UIButton * _Nullable privateChatBtn;
15 15 @property (nonatomic ,strong) UIButton * _Nullable giftBtn;
  16 +@property (nonatomic ,strong) UIImageView * _Nullable bgView;
16 17  
17 18 @end
18 19  
... ... @@ -21,6 +22,7 @@
21 22 - (instancetype)initWithFrame:(CGRect)frame
22 23 {
23 24 if (self = [super initWithFrame:frame]) {
  25 + [self addSubview:self.bgView];
24 26 [self addSubview:self.chatBtn];
25 27 [self addSubview:self.privateChatBtn];
26 28 [self addSubview:self.giftBtn];
... ... @@ -50,6 +52,16 @@
50 52 }
51 53 }
52 54  
  55 +- (UIImageView *)bgView
  56 +{
  57 + if (!_bgView)
  58 + {
  59 + _bgView = [[UIImageView alloc] initWithFrame:self.bounds];
  60 + _bgView.image = [UIImage imageNamed:@"背景400x60"];
  61 + }
  62 + return _bgView;
  63 +}
  64 +
53 65 #pragma mark - getter
54 66 - (UIButton *)chatBtn
55 67 {
... ... @@ -71,8 +83,9 @@
71 83 {
72 84 UIButton *privateChatBtn = [UIButton buttonWithType:UIButtonTypeCustom];
73 85 privateChatBtn.frame = CGRectMake(self.width*0.5 - 50, (self.height - 45)*0.5, 45, 45);
74   - [privateChatBtn setBackgroundImage:[UIImage imageNamed:@"privateChat.png"] forState:UIControlStateNormal];
75   - [privateChatBtn setBackgroundImage:[UIImage imageNamed:@"privateChat.png"] forState:UIControlStateHighlighted];
  86 + //[UIColor colorWithRed:0.61 green:0.61 blue:0.61 alpha:1.00]
  87 + [privateChatBtn setBackgroundImage:[UIImage imageNamed:@"22"] forState:UIControlStateNormal];
  88 + [privateChatBtn setBackgroundImage:[UIImage imageNamed:@"22"] forState:UIControlStateHighlighted];
76 89 [privateChatBtn addTarget:self action:@selector(privateChatAction) forControlEvents:UIControlEventTouchUpInside];
77 90 _privateChatBtn = privateChatBtn;
78 91 }
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Chat/ChatViews/chatListCell.m
... ... @@ -47,7 +47,7 @@
47 47 NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:self.contentLabel.text];
48 48 // 设置文字颜色
49 49 [str addAttribute:NSForegroundColorAttributeName value:ZXRandomColor range:NSMakeRange(0, name.length)];
50   - [str addAttribute:NSForegroundColorAttributeName value:[UIColor cyanColor] range:NSMakeRange(name.length, content.length)];
  50 + [str addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:NSMakeRange(name.length, content.length)];
51 51 // 将配置好的NSMutableAttributedString传给attributedText属性
52 52 self.contentLabel.attributedText = str;
53 53  
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftAnimOperation.m
... ... @@ -34,10 +34,11 @@
34 34  
35 35 GiftAnimOperation *giftAnimOperation = [[GiftAnimOperation alloc]initWithGiftModel:model animContentView:animContentView];
36 36  
37   - if (model.giftStyle == GiftStyleFighter) {
38   - [[NSNotificationCenter defaultCenter] addObserver:giftAnimOperation selector:@selector(fighterAnimationDidStart) name:NSNotificationAnimationDidStart object:nil];
39   - [[NSNotificationCenter defaultCenter] addObserver:giftAnimOperation selector:@selector(fighterAnimationDidStop) name:NSNotificationAnimationDidStop object:nil];
40   - }
  37 +// if (model.giftStyle == GiftStyleFighter) {
  38 +// NSLog(@"add notification op: %@,self %@",giftAnimOperation,self);
  39 +// [[NSNotificationCenter defaultCenter] addObserver:giftAnimOperation selector:@selector(fighterAnimationDidStart) name:NSNotificationAnimationDidStart object:nil];
  40 +// [[NSNotificationCenter defaultCenter] addObserver:giftAnimOperation selector:@selector(fighterAnimationDidStop) name:NSNotificationAnimationDidStop object:nil];
  41 +// }
41 42 return giftAnimOperation;
42 43 }
43 44  
... ... @@ -61,6 +62,8 @@
61 62 开始方法(KVO控制队列任务状态)
62 63 */
63 64 - (void)start{
  65 + NSLog(@"animation start op:%@",self);
  66 +
64 67 //这里动画队列任务不存在Cancelled状态所以不需要判断,直接开始执行
65 68 [self willChangeValueForKey:@"isExecuting"];
66 69 _executing = YES;
... ... @@ -100,6 +103,7 @@
100 103  
101 104 [self.giftCarView startPorschAnimationWithCompletion:^{
102 105  
  106 + NSLog(@"animation porsch stop");
103 107 [self willChangeValueForKey:@"isFinished"];
104 108  
105 109 _finished = YES;
... ... @@ -117,22 +121,35 @@
117 121  
118 122 [self.giftFighterView addAnimationsMoveToPoint:CGPointMake(SCREEN_WIDTH, 60) endPoint:CGPointMake( -500, 600)];
119 123 [self.animContentView addSubview:self.giftFighterView];
120   - });
121   -}
  124 +
  125 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(12 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  126 + [self willChangeValueForKey:@"isFinished"];
  127 +
  128 + _finished = YES;
  129 +
  130 + [self didChangeValueForKey:@"isFinished"];
122 131  
123   -- (void)fighterAnimationDidStart
124   -{
125   -
  132 + });
  133 + });
126 134 }
127 135  
128   -- (void)fighterAnimationDidStop
129   -{
130   - [self willChangeValueForKey:@"isFinished"];
131   -
132   - _finished = YES;
133   -
134   - [self didChangeValueForKey:@"isFinished"];
135   -}
  136 +//- (void)fighterAnimationDidStart
  137 +//{
  138 +// NSLog(@"fight start op:%@",self);
  139 +//}
  140 +//
  141 +//- (void)fighterAnimationDidStop
  142 +//{
  143 +// NSLog(@"fight stop op:%@",self);
  144 +// [self willChangeValueForKey:@"isFinished"];
  145 +//
  146 +// _finished = YES;
  147 +//
  148 +// [self didChangeValueForKey:@"isFinished"];
  149 +//
  150 +//// [[NSNotificationCenter defaultCenter] removeObserver:self name:NSNotificationAnimationDidStart object:nil];
  151 +//// [[NSNotificationCenter defaultCenter] removeObserver:self name:NSNotificationAnimationDidStop object:nil];
  152 +////}
136 153  
137 154 - (void)planeAnimation
138 155 {
... ... @@ -145,6 +162,7 @@
145 162  
146 163 [self.giftPlaneView startPlaneAnimationWithCompletion:^{
147 164  
  165 + NSLog(@"animation plane stop");
148 166 [self willChangeValueForKey:@"isFinished"];
149 167  
150 168 _finished = YES;
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftAnimationAction.m
... ... @@ -15,6 +15,7 @@
15 15 */
16 16 - (void)startPorschAnimationWithCompletion:(giftAnimationCompletion)Completion
17 17 {
  18 + NSLog(@"animation PorschStart");
18 19 _giftAnimationCompletion = Completion;
19 20 }
20 21  
... ... @@ -23,6 +24,7 @@
23 24 */
24 25 - (void)startPlaneAnimationWithCompletion:(giftAnimationCompletion)Completion
25 26 {
  27 + NSLog(@"animation PlaneStart");
26 28 _giftAnimationCompletion = Completion;
27 29 }
28 30  
... ... @@ -33,6 +35,7 @@
33 35 @param flag 是否完成标记
34 36 */
35 37 - (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag{
  38 + NSLog(@"animationDidStop");
36 39 _giftAnimationCompletion();
37 40 }
38 41  
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftResource/NHCarViews.m
... ... @@ -101,12 +101,12 @@
101 101 animationGroup.animations = @[position,scaleAnimation];
102 102  
103 103 if (self.animations.count == 0) {
104   - NSLog(@"第一次动画%ld",self.animations.count);
  104 +// NSLog(@"第一次动画%ld",self.animations.count);
105 105 [self.animations addObject:animationGroup];
106 106 [self.layer addAnimation:animationGroup forKey:@"carView"];
107 107 }else{
108 108 [self.animations addObject:animationGroup];
109   - NSLog(@"添加动画");
  109 +// NSLog(@"添加动画");
110 110 }
111 111 }
112 112  
... ... @@ -139,7 +139,7 @@
139 139 [self removeFromSuperview];
140 140  
141 141 _giftAnimationCompletion();
142   - NSLog(@"删除动画");
  142 +// NSLog(@"删除动画");
143 143 // [self.animations removeObjectAtIndex:0];
144 144  
145 145 if (self.animations.count > 0) {
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftResource/NHFighterView+animDelegagte.h
... ... @@ -8,6 +8,9 @@
8 8  
9 9 #import "NHFighterView.h"
10 10  
  11 +//typedef void(^fighterAnimationCompletion)();
  12 +
11 13 @interface NHFighterView (animDelegagte)
12 14  
  15 +//@property (nonatomic) fighterAnimationCompletion completion;
13 16 @end
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftResource/NHFighterView+animDelegagte.m
... ... @@ -9,16 +9,23 @@
9 9 #import "NHFighterView+animDelegagte.h"
10 10 #import "GiftAnimationAction.h"
11 11  
  12 +
  13 +
12 14 @implementation NHFighterView (animDelegagte)
13 15  
14   -- (void)animationDidStart:(CAAnimation *)anim
15   -{
16   - [[NSNotificationCenter defaultCenter] postNotificationName:NSNotificationAnimationDidStart object:nil];
17   -}
  16 +//@dynamic completion;
18 17  
19   -- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag
20   -{
21   - [[NSNotificationCenter defaultCenter] postNotificationName:NSNotificationAnimationDidStop object:nil];
22   -}
  18 +//- (void)animationDidStart:(CAAnimation *)anim
  19 +//{
  20 +//// [[NSNotificationCenter defaultCenter] postNotificationName:NSNotificationAnimationDidStart object:nil];
  21 +// NSLog(@"fighter start:%@",self);
  22 +//}
  23 +//
  24 +//- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag
  25 +//{
  26 +// NSLog(@"fighter stop:%@",self);
  27 +// self.completion();
  28 +//// [[NSNotificationCenter defaultCenter] postNotificationName:NSNotificationAnimationDidStop object:nil];
  29 +//}
23 30  
24 31 @end
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/LiveBaseView.m
... ... @@ -83,8 +83,6 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型
83 83 [[LVCAnimationManager shareManager] bubblingWithCenterPoint:CGPointMake(SCREEN_WIDTH - 50, SCREEN_HEIGHT - 50) toView:self.animationBaseView speed:1];
84 84  
85 85 [self.animationBaseView addSubview:self.chatTableView];
86   - self.chatTableView.backgroundColor = [UIColor whiteColor];
87   - self.chatTableView.alpha = 0.7;
88 86  
89 87 [self.animationBaseView addSubview:self.topToolsView];
90 88 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
... ... @@ -154,8 +152,8 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型
154 152 [bgView addSubview:sendBtn];
155 153  
156 154 _commentText = [[UITextField alloc] initWithFrame:CGRectMake(_barrageSwitch.right + 20, 5, _commentsView.width - _barrageSwitch.right - 20 - 100, _commentsView.height - 10)];
157   - _commentText.layer.borderColor = [UIColor blueColor].CGColor;
158   - _commentText.layer.borderWidth = 1.0;
  155 +// _commentText.layer.borderColor = [UIColor blueColor].CGColor;
  156 +// _commentText.layer.borderWidth = 1.0;
159 157 _commentText.layer.cornerRadius = 2.0;
160 158 _commentText.layer.masksToBounds = YES;
161 159 _commentText.inputAccessoryView = _commentsView;
... ... @@ -644,9 +642,9 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型
644 642 if (!_barrageSwitch)
645 643 {
646 644 _barrageSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(10, 10, 40, 30)];
647   - _barrageSwitch.tintColor = [UIColor orangeColor];
648   - _barrageSwitch.onTintColor = [UIColor orangeColor];
649   - _barrageSwitch.thumbTintColor = [UIColor lightGrayColor];
  645 + _barrageSwitch.tintColor = [UIColor greenColor];
  646 + _barrageSwitch.onTintColor = [UIColor greenColor];
  647 + _barrageSwitch.thumbTintColor = [UIColor whiteColor];
650 648 _barrageSwitch.centerY = _commentsView.height * 0.5;
651 649 [_barrageSwitch addTarget:self action:@selector(barrageSiwthChange:) forControlEvents:UIControlEventValueChanged];
652 650 }
... ... @@ -659,8 +657,6 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型
659 657 {
660 658 _bottomToolView = [[BottomToolView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT - BottomToolHeight, SCREEN_WIDTH, BottomToolHeight)];
661 659 _bottomToolView.delegate = self;
662   - _bottomToolView.backgroundColor = [UIColor lightGrayColor];
663   - _bottomToolView.alpha = 0.7;
664 660 }
665 661 return _bottomToolView;
666 662 }
... ... @@ -685,6 +681,14 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型
685 681 tableView.showsHorizontalScrollIndicator = NO;
686 682 tableView.bounces = NO;
687 683 tableView.backgroundColor = [UIColor clearColor];
  684 +
  685 +// UIView *view = [[UIView alloc] initWithFrame:tableView.bounds];
  686 +// [tableView addSubview:view];
  687 +//
  688 +// UIImageView *bgView = [[UIImageView alloc] initWithFrame:view.bounds];
  689 +// bgView.image = [UIImage imageNamed:@"背景400x300"];
  690 +// [view addSubview:bgView];
  691 +// tableView.backgroundView = view;
688 692 _chatTableView = tableView;
689 693 }
690 694 return _chatTableView;
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/PrivateView/PrivateView.m
... ... @@ -184,6 +184,7 @@ static NSString *message_content = @&quot;message_content&quot;;
184 184 {
185 185 _nameLbl = [[UILabel alloc] initWithFrame:CGRectMake(100, 5, self.width - 100, 30)];
186 186 _nameLbl.centerX = self.width * 0.5;
  187 + _nameLbl.centerY = self.closeBtn.centerY;
187 188 _nameLbl.text = @"哈哈哈主播的名字";
188 189 [_nameLbl setTextColor:[UIColor cyanColor]];
189 190 _nameLbl.numberOfLines = 1;
... ... @@ -220,7 +221,7 @@ static NSString *message_content = @&quot;message_content&quot;;
220 221 _tableView.showsHorizontalScrollIndicator = NO;
221 222 _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
222 223 _tableView.bounces = NO;
223   - _tableView.backgroundColor = [UIColor clearColor];
  224 + _tableView.backgroundColor = [UIColor colorWithRed:0.96 green:0.98 blue:0.98 alpha:1.00];
224 225 }
225 226 return _tableView;
226 227 }
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/TopToolView/TopToolView.m
... ... @@ -75,7 +75,7 @@
75 75 if (!_bgView)
76 76 {
77 77 _bgView = [[UIImageView alloc] initWithFrame:self.bounds];
78   - _bgView.backgroundColor = ZXRandomColor;
  78 + _bgView.image = [UIImage imageNamed:@"背景200x50"];
79 79 _bgView.layer.masksToBounds = YES;
80 80 _bgView.layer.cornerRadius = _bgView.height * 0.5;
81 81  
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/LiveSections/Controller/LVCLiveViewController.m
... ... @@ -56,7 +56,7 @@
56 56 [self.view addSubview:self.openFilterButton];
57 57 [self.view addSubview:self.openFlashButton];
58 58 [self.view addSubview:self.filterView];
59   -
  59 +
60 60 // 初始化推流
61 61 NSString *activityId = [NSString stringWithFormat:@"%d%d%d%d%d",arc4random()%9,arc4random()%9,arc4random()%9,arc4random()%9,arc4random()%9];
62 62  
... ... @@ -133,8 +133,8 @@
133 133 [self.view insertSubview:self.liveBaseView atIndex:1];
134 134  
135 135 } failure:^(NSDictionary *errorDic) {
136   - NSString *str=[[NSMutableString alloc] initWithData:errorDic[@"errorMessage"] encoding:NSUTF8StringEncoding];
137   - NSLog(@"%@",str);
  136 + //NSString *str=[[NSMutableString alloc] initWithData:errorDic[@"errorMessage"] encoding:NSUTF8StringEncoding];
  137 + NSLog(@"%@",errorDic);
138 138 [self toast:errorDic[@"errorMessage"]];
139 139 }];
140 140 }
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCUGCLiveListController.m
... ... @@ -7,9 +7,16 @@
7 7 //
8 8  
9 9 #import "LVCUGCLiveListController.h"
10   -#import "CommonCrypto/CommonDigest.h"
  10 +#import "LiveLIstService.h"
  11 +#import "LVCUGCLiveListModel.h"
  12 +#import "LVCUGCLivePlayerCell.h"
  13 +#import "LVCUGCLivePlayerModel.h"
11 14  
12   -@interface LVCUGCLiveListController ()
  15 +static NSString *cellId = @"cellId";
  16 +
  17 +@interface LVCUGCLiveListController ()<UICollectionViewDelegate, UICollectionViewDataSource>
  18 +
  19 +@property (nonatomic, strong) UICollectionView *collectionView;
13 20  
14 21 @end
15 22  
... ... @@ -24,69 +31,75 @@
24 31  
25 32 - (void)loadData {
26 33  
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) {
  34 + [LiveLIstService getLiveListWithHandler:^(id data, NSError *error) {
37 35  
38   - NSLog(@"%@",responseObject);
  36 + if (error) {
  37 + NSLog(@"error:%@",error);
  38 + return ;
  39 + }
  40 + NSLog(@"data%@",data);
39 41  
40   - } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
  42 + LVCUGCLiveListModel *model = [LVCUGCLiveListModel modelWithDic:data];
41 43  
42   - NSLog(@"%@",error);
  44 + NSLog(@"%@",model.activityList);
43 45 }];
44   -
  46 +
45 47 }
46 48  
47   -//sha1加密
48   -- (NSString*)sha1:(NSString *)string
49   -{
50   - NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
  49 +#pragma mark - UICollectionViewDelegate, UICollectionViewDataSource !!!!!!!!!!!!!!!!!!!!!!!!!!!
  50 +- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
51 51  
52   - uint8_t digest[CC_SHA1_DIGEST_LENGTH];
  52 + return 1;
  53 +}
  54 +
  55 +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
53 56  
54   - CC_SHA1(data.bytes, data.length, digest);
  57 + return 6;
  58 +}
  59 +
  60 +- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
55 61  
56   - NSMutableString* output = [NSMutableString stringWithCapacity:CC_SHA1_DIGEST_LENGTH * 2];
  62 + LVCUGCLivePlayerCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellId forIndexPath:indexPath];
57 63  
58   - for(int i = 0; i < CC_SHA1_DIGEST_LENGTH; i++)
59   - [output appendFormat:@"%02x", digest[i]];
  64 + NSLog(@"cell ------> %@",cell);
60 65  
61   - while ([[output substringToIndex:1] isEqualToString:@"0"]) {
62   - output = [[NSMutableString alloc] initWithString:[output substringFromIndex:1]];
63   - }
  66 + LVCUGCLivePlayerModel *model = [[LVCUGCLivePlayerModel alloc] init];
  67 + cell.model = model;
64 68  
65   - return output;
  69 + return cell;
66 70 }
67   -//参数排序
68   -- (NSString *)sortParameters:(NSDictionary*)parameters
69   -{
70   - //对所有传入参数按照字段名的 ASCII 码从小到大排序
71   - NSArray *keyArr=[parameters allKeys];
72   - NSArray *arr = [keyArr sortedArrayUsingSelector:@selector(compare:)];
  71 +
  72 +- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
73 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 74  
83   - if (string1.length > 0) {
84   - [string1 deleteCharactersInRange:NSMakeRange(string1.length-1, 1)];
85   - }
  75 +}
  76 +
  77 +- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
86 78  
87   - return string1;
  79 + NSLog(@"停止");
88 80 }
89 81  
  82 +#pragma mark - GetMethod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  83 +- (UICollectionView *)collectionView {
  84 +
  85 + if (!_collectionView) {
  86 + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
  87 + layout.minimumLineSpacing = 0;
  88 + layout.minimumInteritemSpacing = 0;
  89 + layout.itemSize = self.view.bounds.size;
  90 + _collectionView = [[UICollectionView alloc] initWithFrame:self.view.bounds collectionViewLayout:layout];
  91 + _collectionView.pagingEnabled = YES;
  92 + _collectionView.contentOffset = CGPointMake(0, 30);
  93 + _collectionView.showsHorizontalScrollIndicator = NO;
  94 + _collectionView.scrollEnabled = NO;
  95 + _collectionView.dataSource = self;
  96 + _collectionView.delegate = self;
  97 + [_collectionView registerClass:[LVCUGCLivePlayerCell class] forCellWithReuseIdentifier:cellId];
  98 + }
  99 + return _collectionView;
  100 +}
  101 +
  102 +
90 103 - (void)didReceiveMemoryWarning {
91 104 [super didReceiveMemoryWarning];
92 105 // Dispose of any resources that can be recreated.
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCUGCLivePlayerController.m
... ... @@ -10,13 +10,25 @@
10 10 #import <CNLivePlayerSDK/CNLiveWebcastManager.h>
11 11 #import "LVCUGCPlayerLoadingView.h"
12 12 #import "LVCUGCBackgroundView.h"
13   -#import "LVCUGCLivePlayerCell.h"
14 13  
15   -static NSString *cellId = @"cellId";
16 14  
17   -@interface LVCUGCLivePlayerController ()<UICollectionViewDelegate, UICollectionViewDataSource>
  15 +@interface LVCUGCLivePlayerController () {
  16 +
  17 + float _oneY;
  18 + float _SecondY;
  19 + float _ThirdY;
  20 + UIView *_tempView;
  21 + UIPanGestureRecognizer *_pan;
  22 + LVCUGCPlayerLoadingView *_firstLoadView;
  23 + LVCUGCPlayerLoadingView *_secondLoadView;
  24 + LVCUGCPlayerLoadingView *_thirdLoadView;
  25 +}
  26 +
  27 +@property (nonatomic, strong) UIView *viewOne;
  28 +@property (nonatomic, strong) UIView *viewSecond;
  29 +@property (nonatomic, strong) UIView *viewThird;
18 30  
19   -@property (nonatomic, strong) UICollectionView *collectionView;
  31 +@property (nonatomic, strong) CNLiveMoviePlayerController *player; // 播放器
20 32  
21 33 @property (nonatomic, strong) LVCUGCBackgroundView *bgView; // 背景视图
22 34  
... ... @@ -43,58 +55,331 @@ static NSString *cellId = @&quot;cellId&quot;;
43 55  
44 56 self.view.backgroundColor = [UIColor whiteColor];
45 57  
46   - [self.view addSubview:self.bgView];
47   - [self.view addSubview:self.collectionView];
  58 + [self.view addSubview:self.viewOne];
  59 + [self.view addSubview:self.viewSecond];
  60 + [self.view addSubview:self.viewThird];
48 61  
49   -}
50   -
51   -#pragma mark - UICollectionViewDelegate, UICollectionViewDataSource !!!!!!!!!!!!!!!!!!!!!!!!!!!
52   -- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
  62 + _pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panGesture:)];
  63 +
  64 + [self installMovieNotificationObservers];
53 65  
54   - return 1;
  66 + _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:@"iOStest"
  67 + authSuccess:^{
  68 +
  69 + _player.videoDecoderMode = CNLiveMovieVideoDecoderMode_AUTO;
  70 + _player.view.frame = self.view.bounds;
  71 + _player.shouldAutoplay = YES;
  72 + [_player prepareToPlay];
  73 + [_viewSecond addSubview:_player.view];
  74 + [_viewSecond sendSubviewToBack:_player.view];
  75 + [_player.view addGestureRecognizer:_pan];
  76 +
  77 + } authFailed:^(NSDictionary *errorInfo) {
  78 + NSLog(@"初始化直播播放器失败:%@", errorInfo);
  79 +
  80 + } getAnchorStatusResult:^(BOOL result) {
  81 +
  82 + NSLog(@"-------------获取主播状态%d", result ? YES : NO);
  83 +
  84 + }];
  85 +
  86 + //[self.view addSubview:self.bgView];
55 87 }
56 88  
57   -- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
  89 +#pragma mark - UIPanGestureRecognizer !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  90 +- (void)panGesture:(UIPanGestureRecognizer *)recognizer {
  91 +
  92 + CGPoint t = [recognizer translationInView:_viewSecond];
  93 + NSLog(@"移动距离>>>>>>>>>>>>>>%f",t.y);
  94 +
  95 + _viewOne.frame = CGRectMake(0, _oneY + t.y, SCREEN_WIDTH, SCREEN_HEIGHT);
  96 + _viewSecond.frame = CGRectMake(0, _SecondY + t.y, SCREEN_WIDTH, SCREEN_HEIGHT);
  97 + _viewThird.frame = CGRectMake(0, _ThirdY + t.y, SCREEN_WIDTH, SCREEN_HEIGHT);
58 98  
59   - return 4;
  99 + switch (recognizer.state) {
  100 + case UIGestureRecognizerStateBegan:
  101 + case UIGestureRecognizerStateChanged:
  102 + {
  103 +
  104 + }
  105 + break;
  106 + case UIGestureRecognizerStateEnded:
  107 + case UIGestureRecognizerStateFailed:
  108 + case UIGestureRecognizerStateCancelled:
  109 + {
  110 + if (t.y > 100) {
  111 + [UIView animateWithDuration:0.2 animations:^{
  112 +
  113 + _viewOne.frame = CGRectMake(0, _oneY + SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT);
  114 + _viewSecond.frame = CGRectMake(0, _SecondY + SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT);
  115 + _viewThird.frame = CGRectMake(0, _ThirdY + SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT);
  116 +
  117 + } completion:^(BOOL finished) {
  118 +
  119 + [_player.view removeFromSuperview];
  120 + [_player stop];
  121 + _player = nil;
  122 + // 停止后的视图,拿到自己的加载图来显示
  123 + [_viewSecond addSubview:_secondLoadView];
  124 +
  125 + _viewThird.frame = CGRectMake(0, -SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT);
  126 + _tempView = _viewOne;
  127 + _viewOne = _viewThird;
  128 + _viewThird = _viewSecond;
  129 + _viewSecond = _tempView;
  130 + //往下滑 播放上一个
  131 + _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:@"iOStest"
  132 + authSuccess:^{
  133 +
  134 + _player.videoDecoderMode = CNLiveMovieVideoDecoderMode_AUTO;
  135 + _player.view.frame = self.view.bounds;
  136 + _player.shouldAutoplay = YES;
  137 + [_player prepareToPlay];
  138 + [_viewSecond addSubview:_player.view];
  139 + [_viewSecond sendSubviewToBack:_player.view];
  140 + [_player.view addGestureRecognizer:_pan];
  141 +
  142 + } authFailed:^(NSDictionary *errorInfo) {
  143 + NSLog(@"初始化直播播放器失败:%@", errorInfo);
  144 +
  145 + } getAnchorStatusResult:^(BOOL result) {
  146 +
  147 + NSLog(@"-------------获取主播状态%d", result ? YES : NO);
  148 +
  149 + }];
  150 +
  151 + _oneY = _viewOne.frame.origin.y;
  152 + _SecondY = _viewSecond.frame.origin.y;
  153 + _ThirdY = _viewThird.frame.origin.y;
  154 + }];
  155 + } else if (t.y < -100) {
  156 +
  157 + [UIView animateWithDuration:0.2 animations:^{
  158 +
  159 + _viewOne.frame = CGRectMake(0, _oneY - SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT);
  160 + _viewSecond.frame = CGRectMake(0, _SecondY - SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT);
  161 + _viewThird.frame = CGRectMake(0, _ThirdY - SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT);
  162 +
  163 + } completion:^(BOOL finished) {
  164 +
  165 + [_player.view removeFromSuperview];
  166 + [_player stop];
  167 + _player = nil;
  168 + // 停止后的视图,拿到自己的加载图来显示
  169 + [_viewSecond addSubview:_secondLoadView];
  170 +
  171 + [_viewSecond removeGestureRecognizer:_pan];
  172 + _viewOne.frame = CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT);
  173 + _tempView = _viewOne;
  174 + _viewOne = _viewSecond;
  175 + _viewSecond = _viewThird;
  176 + _viewThird = _tempView;
  177 + [_viewSecond addGestureRecognizer:_pan];
  178 + //往上滑 播放下一个
  179 + _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:@"iOStest"
  180 + authSuccess:^{
  181 +
  182 + _player.videoDecoderMode = CNLiveMovieVideoDecoderMode_AUTO;
  183 + _player.view.frame = self.view.bounds;
  184 + _player.shouldAutoplay = YES;
  185 + [_player prepareToPlay];
  186 + [_viewSecond addSubview:_player.view];
  187 + [_viewSecond sendSubviewToBack:_player.view];
  188 + [_player.view addGestureRecognizer:_pan];
  189 +
  190 + } authFailed:^(NSDictionary *errorInfo) {
  191 + NSLog(@"初始化直播播放器失败:%@", errorInfo);
  192 +
  193 + } getAnchorStatusResult:^(BOOL result) {
  194 +
  195 + NSLog(@"-------------获取主播状态%d", result ? YES : NO);
  196 +
  197 + }];
  198 +
  199 + _oneY = _viewOne.frame.origin.y;
  200 + _SecondY = _viewSecond.frame.origin.y;
  201 + _ThirdY = _viewThird.frame.origin.y;
  202 + }];
  203 +
  204 + } else {
  205 +
  206 + [UIView animateWithDuration:0.2 animations:^{
  207 +
  208 + _viewOne.frame = CGRectMake(0, _oneY, SCREEN_WIDTH, SCREEN_HEIGHT);
  209 + _viewSecond.frame = CGRectMake(0, _SecondY, SCREEN_WIDTH, SCREEN_HEIGHT);
  210 + _viewThird.frame = CGRectMake(0, _ThirdY, SCREEN_WIDTH, SCREEN_HEIGHT);
  211 +
  212 + } completion:^(BOOL finished) {
  213 + _oneY = _viewOne.frame.origin.y;
  214 + _SecondY = _viewSecond.frame.origin.y;
  215 + _ThirdY = _viewThird.frame.origin.y;
  216 + }];
  217 + }
  218 + }
  219 + break;
  220 + default:
  221 + break;
  222 + }
60 223 }
61 224  
62   -- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
  225 +#pragma mark - 添加通知监听 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  226 +-(void)installMovieNotificationObservers //添加视频播放通知
  227 +{
  228 + //视频加载状态改变
  229 + [[NSNotificationCenter defaultCenter] addObserver:self
  230 + selector:@selector(loadStateDidChange:)
  231 + name:MPMoviePlayerLoadStateDidChangeNotification
  232 + object:nil];
  233 +
  234 + //视频播放错误及结束原因
  235 + [[NSNotificationCenter defaultCenter] addObserver:self
  236 + selector:@selector(moviePlayBackDidFinish:)
  237 + name:MPMoviePlayerPlaybackDidFinishNotification
  238 + object:nil];
63 239  
64   - LVCUGCLivePlayerCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellId forIndexPath:indexPath];
  240 + //视频缓冲至可播放状态
  241 + [[NSNotificationCenter defaultCenter] addObserver:self
  242 + selector:@selector(mediaIsPreparedToPlayDidChange:)
  243 + name:MPMediaPlaybackIsPreparedToPlayDidChangeNotification
  244 + object:nil];
  245 +
  246 + //视频播放状态改变
  247 + [[NSNotificationCenter defaultCenter] addObserver:self
  248 + selector:@selector(moviePlayBackStateDidChange:)
  249 + name:MPMoviePlayerPlaybackStateDidChangeNotification
  250 + object:nil];
  251 +
  252 +
  253 + //获取主播状态通知(点播和普通播放不需要注册该通知)
  254 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(anchorStatusChanged:)
  255 + name:CNLiveAnchorStatusChangedNotification
  256 + object:nil];
65 257  
66   - return cell;
67 258 }
68 259  
69   -- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
70   -
71   - NSLog(@"一直");
  260 +#pragma mark - 通知 Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  261 +- (void)loadStateDidChange:(NSNotification *)notification //视频加载状态改变
  262 +{
  263 + if (_player) {
  264 + MPMovieLoadState loadState = _player.loadState;
  265 + if ((loadState & MPMovieLoadStatePlaythroughOK) != 0) {
  266 +
  267 + NSLog(@"loadStateDidChange: MPMovieLoadStatePlaythroughOK: %d\n", (int)loadState);
  268 +
  269 + } else if ((loadState & MPMovieLoadStateStalled) != 0) {
  270 + NSLog(@"loadStateDidChange: MPMovieLoadStateStalled: %d\n", (int)loadState);
  271 +
  272 + } else {
  273 + NSLog(@"loadStateDidChange: ???: %d\n", (int)loadState);
  274 + }
  275 + }
72 276 }
73 277  
74   -- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
75   -
76   - NSLog(@"停止");
  278 +
  279 +- (void)moviePlayBackDidFinish:(NSNotification *)notification //视频播放错误及结束原因
  280 +{
  281 + if (_player) {
  282 + int reason = [[[notification userInfo] valueForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey] intValue];
  283 + if (MPMovieFinishReasonPlaybackError == reason) {
  284 +
  285 +
  286 + } else {
  287 +
  288 + }
  289 +
  290 + switch (reason)
  291 + {
  292 + case MPMovieFinishReasonPlaybackEnded:
  293 + NSLog(@"playbackStateDidChange: MPMovieFinishReasonPlaybackEnded: %d\n", reason);
  294 + break;
  295 +
  296 + case MPMovieFinishReasonUserExited:
  297 + NSLog(@"playbackStateDidChange: MPMovieFinishReasonUserExited: %d\n", reason);
  298 + break;
  299 +
  300 + case MPMovieFinishReasonPlaybackError:
  301 + NSLog(@"playbackStateDidChange: MPMovieFinishReasonPlaybackError: %d\n", reason);
  302 + break;
  303 +
  304 + default:
  305 + NSLog(@"playbackPlayBackDidFinish: ???: %d\n", reason);
  306 + break;
  307 + }
  308 + }
77 309 }
78 310  
79 311  
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];
  312 +- (void)mediaIsPreparedToPlayDidChange:(NSNotification *)notification //视频缓冲至可播放状态
  313 +{
  314 + if (_player) {
  315 + NSLog(@"isPreparedToPlay");
  316 +
  317 + if (_viewSecond.subviews.count>0) {
  318 + for (UIView *subViews in _viewSecond.subviews) {
  319 + if ([subViews isKindOfClass:[LVCUGCPlayerLoadingView class]]) {
  320 + [subViews removeFromSuperview];
  321 + }
  322 + }
  323 + }
  324 + }
  325 +}
  326 +
  327 +
  328 +- (void)moviePlayBackStateDidChange:(NSNotification *)notification //视频播放状态改变
  329 +{
  330 + if (_player) {
  331 +
  332 + switch (_player.playbackState) {
  333 + case MPMoviePlaybackStateStopped: {
  334 +
  335 + NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStateStopped");
  336 + break;
  337 + }
  338 + case MPMoviePlaybackStatePlaying: {
  339 +
  340 + NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStatePlaying");
  341 + break;
  342 + }
  343 + case MPMoviePlaybackStatePaused:
  344 +
  345 + NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStatePaused");
  346 + break;
  347 + case MPMoviePlaybackStateInterrupted:
  348 +
  349 + NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStateInterrupted");
  350 + break;
  351 + case MPMoviePlaybackStateSeekingForward:
  352 +
  353 + NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStateSeekingForward");
  354 + break;
  355 + case MPMoviePlaybackStateSeekingBackward:
  356 +
  357 + NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStateSeekingBackward");
  358 + break;
  359 + default:
  360 +
  361 + NSLog(@"moviePlayBackStateDidChange : %ld", (long)_player.playbackState);
  362 + break;
  363 + }
  364 + }
  365 +}
  366 +
  367 +
  368 +- (void)anchorStatusChanged:(NSNotification *)notification // 获取主播状态通知
  369 +{
  370 + if (_player.anchorStatus == 2) { // 已结束
  371 +
94 372 }
95   - return _collectionView;
  373 + // _bgView.anchorStatus = _player.anchorStatus;
96 374 }
97 375  
  376 +
  377 +- (void)anchorStatusConnectFailed //重新连接获取主播状态
  378 +{
  379 +
  380 +}
  381 +
  382 +#pragma mark - GetMethod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
98 383 - (LVCUGCBackgroundView *)bgView {
99 384  
100 385 if (!_bgView) {
... ... @@ -104,6 +389,60 @@ static NSString *cellId = @&quot;cellId&quot;;
104 389 return _bgView;
105 390 }
106 391  
  392 +- (UIView *)viewOne {
  393 + if (!_viewOne) {
  394 + _viewOne = [[UIView alloc] initWithFrame:CGRectMake(0, -SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT)];
  395 + _viewOne.backgroundColor = [UIColor orangeColor];
  396 + _firstLoadView = [[LVCUGCPlayerLoadingView alloc] initWithFrame:self.view.bounds];
  397 + [_viewOne addSubview:_firstLoadView];
  398 + _oneY = -SCREEN_HEIGHT;
  399 + }
  400 + return _viewOne;
  401 +}
  402 +
  403 +- (UIView *)viewSecond {
  404 + if (!_viewSecond) {
  405 + _viewSecond = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
  406 + _viewSecond.backgroundColor = [UIColor redColor];
  407 + _secondLoadView = [[LVCUGCPlayerLoadingView alloc] initWithFrame:self.view.bounds];
  408 + [_viewSecond addSubview:_secondLoadView];
  409 + _SecondY = 0;
  410 + }
  411 + return _viewSecond;
  412 +}
  413 +
  414 +- (UIView *)viewThird {
  415 + if (!_viewThird) {
  416 + _viewThird = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT)];
  417 + _viewThird.backgroundColor = [UIColor blueColor];
  418 + _thirdLoadView = [[LVCUGCPlayerLoadingView alloc] initWithFrame:self.view.bounds];
  419 + [_viewThird addSubview:_thirdLoadView];
  420 + _ThirdY = SCREEN_HEIGHT;
  421 + }
  422 + return _viewThird;
  423 +}
  424 +
  425 +#pragma mark - 移除通知 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  426 +- (void)removeMovieNotificationObservers
  427 +{
  428 + [[NSNotificationCenter defaultCenter]removeObserver:self
  429 + name:MPMoviePlayerLoadStateDidChangeNotification
  430 + object:nil];
  431 + [[NSNotificationCenter defaultCenter]removeObserver:self
  432 + name:MPMoviePlayerPlaybackDidFinishNotification
  433 + object:nil];
  434 + [[NSNotificationCenter defaultCenter]removeObserver:self
  435 + name:MPMediaPlaybackIsPreparedToPlayDidChangeNotification
  436 + object:nil];
  437 + [[NSNotificationCenter defaultCenter]removeObserver:self
  438 + name:MPMoviePlayerPlaybackStateDidChangeNotification
  439 + object:nil];
  440 +
  441 + [[NSNotificationCenter defaultCenter]removeObserver:self
  442 + name:CNLiveAnchorStatusChangedNotification
  443 + object:nil];
  444 +}
  445 +
107 446 #pragma mark - 内存警告 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
108 447 - (void)didReceiveMemoryWarning {
109 448 [super didReceiveMemoryWarning];
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/LiveLIstService.h 0 → 100644
  1 +//
  2 +// LiveLIstService.h
  3 +// LiveVideoCloud
  4 +//
  5 +// Created by cnliveJunBo on 17/3/28.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "HttpService.h"
  10 +
  11 +@interface LiveLIstService : HttpService
  12 ++ (NSURLSessionDataTask *)getLiveListWithHandler:(completionHandler)handler;
  13 +
  14 +@end
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/LiveLIstService.m 0 → 100644
  1 +//
  2 +// LiveLIstService.m
  3 +// LiveVideoCloud
  4 +//
  5 +// Created by cnliveJunBo on 17/3/28.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "LiveLIstService.h"
  10 +#import "CommonCrypto/CommonDigest.h"
  11 +
  12 +@implementation LiveLIstService
  13 +
  14 ++ (NSURLSessionDataTask *)getLiveListWithHandler:(completionHandler)handler
  15 +{
  16 + NSInteger time = [[NSDate date] timeIntervalSince1970];
  17 + NSString *timeString = [NSString stringWithFormat:@"%ld", (long)time];
  18 + NSMutableDictionary *parameter=[@{@"platform_id": [NSBundle mainBundle].bundleIdentifier,
  19 + @"timestamp": timeString,
  20 + @"appId": @"60_irn9edco29"} mutableCopy];
  21 + NSString *string = [NSString stringWithFormat:@"%@&key=%@", [self sortParameters:parameter], @"69fe70bda67e059286ad509d9f5377f815955645b52f94"];
  22 + NSString *signString = [[self sha1:string] uppercaseString];
  23 + [parameter setObject:signString forKey:@"sign"];
  24 +
  25 + NSMutableDictionary *params = parameter.mutableCopy;
  26 + completionHandler compleionHandler = ^(id data,NSError *error) {
  27 + handler(data,error);
  28 + };
  29 + return [[HttpService service] sendRequestWithHttpMethod:E_HTTP_REQUEST_METHOD_GET URLPath:[ZXServerUrl getLiveListURL] parameters:params completionHandler:compleionHandler];
  30 +}
  31 +
  32 +//sha1加密
  33 ++ (NSString*)sha1:(NSString *)string
  34 +{
  35 + NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
  36 +
  37 + uint8_t digest[CC_SHA1_DIGEST_LENGTH];
  38 +
  39 + CC_SHA1(data.bytes, data.length, digest);
  40 +
  41 + NSMutableString* output = [NSMutableString stringWithCapacity:CC_SHA1_DIGEST_LENGTH * 2];
  42 +
  43 + for(int i = 0; i < CC_SHA1_DIGEST_LENGTH; i++)
  44 + [output appendFormat:@"%02x", digest[i]];
  45 +
  46 + while ([[output substringToIndex:1] isEqualToString:@"0"]) {
  47 + output = [[NSMutableString alloc] initWithString:[output substringFromIndex:1]];
  48 + }
  49 +
  50 + return output;
  51 +}
  52 +//参数排序
  53 ++ (NSString *)sortParameters:(NSDictionary*)parameters
  54 +{
  55 + //对所有传入参数按照字段名的 ASCII 码从小到大排序
  56 + NSArray *keyArr=[parameters allKeys];
  57 + NSArray *arr = [keyArr sortedArrayUsingSelector:@selector(compare:)];
  58 +
  59 + NSMutableString *string1 = [[NSMutableString alloc]init];
  60 + for (int i=0; i<arr.count; i++) {
  61 +
  62 + NSString *parametersString = parameters[[arr objectAtIndex:i]];
  63 + if (parametersString.length > 0) {
  64 + [string1 appendString:[NSString stringWithFormat:@"%@=%@&",[arr objectAtIndex:i],parameters[[arr objectAtIndex:i]]]];
  65 + }
  66 + }
  67 +
  68 + if (string1.length > 0) {
  69 + [string1 deleteCharactersInRange:NSMakeRange(string1.length-1, 1)];
  70 + }
  71 +
  72 + return string1;
  73 +}
  74 +
  75 +
  76 +@end
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Model/LVCUGCLiveListModel.h 0 → 100644
  1 +//
  2 +// LVCUGCLiveListModel.h
  3 +// LiveVideoCloud
  4 +//
  5 +// Created by cnliveJunBo on 17/3/28.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "BaseModel.h"
  10 +
  11 +@class LVCUGCLivePlayerModel;
  12 +@interface LVCUGCLiveListModel : BaseModel
  13 +
  14 +@property (nonatomic ,copy) NSString * _Nullable totalCount;
  15 +@property (nonatomic ,copy) NSString * _Nullable nextCursor;
  16 +@property (nonatomic ,copy) NSArray <LVCUGCLivePlayerModel *> * _Nullable activityList;
  17 +@property (nonatomic ,copy) NSString * _Nullable preCursor;
  18 +
  19 +@end
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Model/LVCUGCLiveListModel.m 0 → 100644
  1 +//
  2 +// LVCUGCLiveListModel.m
  3 +// LiveVideoCloud
  4 +//
  5 +// Created by cnliveJunBo on 17/3/28.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "LVCUGCLiveListModel.h"
  10 +
  11 +@implementation LVCUGCLiveListModel
  12 +
  13 +- (void)loadModel
  14 +{
  15 + [super loadModel];
  16 +
  17 + [LVCUGCLiveListModel mj_setupObjectClassInArray:^NSDictionary *{
  18 + return @{@"activityList":@"LVCUGCLivePlayerModel"};
  19 + // return @{@"list":[SearchRecomListModel class]};二选一
  20 + }];
  21 +}
  22 +
  23 +@end
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Model/LVCUGCLivePlayerModel.h
... ... @@ -7,7 +7,21 @@
7 7 //
8 8  
9 9 #import <Foundation/Foundation.h>
  10 +#import "BaseModel.h"
10 11  
11   -@interface LVCUGCLivePlayerModel : NSObject
  12 +@interface LVCUGCLivePlayerModel : BaseModel
  13 +
  14 +@property (nonatomic ,copy) NSString * _Nullable startTime;
  15 +@property (nonatomic ,copy) NSString * _Nullable isHorizontalScreen;
  16 +@property (nonatomic ,copy) NSString * _Nullable activityId;
  17 +@property (nonatomic ,copy) NSString * _Nullable createTime;
  18 +@property (nonatomic ,copy) NSString * _Nullable coverImgUrl;
  19 +@property (nonatomic ,copy) NSString * _Nullable channelId;
  20 +@property (nonatomic ,copy) NSString * _Nullable activityStatus;
  21 +@property (nonatomic ,copy) NSString * _Nullable rates;
  22 +@property (nonatomic ,copy) NSString * _Nullable activityCategory;
  23 +@property (nonatomic ,copy) NSString * _Nullable endTime;
  24 +@property (nonatomic ,copy) NSString * _Nullable extensions;
  25 +@property (nonatomic ,copy) NSString * _Nullable activityName;
12 26  
13 27 @end
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Model/LVCUGCLivePlayerModel.m
... ... @@ -10,4 +10,10 @@
10 10  
11 11 @implementation LVCUGCLivePlayerModel
12 12  
  13 +- (void)loadModel
  14 +{
  15 + [super loadModel];
  16 +
  17 +}
  18 +
13 19 @end
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCUGCLivePlayerCell.h
... ... @@ -8,11 +8,10 @@
8 8  
9 9 #import <UIKit/UIKit.h>
10 10 #import "LVCUGCPlayerLoadingView.h"
  11 +#import "LVCUGCLivePlayerModel.h"
11 12  
12 13 @interface LVCUGCLivePlayerCell : UICollectionViewCell
13 14  
14   -@property (nonatomic, strong) LVCUGCPlayerLoadingView *loadingView;
15   -
16   -@property (nonatomic, strong) CNLiveMoviePlayerController *player; // 播放器
  15 +@property (nonatomic, strong) LVCUGCLivePlayerModel *model;
17 16  
18 17 @end
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCUGCLivePlayerCell.m
... ... @@ -15,222 +15,17 @@
15 15 self = [super initWithFrame:frame];
16 16 if (self) {
17 17 self.contentView.backgroundColor = [UIColor whiteColor];
18   -
19   - [self installMovieNotificationObservers];
20   - [self addSubview:self.loadingView];
  18 +
21 19 }
22 20 return self;
23 21 }
24 22  
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];
  23 +#pragma mark - SetMethod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  24 +- (void)setModel:(LVCUGCLivePlayerModel *)model {
74 25  
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   - }
  26 + if (_model != model) {
  27 + _model = model;
144 28 }
145 29 }
146 30  
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 31 @end
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCUGCPlayerLoadingView.h
... ... @@ -10,6 +10,6 @@
10 10  
11 11 @interface LVCUGCPlayerLoadingView : UIView
12 12  
13   -- (instancetype)initWithFrame:(CGRect)frame bgImageURLStr:(NSString *)bgImageURLStr;
  13 +@property (nonatomic, strong) UIImageView *bgImageView;
14 14  
15 15 @end
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCUGCPlayerLoadingView.m
... ... @@ -9,23 +9,17 @@
9 9 #import "LVCUGCPlayerLoadingView.h"
10 10 #import "UIImage+LVCVagueImage.h"
11 11  
12   -@interface LVCUGCPlayerLoadingView() {
13   -
14   - NSString *_bgImageURLStr;
15   -}
16   -
17   -@property (nonatomic, strong) UIImageView *bgImageView;
  12 +@interface LVCUGCPlayerLoadingView()
18 13  
19 14 @end
20 15  
21 16 @implementation LVCUGCPlayerLoadingView
22 17  
23   -- (instancetype)initWithFrame:(CGRect)frame bgImageURLStr:(NSString *)bgImageURLStr
  18 +- (instancetype)initWithFrame:(CGRect)frame
24 19 {
25 20 self = [super initWithFrame:frame];
26 21 if (self) {
27 22 self.backgroundColor = [UIColor whiteColor];
28   - _bgImageURLStr = bgImageURLStr;
29 23 [self addSubview:self.bgImageView];
30 24 }
31 25 return self;
... ...
LiveVideoCloud/LiveVideoCloud/Resource/Images/timg.jpeg 0 → 100644

292 KB

LiveVideoCloud/LiveVideoCloud/UtilKits/ServerUrl/ZXServerUrl.h
... ... @@ -27,4 +27,6 @@
27 27 /** 搜索页内容 */
28 28 + (NSString *)getSearchContentURL;
29 29  
  30 +/** 直播列表 */
  31 ++ (NSString *)getLiveListURL;
30 32 @end
... ...
LiveVideoCloud/LiveVideoCloud/UtilKits/ServerUrl/ZXServerUrl.m
... ... @@ -9,7 +9,7 @@
9 9 #import "ZXServerUrl.h"
10 10  
11 11 #ifdef DEBUG
12   -static NSString *serverBaseURL = @"http://120.92.4.46:8080";//通用测试æœåŠ¡å™¨åŸŸå
  12 +static NSString *serverBaseURL = @"http://api.cnlive.com";//通用测试æœåŠ¡å™¨åŸŸå
13 13 static NSString *serverChatBaseURL = @"http://120.92.4.46:8081";//èŠå¤©æµ‹è¯•æœåŠ¡å™¨åŸŸå
14 14 #else
15 15 static NSString *serverBaseURL = @"https://perapi.svipmovie.com";//é€šç”¨æ­£å¼æœåŠ¡å™¨åŸŸå
... ... @@ -23,6 +23,8 @@ static NSString *serverChatBaseURL = @&quot;https://perapi.svipmovie1.com&quot;;//èŠå¤©æ­
23 23 /** æœç´¢é¡µå†…容 */
24 24 static NSString *g_SearchContentURL = @"/from/huntKeyWordApi/huntKeyWords.do";//@"api/findMessage";//å‘现消æ¯
25 25  
  26 +/** 直播列表 */
  27 +static NSString *g_LiveListURL = @"/open/api2/live_epg/sp/activityList4App";
26 28  
27 29  
28 30 @implementation ZXServerUrl
... ... @@ -53,4 +55,10 @@ static NSString *g_SearchContentURL = @&quot;/from/huntKeyWordApi/huntKeyWords.do&quot;;//
53 55 return [NSString stringWithFormat:@"%@%@", serverBaseURL, g_SearchContentURL];
54 56 }
55 57  
  58 +/** 直播列表 */
  59 ++ (NSString *)getLiveListURL
  60 +{
  61 + return [NSString stringWithFormat:@"%@%@", serverBaseURL, g_LiveListURL];
  62 +}
  63 +
56 64 @end
... ...
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/22.imageset/22.png 0 → 100644

15.8 KB

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

1.73 KB

LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/priToolBg.imageset/Contents.json
... ... @@ -4,6 +4,14 @@
4 4 "idiom" : "universal",
5 5 "filename" : "priToolBg.png",
6 6 "scale" : "1x"
  7 + },
  8 + {
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "idiom" : "universal",
  14 + "scale" : "3x"
7 15 }
8 16 ],
9 17 "info" : {
... ...
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/privateChat.png.imageset/privateChat.png deleted 100644 → 0

6.61 KB

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

14.7 KB

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

20.3 KB