Commit 80f706e32f596345b806c302a2d4c21434590487
1 parent
351b0e4c
修改直播推流的头像和名称,以及加入聊天室设置
Showing
4 changed files
with
31 additions
and
4 deletions
LiveVideoCloud/AppDelegate/AppDelegate.m
| ... | ... | @@ -52,7 +52,7 @@ |
| 52 | 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 | 57 | [[CNLiveChatManager sharedCNLiveChatManager] loginServer:userInfo success:^(NSString *userId) { |
| 58 | 58 | NSLog(@"连接服务器-----success"); | ... | ... |
LiveVideoCloud/Classes/Sections/UGCSections/Controller/LVCUGCLivePlayerController.m
| ... | ... | @@ -28,6 +28,7 @@ |
| 28 | 28 | LVCUGCPlayerLoadingView *_thirdLoadView; |
| 29 | 29 | UIImage *_blurImage; |
| 30 | 30 | NSTimer *_currentTimer;// 更新当前播放时间 |
| 31 | + LVCUGCLivePlayerModel *_bgModel; | |
| 31 | 32 | } |
| 32 | 33 | |
| 33 | 34 | @property (nonatomic, strong) UIView *viewOne; |
| ... | ... | @@ -80,20 +81,23 @@ |
| 80 | 81 | if ([_model.activityStatus isEqualToString:@"1"]) { |
| 81 | 82 | [self addLiveBaseViewWithChannelId:_model.channelId]; |
| 82 | 83 | } |
| 83 | - | |
| 84 | + _bgModel = _model; | |
| 84 | 85 | [self.view addSubview:self.bgView]; |
| 85 | 86 | |
| 86 | 87 | if ([_model.activityStatus isEqualToString:@"0"]) { |
| 87 | 88 | |
| 88 | 89 | _bgView.anchorStatus = 4; |
| 90 | + _bgView.model = _model; | |
| 89 | 91 | |
| 90 | 92 | } else if ([_model.activityStatus isEqualToString:@"4"]) { |
| 91 | 93 | |
| 92 | 94 | _bgView.anchorStatus = 5; |
| 95 | + _bgView.model = _model; | |
| 93 | 96 | |
| 94 | 97 | } else if ([_model.activityStatus isEqualToString:@"-2"]) { |
| 95 | 98 | |
| 96 | 99 | _bgView.anchorStatus = 6; |
| 100 | + _bgView.model = _model; | |
| 97 | 101 | } |
| 98 | 102 | } |
| 99 | 103 | |
| ... | ... | @@ -252,7 +256,7 @@ |
| 252 | 256 | [_liveBaseView removeFromSuperview]; |
| 253 | 257 | [_viewSecond addSubview:self.vodPlayerQuitBtn]; |
| 254 | 258 | _currentTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(timeChange) userInfo:nil repeats:YES]; |
| 255 | - | |
| 259 | + _bgModel = _playArray[_index]; | |
| 256 | 260 | _player = [[CNLiveMoviePlayerController alloc] initVodPlayWithVId:_playArray[_index].activityId |
| 257 | 261 | authSuccess:^{ |
| 258 | 262 | |
| ... | ... | @@ -298,14 +302,17 @@ |
| 298 | 302 | } else if ([_playArray[_index].activityStatus isEqualToString:@"0"]) { |
| 299 | 303 | |
| 300 | 304 | _bgView.anchorStatus = 4; |
| 305 | + _bgView.model = _playArray[_index]; | |
| 301 | 306 | |
| 302 | 307 | } else if ([_playArray[_index].activityStatus isEqualToString:@"4"]) { |
| 303 | 308 | |
| 304 | 309 | _bgView.anchorStatus = 5; |
| 310 | + _bgView.model = _playArray[_index]; | |
| 305 | 311 | |
| 306 | 312 | } else if ([_playArray[_index].activityStatus isEqualToString:@"-2"]) { |
| 307 | 313 | |
| 308 | 314 | _bgView.anchorStatus = 6; |
| 315 | + _bgView.model = _playArray[_index]; | |
| 309 | 316 | } |
| 310 | 317 | } |
| 311 | 318 | |
| ... | ... | @@ -377,7 +384,7 @@ |
| 377 | 384 | |
| 378 | 385 | } else if ([_playArray[_index].activityStatus isEqualToString:@"1"]) { |
| 379 | 386 | [self addLiveBaseViewWithChannelId:_playArray[_index].channelId]; |
| 380 | - | |
| 387 | + _bgModel = _playArray[_index]; | |
| 381 | 388 | _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:_playArray[_index].channelId anchorStatus:YES authSuccess:^{ |
| 382 | 389 | |
| 383 | 390 | _player.videoDecoderMode = CNLiveMovieVideoDecoderMode_AUTO; |
| ... | ... | @@ -402,14 +409,17 @@ |
| 402 | 409 | } else if ([_playArray[_index].activityStatus isEqualToString:@"0"]) { |
| 403 | 410 | |
| 404 | 411 | _bgView.anchorStatus = 4; |
| 412 | + _bgView.model = _playArray[_index]; | |
| 405 | 413 | |
| 406 | 414 | } else if ([_playArray[_index].activityStatus isEqualToString:@"4"]) { |
| 407 | 415 | |
| 408 | 416 | _bgView.anchorStatus = 5; |
| 417 | + _bgView.model = _playArray[_index]; | |
| 409 | 418 | |
| 410 | 419 | } else if ([_playArray[_index].activityStatus isEqualToString:@"-2"]) { |
| 411 | 420 | |
| 412 | 421 | _bgView.anchorStatus = 6; |
| 422 | + _bgView.model = _playArray[_index]; | |
| 413 | 423 | } |
| 414 | 424 | |
| 415 | 425 | } |
| ... | ... | @@ -530,6 +540,7 @@ |
| 530 | 540 | //1)播放完毕。 |
| 531 | 541 | case MPMovieFinishReasonPlaybackEnded: |
| 532 | 542 | _bgView.anchorStatus = 3; |
| 543 | + _bgView.model = _bgModel; | |
| 533 | 544 | [_currentTimer invalidate]; |
| 534 | 545 | NSLog(@"playbackStateDidChange: MPMovieFinishReasonPlaybackEnded: %d\n", reason); |
| 535 | 546 | break; |
| ... | ... | @@ -631,6 +642,7 @@ |
| 631 | 642 | - (void)anchorStatusChanged:(NSNotification *)notification // 获取主播状态通知 |
| 632 | 643 | { |
| 633 | 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 | 7 | // |
| 8 | 8 | |
| 9 | 9 | #import <UIKit/UIKit.h> |
| 10 | +#import "LVCUGCLivePlayerModel.h" | |
| 10 | 11 | |
| 11 | 12 | @interface LVCUGCBackgroundView : UIView |
| 12 | 13 | |
| ... | ... | @@ -14,4 +15,6 @@ |
| 14 | 15 | |
| 15 | 16 | @property (nonatomic, strong) UIButton *backButton; |
| 16 | 17 | |
| 18 | +@property (nonatomic, strong) LVCUGCLivePlayerModel *model; | |
| 19 | + | |
| 17 | 20 | @end | ... | ... |
LiveVideoCloud/Classes/Sections/UGCSections/View/LVCUGCBackgroundView.m
| ... | ... | @@ -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 | 88 | #pragma mark - GetMethod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 77 | 89 | - (UIImageView *)iconView { |
| 78 | 90 | ... | ... |