Commit 80f706e32f596345b806c302a2d4c21434590487

Authored by 王军波
1 parent 351b0e4c

修改直播推流的头像和名称,以及加入聊天室设置

LiveVideoCloud/AppDelegate/AppDelegate.m
@@ -52,7 +52,7 @@ @@ -52,7 +52,7 @@
52 // 20170327 20170328 52 // 20170327 20170328
53 53
54 54
55 - CNLiveChatUserInfo *userInfo = [[CNLiveChatUserInfo alloc] initWithUserId:@"20170328ll" name:@"20170328" portrait:@""]; 55 + CNLiveChatUserInfo *userInfo = [[CNLiveChatUserInfo alloc] initWithUserId:@"20170328l2" name:@"20170328" portrait:@""];
56 56
57 [[CNLiveChatManager sharedCNLiveChatManager] loginServer:userInfo success:^(NSString *userId) { 57 [[CNLiveChatManager sharedCNLiveChatManager] loginServer:userInfo success:^(NSString *userId) {
58 NSLog(@"连接服务器-----success"); 58 NSLog(@"连接服务器-----success");
LiveVideoCloud/Classes/Sections/UGCSections/Controller/LVCUGCLivePlayerController.m
@@ -28,6 +28,7 @@ @@ -28,6 +28,7 @@
28 LVCUGCPlayerLoadingView *_thirdLoadView; 28 LVCUGCPlayerLoadingView *_thirdLoadView;
29 UIImage *_blurImage; 29 UIImage *_blurImage;
30 NSTimer *_currentTimer;// 更新当前播放时间 30 NSTimer *_currentTimer;// 更新当前播放时间
  31 + LVCUGCLivePlayerModel *_bgModel;
31 } 32 }
32 33
33 @property (nonatomic, strong) UIView *viewOne; 34 @property (nonatomic, strong) UIView *viewOne;
@@ -80,20 +81,23 @@ @@ -80,20 +81,23 @@
80 if ([_model.activityStatus isEqualToString:@"1"]) { 81 if ([_model.activityStatus isEqualToString:@"1"]) {
81 [self addLiveBaseViewWithChannelId:_model.channelId]; 82 [self addLiveBaseViewWithChannelId:_model.channelId];
82 } 83 }
83 - 84 + _bgModel = _model;
84 [self.view addSubview:self.bgView]; 85 [self.view addSubview:self.bgView];
85 86
86 if ([_model.activityStatus isEqualToString:@"0"]) { 87 if ([_model.activityStatus isEqualToString:@"0"]) {
87 88
88 _bgView.anchorStatus = 4; 89 _bgView.anchorStatus = 4;
  90 + _bgView.model = _model;
89 91
90 } else if ([_model.activityStatus isEqualToString:@"4"]) { 92 } else if ([_model.activityStatus isEqualToString:@"4"]) {
91 93
92 _bgView.anchorStatus = 5; 94 _bgView.anchorStatus = 5;
  95 + _bgView.model = _model;
93 96
94 } else if ([_model.activityStatus isEqualToString:@"-2"]) { 97 } else if ([_model.activityStatus isEqualToString:@"-2"]) {
95 98
96 _bgView.anchorStatus = 6; 99 _bgView.anchorStatus = 6;
  100 + _bgView.model = _model;
97 } 101 }
98 } 102 }
99 103
@@ -252,7 +256,7 @@ @@ -252,7 +256,7 @@
252 [_liveBaseView removeFromSuperview]; 256 [_liveBaseView removeFromSuperview];
253 [_viewSecond addSubview:self.vodPlayerQuitBtn]; 257 [_viewSecond addSubview:self.vodPlayerQuitBtn];
254 _currentTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(timeChange) userInfo:nil repeats:YES]; 258 _currentTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(timeChange) userInfo:nil repeats:YES];
255 - 259 + _bgModel = _playArray[_index];
256 _player = [[CNLiveMoviePlayerController alloc] initVodPlayWithVId:_playArray[_index].activityId 260 _player = [[CNLiveMoviePlayerController alloc] initVodPlayWithVId:_playArray[_index].activityId
257 authSuccess:^{ 261 authSuccess:^{
258 262
@@ -298,14 +302,17 @@ @@ -298,14 +302,17 @@
298 } else if ([_playArray[_index].activityStatus isEqualToString:@"0"]) { 302 } else if ([_playArray[_index].activityStatus isEqualToString:@"0"]) {
299 303
300 _bgView.anchorStatus = 4; 304 _bgView.anchorStatus = 4;
  305 + _bgView.model = _playArray[_index];
301 306
302 } else if ([_playArray[_index].activityStatus isEqualToString:@"4"]) { 307 } else if ([_playArray[_index].activityStatus isEqualToString:@"4"]) {
303 308
304 _bgView.anchorStatus = 5; 309 _bgView.anchorStatus = 5;
  310 + _bgView.model = _playArray[_index];
305 311
306 } else if ([_playArray[_index].activityStatus isEqualToString:@"-2"]) { 312 } else if ([_playArray[_index].activityStatus isEqualToString:@"-2"]) {
307 313
308 _bgView.anchorStatus = 6; 314 _bgView.anchorStatus = 6;
  315 + _bgView.model = _playArray[_index];
309 } 316 }
310 } 317 }
311 318
@@ -377,7 +384,7 @@ @@ -377,7 +384,7 @@
377 384
378 } else if ([_playArray[_index].activityStatus isEqualToString:@"1"]) { 385 } else if ([_playArray[_index].activityStatus isEqualToString:@"1"]) {
379 [self addLiveBaseViewWithChannelId:_playArray[_index].channelId]; 386 [self addLiveBaseViewWithChannelId:_playArray[_index].channelId];
380 - 387 + _bgModel = _playArray[_index];
381 _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:_playArray[_index].channelId anchorStatus:YES authSuccess:^{ 388 _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:_playArray[_index].channelId anchorStatus:YES authSuccess:^{
382 389
383 _player.videoDecoderMode = CNLiveMovieVideoDecoderMode_AUTO; 390 _player.videoDecoderMode = CNLiveMovieVideoDecoderMode_AUTO;
@@ -402,14 +409,17 @@ @@ -402,14 +409,17 @@
402 } else if ([_playArray[_index].activityStatus isEqualToString:@"0"]) { 409 } else if ([_playArray[_index].activityStatus isEqualToString:@"0"]) {
403 410
404 _bgView.anchorStatus = 4; 411 _bgView.anchorStatus = 4;
  412 + _bgView.model = _playArray[_index];
405 413
406 } else if ([_playArray[_index].activityStatus isEqualToString:@"4"]) { 414 } else if ([_playArray[_index].activityStatus isEqualToString:@"4"]) {
407 415
408 _bgView.anchorStatus = 5; 416 _bgView.anchorStatus = 5;
  417 + _bgView.model = _playArray[_index];
409 418
410 } else if ([_playArray[_index].activityStatus isEqualToString:@"-2"]) { 419 } else if ([_playArray[_index].activityStatus isEqualToString:@"-2"]) {
411 420
412 _bgView.anchorStatus = 6; 421 _bgView.anchorStatus = 6;
  422 + _bgView.model = _playArray[_index];
413 } 423 }
414 424
415 } 425 }
@@ -530,6 +540,7 @@ @@ -530,6 +540,7 @@
530 //1)播放完毕。 540 //1)播放完毕。
531 case MPMovieFinishReasonPlaybackEnded: 541 case MPMovieFinishReasonPlaybackEnded:
532 _bgView.anchorStatus = 3; 542 _bgView.anchorStatus = 3;
  543 + _bgView.model = _bgModel;
