Commit 51ace9075837caa4cf0230fb1b8eec9bf90fd776
Merge branch 'master' of bj.gitlab.cnlive.com:ios-team/LiveVideoCloud
Conflicts: LiveVideoCloud/Classes/Sections/LiveSections/Controller/LVCLiveViewController.m
Showing
9 changed files
with
122 additions
and
37 deletions
LiveVideoCloud/Classes/Sections/LiveSections/Controller/LVCLiveViewController.m
| @@ -37,7 +37,7 @@ | @@ -37,7 +37,7 @@ | ||
| 37 | 37 | ||
| 38 | @property (nonatomic, strong) UIButton *openFlashButton; | 38 | @property (nonatomic, strong) UIButton *openFlashButton; |
| 39 | 39 | ||
| 40 | -@property (nonatomic ,strong) LiveBaseView * _Nullable liveBaseView; | 40 | +@property (nonatomic ,strong) LiveBaseView * _Nullable liveBaseView; |
| 41 | 41 | ||
| 42 | @property (nonatomic, strong) LVCUGCLiveEndView *endView; | 42 | @property (nonatomic, strong) LVCUGCLiveEndView *endView; |
| 43 | 43 | ||
| @@ -50,18 +50,20 @@ | @@ -50,18 +50,20 @@ | ||
| 50 | 50 | ||
| 51 | self.navigationController.delegate = self; | 51 | self.navigationController.delegate = self; |
| 52 | self.view.backgroundColor = [UIColor whiteColor]; | 52 | self.view.backgroundColor = [UIColor whiteColor]; |
| 53 | - [self.view addSubview:self.quitButton]; | ||
| 54 | [self verifyLiveAuthority]; | 53 | [self verifyLiveAuthority]; |
| 55 | } | 54 | } |
| 56 | 55 | ||
| 57 | #pragma mark - 验证是否有主播权限 | 56 | #pragma mark - 验证是否有主播权限 |
| 58 | - (void)verifyLiveAuthority { | 57 | - (void)verifyLiveAuthority { |
| 59 | 58 | ||
| 59 | + [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeClear]; | ||
| 60 | + [SVProgressHUD showWithStatus:@"正在加载..."]; | ||
| 60 | [LVCVerifyLiveAuthService verifyLiveAuthWithHandler:^(id data, NSError *error) { | 61 | [LVCVerifyLiveAuthService verifyLiveAuthWithHandler:^(id data, NSError *error) { |
| 61 | 62 | ||
| 63 | + [SVProgressHUD dismiss]; | ||
| 62 | if (error) { | 64 | if (error) { |
| 63 | NSLog(@"失败===>error:%@",error); | 65 | NSLog(@"失败===>error:%@",error); |
| 64 | - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:[NSString stringWithFormat:@"抱歉, 鉴权失败~ "] delegate:nil cancelButtonTitle:@"好的" otherButtonTitles: nil]; | 66 | + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:[NSString stringWithFormat:@"抱歉, 鉴权失败~ "] delegate:self cancelButtonTitle:@"好的" otherButtonTitles: nil]; |
| 65 | alert.tag = 1005; | 67 | alert.tag = 1005; |
| 66 | [alert show]; | 68 | [alert show]; |
| 67 | 69 | ||
| @@ -87,12 +89,14 @@ | @@ -87,12 +89,14 @@ | ||
| 87 | //开始推流 | 89 | //开始推流 |
| 88 | [self.view addSubview:self.captureView]; | 90 | [self.view addSubview:self.captureView]; |
| 89 | [self.view addSubview:self.prepareView]; | 91 | [self.view addSubview:self.prepareView]; |
| 92 | + [self.view addSubview:self.quitButton]; | ||
| 90 | [self.view addSubview:self.changeCameraButton]; | 93 | [self.view addSubview:self.changeCameraButton]; |
| 91 | [self.view addSubview:self.openFilterButton]; | 94 | [self.view addSubview:self.openFilterButton]; |
| 92 | [self.view addSubview:self.openFlashButton]; | 95 | [self.view addSubview:self.openFlashButton]; |
| 93 | [self.view addSubview:self.filterView]; | 96 | [self.view addSubview:self.filterView]; |
| 94 | 97 | ||
| 95 | // 初始化推流 | 98 | // 初始化推流 |
| 99 | + // 生成随机活动号 | ||
| 96 | NSInteger time = [[NSDate date] timeIntervalSince1970]; | 100 | NSInteger time = [[NSDate date] timeIntervalSince1970]; |
| 97 | NSString *timeString = [NSString stringWithFormat:@"%ld", (long)time]; | 101 | NSString *timeString = [NSString stringWithFormat:@"%ld", (long)time]; |
| 98 | NSString *random = [NSString stringWithFormat:@"%d%d%d%d%d",arc4random()%9,arc4random()%9,arc4random()%9,arc4random()%9,arc4random()%9]; | 102 | NSString *random = [NSString stringWithFormat:@"%d%d%d%d%d",arc4random()%9,arc4random()%9,arc4random()%9,arc4random()%9,arc4random()%9]; |
| @@ -102,12 +106,16 @@ | @@ -102,12 +106,16 @@ | ||
| 102 | 106 | ||
| 103 | _kitCN = [[CNLiveGPUStreamerKit alloc] initCNLiveKitWithInterruptConfigWithPureAudioMode:NO]; | 107 | _kitCN = [[CNLiveGPUStreamerKit alloc] initCNLiveKitWithInterruptConfigWithPureAudioMode:NO]; |
| 104 | _kitCN.activityId = activityId; | 108 | _kitCN.activityId = activityId; |
| 105 | - _kitCN.channelId = @"iOStest"; | 109 | + _kitCN.channelId = data[@"channelId"]; |
| 106 | 110 | ||
| 111 | + // 主播ID | ||
| 112 | + NSString *channelName = data[@"channelName"]; | ||
| 113 | + NSString *coverImgUrl = data[@"coverImgUrl"]; | ||
| 114 | + | ||
| 107 | // 封面图 | 115 | // 封面图 |
| 108 | - _kitCN.coverImgUrl = @"https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=169300069,2234409601&fm=21&gp=0.jpg"; | 116 | + _kitCN.coverImgUrl = coverImgUrl; |
| 109 | // 昵称 头像 | 117 | // 昵称 头像 |
| 110 | - NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:@"我的名字好长啊", @"name", @"http://www.qq745.com/uploads/allimg/150318/1-15031PGF8-51.jpg", @"iconUrl", nil]; | 118 | + NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:channelName, @"name", [UserInformationModel manager].faceUrl, @"iconUrl", nil]; |
| 111 | _kitCN.extensions = [self dictionaryToJson:userInfo]; | 119 | _kitCN.extensions = [self dictionaryToJson:userInfo]; |
| 112 | 120 | ||
| 113 | // 设置推流配置 | 121 | // 设置推流配置 |
| @@ -120,7 +128,7 @@ | @@ -120,7 +128,7 @@ | ||
| 120 | [self.captureView addGestureRecognizer:singleRecognizer]; | 128 | [self.captureView addGestureRecognizer:singleRecognizer]; |
| 121 | 129 | ||
| 122 | } else { //禁用 | 130 | } else { //禁用 |
| 123 | - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"抱歉, 您没有权限~" delegate:nil cancelButtonTitle:@"好的" otherButtonTitles: nil]; | 131 | + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"抱歉, 您没有权限~" delegate:self cancelButtonTitle:@"好的" otherButtonTitles: nil]; |
| 124 | alert.tag = 1004; | 132 | alert.tag = 1004; |
| 125 | [alert show]; | 133 | [alert show]; |
| 126 | } | 134 | } |
| @@ -340,22 +348,23 @@ | @@ -340,22 +348,23 @@ | ||
| 340 | 348 | ||
| 341 | if ( _kitCN.captureState == CNLiveCaptureStateIdle){ | 349 | if ( _kitCN.captureState == CNLiveCaptureStateIdle){ |
| 342 | //初始化时状态为空闲 | 350 | //初始化时状态为空闲 |
| 343 | - | 351 | + NSLog(@"---------CNLiveCaptureStateIdle"); |
| 344 | return; | 352 | return; |
| 345 | } | 353 | } |
| 346 | else if (_kitCN.captureState == CNLiveCaptureStateCapturing ) { | 354 | else if (_kitCN.captureState == CNLiveCaptureStateCapturing ) { |
| 347 | //设备工作中 | 355 | //设备工作中 |
| 348 | - | 356 | + NSLog(@"---------CNLiveCaptureStateCapturing"); |
| 349 | return; | 357 | return; |
| 350 | } | 358 | } |
| 351 | else if (_kitCN.captureState == CNLiveCaptureStateClosingCapture ) { | 359 | else if (_kitCN.captureState == CNLiveCaptureStateClosingCapture ) { |
| 352 | //关闭采集设备中 | 360 | //关闭采集设备中 |
| 353 | - | 361 | + NSLog(@"---------CNLiveCaptureStateClosingCapture"); |
| 354 | return; | 362 | return; |
| 355 | } | 363 | } |
| 356 | else if (_kitCN.captureState == CNLiveCaptureStateDevAuthDenied ) { | 364 | else if (_kitCN.captureState == CNLiveCaptureStateDevAuthDenied ) { |
| 357 | //设备授权被拒绝 | 365 | //设备授权被拒绝 |
| 358 | NSLog(@"---------CNLiveCaptureStateDevAuthDenied"); | 366 | NSLog(@"---------CNLiveCaptureStateDevAuthDenied"); |
| 367 | + [self toast:@"设备未授权,请授权~"]; | ||
| 359 | 368 | ||
| 360 | return; | 369 | return; |
| 361 | } | 370 | } |
| @@ -379,24 +388,17 @@ | @@ -379,24 +388,17 @@ | ||
| 379 | NSLog(@"---------CNLiveStreamStateIdle"); | 388 | NSLog(@"---------CNLiveStreamStateIdle"); |
| 380 | } | 389 | } |
| 381 | 390 | ||
| 382 | - if (_kitCN.streamState == CNLiveStreamStateConnected) { | ||
| 383 | - | ||
| 384 | - NSLog(@"---------CNLiveStreamStateConnected"); | ||
| 385 | - } | ||
| 386 | - | ||
| 387 | if (_kitCN.streamState == CNLiveStreamStateConnecting) { | 391 | if (_kitCN.streamState == CNLiveStreamStateConnecting) { |
| 388 | 392 | ||
| 389 | NSLog(@"---------CNLiveStreamStateConnecting"); | 393 | NSLog(@"---------CNLiveStreamStateConnecting"); |
| 390 | } | 394 | } |
| 391 | 395 | ||
| 392 | - //推流出错 | ||
| 393 | - if (_kitCN.streamState == CNLiveStreamStateError) { | 396 | + if (_kitCN.streamState == CNLiveStreamStateConnected) { |
| 394 | 397 | ||
| 395 | - NSLog(@"---------CNLiveStreamStateError"); | ||
| 396 | - [self onStreamError]; | 398 | + NSLog(@"---------CNLiveStreamStateConnected"); |
| 397 | } | 399 | } |
| 398 | 400 | ||
| 399 | - //断开推流 | 401 | + //断开推流中 |
| 400 | if ( _kitCN.streamState == CNLiveStreamStateDisconnecting) { | 402 | if ( _kitCN.streamState == CNLiveStreamStateDisconnecting) { |
| 401 | 403 | ||
| 402 | NSLog(@"---------CNLiveStreamStateDisconnecting"); | 404 | NSLog(@"---------CNLiveStreamStateDisconnecting"); |
| @@ -407,6 +409,20 @@ | @@ -407,6 +409,20 @@ | ||
| 407 | 409 | ||
| 408 | NSLog(@"---------CNLiveStopStreamSuccess"); | 410 | NSLog(@"---------CNLiveStopStreamSuccess"); |
| 409 | } | 411 | } |
| 412 | + | ||
| 413 | + //结束推流失败 | ||
| 414 | + if ( _kitCN.streamState == CNLiveStopStreamFailure) { | ||
| 415 | + | ||
| 416 | + NSLog(@"---------CNLiveStopStreamFailure"); | ||
| 417 | + } | ||
| 418 | + | ||
| 419 | + //推流出错 | ||
| 420 | + if (_kitCN.streamState == CNLiveStreamStateError) { | ||
| 421 | + | ||
| 422 | + NSLog(@"---------CNLiveStreamStateError"); | ||
| 423 | + [self onStreamError]; | ||
| 424 | + } | ||
| 425 | + | ||
| 410 | } | 426 | } |
| 411 | 427 | ||
| 412 | - (void)onStreamError { // 推流失败 | 428 | - (void)onStreamError { // 推流失败 |
| @@ -430,19 +446,15 @@ | @@ -430,19 +446,15 @@ | ||
| 430 | else if ( CNLiveStreamErrorCode_ABNORMAL == err) { | 446 | else if ( CNLiveStreamErrorCode_ABNORMAL == err) { |
| 431 | 447 | ||
| 432 | [self toast:@"推流异常中断~~"]; | 448 | [self toast:@"推流异常中断~~"]; |
| 449 | + [self tryReconnect]; | ||
| 433 | 450 | ||
| 434 | } else if (err == CNLiveStreamErrorCode_CODEC_OPEN_FAILED) { | 451 | } else if (err == CNLiveStreamErrorCode_CODEC_OPEN_FAILED) { |
| 435 | NSLog(@"video codec open failed, try software codec"); | 452 | NSLog(@"video codec open failed, try software codec"); |
| 436 | // 换个编码类型重新尝试 | 453 | // 换个编码类型重新尝试 |
| 437 | _kitCN.streamerBase.videoCodec = CNLiveVideoCodec_VT264; | 454 | _kitCN.streamerBase.videoCodec = CNLiveVideoCodec_VT264; |
| 438 | [self tryReconnect]; | 455 | [self tryReconnect]; |
| 439 | - } | ||
| 440 | - else { | ||
| 441 | 456 | ||
| 442 | - } | ||
| 443 | - | ||
| 444 | - // 断网重连 | ||
| 445 | - if (err == CNLiveStreamErrorCode_CONNECT_BREAK || err == CNLiveStreamErrorCode_AV_SYNC_ERROR) { | 457 | + } else if (err == CNLiveStreamErrorCode_CONNECT_BREAK || err == CNLiveStreamErrorCode_AV_SYNC_ERROR) { |
| 446 | [self tryReconnect]; | 458 | [self tryReconnect]; |
| 447 | } | 459 | } |
| 448 | 460 | ||
| @@ -600,6 +612,7 @@ | @@ -600,6 +612,7 @@ | ||
| 600 | } | 612 | } |
| 601 | 613 | ||
| 602 | #pragma mark - Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 614 | #pragma mark - Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 615 | + | ||
| 603 | - (void)addObservers { | 616 | - (void)addObservers { |
| 604 | 617 | ||
| 605 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(captureStateChange) name:CNLiveCaptureStateDidChangeNotification object:nil]; | 618 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(captureStateChange) name:CNLiveCaptureStateDidChangeNotification object:nil]; |
LiveVideoCloud/Classes/Sections/LiveSections/Controller/LVCVerifyViewController.m
| @@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
| 8 | 8 | ||
| 9 | #import "LVCVerifyViewController.h" | 9 | #import "LVCVerifyViewController.h" |
| 10 | #import <WebKit/WebKit.h> | 10 | #import <WebKit/WebKit.h> |
| 11 | +#import "LVCLiveViewController.h" | ||
| 11 | 12 | ||
| 12 | @interface LVCVerifyViewController ()<WKUIDelegate, WKNavigationDelegate> | 13 | @interface LVCVerifyViewController ()<WKUIDelegate, WKNavigationDelegate> |
| 13 | 14 | ||
| @@ -20,6 +21,18 @@ | @@ -20,6 +21,18 @@ | ||
| 20 | 21 | ||
| 21 | self.view.backgroundColor = [UIColor blueColor]; | 22 | self.view.backgroundColor = [UIColor blueColor]; |
| 22 | 23 | ||
| 24 | + self.navigationItem.hidesBackButton = YES; | ||
| 25 | + UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 44, 44)]; | ||
| 26 | + [button setImage:[[UIImage imageNamed:@"fanhui"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal]; | ||
| 27 | + [button addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside]; | ||
| 28 | + UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:button]; | ||
| 29 | + UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc] | ||
| 30 | + initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace | ||
| 31 | + target:nil action:nil]; | ||
| 32 | + negativeSpacer.width = -15; | ||
| 33 | + self.navigationItem.leftBarButtonItems = @[negativeSpacer, backItem]; | ||
| 34 | + | ||
| 35 | + | ||
| 23 | WKWebView *webView = [[WKWebView alloc]init]; | 36 | WKWebView *webView = [[WKWebView alloc]init]; |
| 24 | [self.view addSubview:webView]; | 37 | [self.view addSubview:webView]; |
| 25 | [webView mas_makeConstraints:^(MASConstraintMaker *make) { | 38 | [webView mas_makeConstraints:^(MASConstraintMaker *make) { |
| @@ -32,10 +45,17 @@ | @@ -32,10 +45,17 @@ | ||
| 32 | 45 | ||
| 33 | } | 46 | } |
| 34 | 47 | ||
| 48 | +- (void)back { | ||
| 49 | + | ||
| 50 | + [self.navigationController dismissViewControllerAnimated:YES completion:nil]; | ||
| 51 | +} | ||
| 52 | + | ||
| 35 | #pragma mark - WKNavigationDelegate | 53 | #pragma mark - WKNavigationDelegate |
| 36 | // 页面开始加载时调用 | 54 | // 页面开始加载时调用 |
| 37 | - (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation{ | 55 | - (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation{ |
| 38 | 56 | ||
| 57 | + [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeClear]; | ||
| 58 | + [SVProgressHUD showWithStatus:@"正在加载..."]; | ||
| 39 | } | 59 | } |
| 40 | // 当内容开始返回时调用 | 60 | // 当内容开始返回时调用 |
| 41 | - (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation{ | 61 | - (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation{ |
| @@ -44,12 +64,15 @@ | @@ -44,12 +64,15 @@ | ||
| 44 | // 页面加载完成之后调用 | 64 | // 页面加载完成之后调用 |
| 45 | - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{ | 65 | - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{ |
| 46 | 66 | ||
| 67 | + [SVProgressHUD dismiss]; | ||
| 47 | } | 68 | } |
| 48 | // 页面加载失败时调用 | 69 | // 页面加载失败时调用 |
| 49 | -- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation{ | 70 | +- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error { |
| 50 | 71 | ||
| 51 | - [Tools showHUDInView:self.view withString:@"加载失败,请稍后重试..." autoHide:YES]; | 72 | + [SVProgressHUD dismiss]; |
| 73 | + [self toast:@"加载失败,请稍后重试..."]; | ||
| 52 | } | 74 | } |
| 75 | + | ||
| 53 | // 接收到服务器跳转请求之后调用 | 76 | // 接收到服务器跳转请求之后调用 |
| 54 | - (void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavigation:(WKNavigation *)navigation{ | 77 | - (void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavigation:(WKNavigation *)navigation{ |
| 55 | 78 | ||
| @@ -91,5 +114,19 @@ | @@ -91,5 +114,19 @@ | ||
| 91 | completionHandler(); | 114 | completionHandler(); |
| 92 | } | 115 | } |
| 93 | 116 | ||
| 117 | +- (void)toast:(NSString*)message { // 提示框 | ||
| 118 | + | ||
| 119 | + UIAlertView *toast = [[UIAlertView alloc] initWithTitle:nil | ||
| 120 | + message:message | ||
| 121 | + delegate:nil | ||
| 122 | + cancelButtonTitle:nil | ||
| 123 | + otherButtonTitles:nil, nil]; | ||
| 124 | + [toast show]; | ||
| 125 | + double duration = 2.5; | ||
| 126 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | ||
| 127 | + [toast dismissWithClickedButtonIndex:0 animated:NO]; | ||
| 128 | + }); | ||
| 129 | +} | ||
| 130 | + | ||
| 94 | 131 | ||
| 95 | @end | 132 | @end |
LiveVideoCloud/Classes/Sections/LiveSections/View/LVCUGCLiveEndView.m
| @@ -39,8 +39,10 @@ | @@ -39,8 +39,10 @@ | ||
| 39 | - (UIImageView *)iconView { | 39 | - (UIImageView *)iconView { |
| 40 | 40 | ||
| 41 | if (!_iconView) { | 41 | if (!_iconView) { |
| 42 | - NSString *path = [[NSBundle mainBundle] pathForResource:@"头像" ofType:@"jpg"]; | ||
| 43 | - UIImage *image = [UIImage imageWithContentsOfFile:path]; | 42 | +// NSString *path = [[NSBundle mainBundle] pathForResource:@"头像" ofType:@"jpg"]; |
| 43 | +// UIImage *image = [UIImage imageWithContentsOfFile:path]; | ||
| 44 | + UIImage *image = [UIImage imageWithData:[NSData | ||
| 45 | + dataWithContentsOfURL:[NSURL URLWithString:[UserInformationModel manager].faceUrl]]]; | ||
| 44 | _iconView = [[UIImageView alloc] initWithImage:image]; | 46 | _iconView = [[UIImageView alloc] initWithImage:image]; |
| 45 | _iconView.frame = CGRectMake((selfLength - 50) * 0.5, 20, 50, 50); | 47 | _iconView.frame = CGRectMake((selfLength - 50) * 0.5, 20, 50, 50); |
| 46 | _iconView.layer.cornerRadius = 25; | 48 | _iconView.layer.cornerRadius = 25; |
LiveVideoCloud/Classes/Sections/LiveSections/View/LVCUGCLivePrepareView.m
| @@ -35,8 +35,11 @@ | @@ -35,8 +35,11 @@ | ||
| 35 | - (UIImageView *)iconView { | 35 | - (UIImageView *)iconView { |
| 36 | 36 | ||
| 37 | if (!_iconView) { | 37 | if (!_iconView) { |
| 38 | - NSString *path = [[NSBundle mainBundle] pathForResource:@"头像" ofType:@"jpg"]; | ||
| 39 | - UIImage *image = [UIImage imageWithContentsOfFile:path]; | 38 | +// NSString *path = [[NSBundle mainBundle] pathForResource:@"头像" ofType:@"jpg"]; |
| 39 | +// UIImage *image = [UIImage imageWithContentsOfFile:path]; | ||
| 40 | + | ||
| 41 | + UIImage *image = [UIImage imageWithData:[NSData | ||
| 42 | + dataWithContentsOfURL:[NSURL URLWithString:[UserInformationModel manager].faceUrl]]]; | ||
| 40 | _iconView = [[UIImageView alloc] initWithImage:image]; | 43 | _iconView = [[UIImageView alloc] initWithImage:image]; |
| 41 | _iconView.frame = CGRectMake(10, SCREEN_HEIGHT * 0.35, 90, 90); | 44 | _iconView.frame = CGRectMake(10, SCREEN_HEIGHT * 0.35, 90, 90); |
| 42 | _iconView.layer.cornerRadius = 45; | 45 | _iconView.layer.cornerRadius = 45; |
LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCUGCLiveListView.m
| @@ -62,7 +62,7 @@ static NSString *cellId = @"cellId"; | @@ -62,7 +62,7 @@ static NSString *cellId = @"cellId"; | ||
| 62 | } | 62 | } |
| 63 | return ; | 63 | return ; |
| 64 | } | 64 | } |
| 65 | - NSLog(@"成功===>data%@",data); | 65 | +// NSLog(@"成功===>data%@",data); |
| 66 | 66 | ||
| 67 | LVCUGCLiveListModel *model = [LVCUGCLiveListModel modelWithDic:data]; | 67 | LVCUGCLiveListModel *model = [LVCUGCLiveListModel modelWithDic:data]; |
| 68 | _arrayM = model.activityList.mutableCopy; | 68 | _arrayM = model.activityList.mutableCopy; |
| @@ -91,6 +91,9 @@ static NSString *cellId = @"cellId"; | @@ -91,6 +91,9 @@ static NSString *cellId = @"cellId"; | ||
| 91 | LVCUGCLivePlayerCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellId forIndexPath:indexPath]; | 91 | LVCUGCLivePlayerCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellId forIndexPath:indexPath]; |
| 92 | 92 | ||
| 93 | LVCUGCLivePlayerModel *model = _arrayM[indexPath.row]; | 93 | LVCUGCLivePlayerModel *model = _arrayM[indexPath.row]; |
| 94 | + if (indexPath.row == 0) { | ||
| 95 | + NSLog(@"%@",model.extensionName); | ||
| 96 | + } | ||
| 94 | cell.model = model; | 97 | cell.model = model; |
| 95 | 98 | ||
| 96 | return cell; | 99 | return cell; |
LiveVideoCloud/Classes/Sections/homeSections/View/LVCUGCBackgroundView.m
| @@ -77,8 +77,10 @@ | @@ -77,8 +77,10 @@ | ||
| 77 | - (UIImageView *)iconView { | 77 | - (UIImageView *)iconView { |
| 78 | 78 | ||
| 79 | if (!_iconView) { | 79 | if (!_iconView) { |
| 80 | - NSString *path = [[NSBundle mainBundle] pathForResource:@"头像" ofType:@"jpg"]; | ||
| 81 | - UIImage *image = [UIImage imageWithContentsOfFile:path]; | 80 | +// NSString *path = [[NSBundle mainBundle] pathForResource:@"头像" ofType:@"jpg"]; |
| 81 | +// UIImage *image = [UIImage imageWithContentsOfFile:path]; | ||
| 82 | + UIImage *image = [UIImage imageWithData:[NSData | ||
| 83 | + dataWithContentsOfURL:[NSURL URLWithString:[UserInformationModel manager].faceUrl]]]; | ||
| 82 | _iconView = [[UIImageView alloc] initWithImage:image]; | 84 | _iconView = [[UIImageView alloc] initWithImage:image]; |
| 83 | _iconView.frame = CGRectMake((SCREEN_WIDTH - 100) * 0.5, SCREEN_HEIGHT * 0.2, 100, 100); | 85 | _iconView.frame = CGRectMake((SCREEN_WIDTH - 100) * 0.5, SCREEN_HEIGHT * 0.2, 100, 100); |
| 84 | _iconView.layer.cornerRadius = 50; | 86 | _iconView.layer.cornerRadius = 50; |
LiveVideoCloud/Classes/Sections/homeSections/View/LVCUGCLivePlayerCell.m
| @@ -63,9 +63,13 @@ | @@ -63,9 +63,13 @@ | ||
| 63 | 63 | ||
| 64 | if (model.extensionName.length > 0) { | 64 | if (model.extensionName.length > 0) { |
| 65 | _nameLabel.text = model.extensionName; | 65 | _nameLabel.text = model.extensionName; |
| 66 | + } else { | ||
| 67 | + _nameLabel.text = @"我的昵称"; | ||
| 66 | } | 68 | } |
| 67 | - NSString *iconPath = [[NSBundle mainBundle] pathForResource:@"头像" ofType:@"jpg"]; | ||
| 68 | - UIImage *iconImage = [UIImage imageWithContentsOfFile:iconPath]; | 69 | +// NSString *iconPath = [[NSBundle mainBundle] pathForResource:@"头像" ofType:@"jpg"]; |
| 70 | +// UIImage *iconImage = [UIImage imageWithContentsOfFile:iconPath]; | ||
| 71 | + UIImage *iconImage = [UIImage imageWithData:[NSData | ||
| 72 | + dataWithContentsOfURL:[NSURL URLWithString:[UserInformationModel manager].faceUrl]]]; | ||
| 69 | [_iconView sd_setImageWithURL:[NSURL URLWithString:model.extensionIcon] placeholderImage:iconImage]; | 73 | [_iconView sd_setImageWithURL:[NSURL URLWithString:model.extensionIcon] placeholderImage:iconImage]; |
| 70 | 74 | ||
| 71 | switch ([model.activityStatus intValue]) { | 75 | switch ([model.activityStatus intValue]) { |
LiveVideoCloud/animation.xcassets/fanhui.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "scale" : "1x" | ||
| 6 | + }, | ||
| 7 | + { | ||
| 8 | + "idiom" : "universal", | ||
| 9 | + "filename" : "fanhui.png", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "idiom" : "universal", | ||
| 14 | + "scale" : "3x" | ||
| 15 | + } | ||
| 16 | + ], | ||
| 17 | + "info" : { | ||
| 18 | + "version" : 1, | ||
| 19 | + "author" : "xcode" | ||
| 20 | + } | ||
| 21 | +} | ||
| 0 | \ No newline at end of file | 22 | \ No newline at end of file |
LiveVideoCloud/animation.xcassets/fanhui.imageset/fanhui.png
0 → 100644
1.57 KB