533 [_currentTimer invalidate]; 544 [_currentTimer invalidate];
534 NSLog(@"playbackStateDidChange: MPMovieFinishReasonPlaybackEnded: %d\n", reason); 545 NSLog(@"playbackStateDidChange: MPMovieFinishReasonPlaybackEnded: %d\n", reason);
535 break; 546 break;
@@ -631,6 +642,7 @@ @@ -631,6 +642,7 @@
631 - (void)anchorStatusChanged:(NSNotification *)notification // 获取主播状态通知 642 - (void)anchorStatusChanged:(NSNotification *)notification // 获取主播状态通知
632 { 643 {
633 _bgView.anchorStatus = _player.anchorStatus; 644 _bgView.anchorStatus = _player.anchorStatus;
  645 + _bgView.model = _bgModel;
634 } 646 }
635 647
636 648
LiveVideoCloud/Classes/Sections/UGCSections/View/LVCUGCBackgroundView.h
@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
7 // 7 //
8 8
9 #import <UIKit/UIKit.h> 9 #import <UIKit/UIKit.h>
  10 +#import "LVCUGCLivePlayerModel.h"
10 11
11 @interface LVCUGCBackgroundView : UIView 12 @interface LVCUGCBackgroundView : UIView
12 13
@@ -14,4 +15,6 @@ @@ -14,4 +15,6 @@
14 15
15 @property (nonatomic, strong) UIButton *backButton; 16 @property (nonatomic, strong) UIButton *backButton;
16 17
  18 +@property (nonatomic, strong) LVCUGCLivePlayerModel *model;
  19 +
17 @end 20 @end
LiveVideoCloud/Classes/Sections/UGCSections/View/LVCUGCBackgroundView.m
@@ -73,6 +73,18 @@ @@ -73,6 +73,18 @@
73 } 73 }
74 } 74 }
75 75
  76 +- (void)setModel:(LVCUGCLivePlayerModel *)model {
  77 + _model = model;
  78 + if (model.extensionName.length > 0) {
  79 + _nicknameLabel.text = model.extensionName;
  80 + } else {
  81 + _nicknameLabel.text = @"我的昵称";
  82 + }
  83 + NSString *iconPath = [[NSBundle mainBundle] pathForResource:@"头像" ofType:@"jpg"];
  84 + UIImage *iconImage = [UIImage imageWithContentsOfFile:iconPath];
  85 + [_iconView sd_setImageWithURL:[NSURL URLWithString:model.extensionIcon] placeholderImage:iconImage];
  86 +}
  87 +
76 #pragma mark - GetMethod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 88 #pragma mark - GetMethod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
77 - (UIImageView *)iconView { 89 - (UIImageView *)iconView {
78 90