Commit 68183f612a11165eb0a3323f895c0c2a90138261
1 parent
fdc9f310
推流端将头像,昵称转成json传递,模型更改属性,获取头像,昵称
Showing
5 changed files
with
23 additions
and
9 deletions
LiveVideoCloud/LiveVideoCloud/Classes/Sections/LiveSections/Controller/LVCLiveViewController.m
| @@ -65,9 +65,9 @@ | @@ -65,9 +65,9 @@ | ||
| 65 | 65 | ||
| 66 | _kitCN = [[CNLiveGPUStreamerKit alloc] initWithDefaultConfigWithActivityId:activityId channelId:@"iOStest" isHorizontalScreen:@"0"]; | 66 | _kitCN = [[CNLiveGPUStreamerKit alloc] initWithDefaultConfigWithActivityId:activityId channelId:@"iOStest" isHorizontalScreen:@"0"]; |
| 67 | 67 | ||
| 68 | - _kitCN.coverImgUrl = @"https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3269891096,90190857&fm=23&gp=0.jpg"; | 68 | + _kitCN.coverImgUrl = @"https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=169300069,2234409601&fm=21&gp=0.jpg"; // 封面图 |
| 69 | // 昵称 头像 | 69 | // 昵称 头像 |
| 70 | - NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:@"我的名字好长啊", @"name", @"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1491035677269&di=242ef4123d2b4df15553ac208edaa56b&imgtype=0&src=http%3A%2F%2Fcdn.duitang.com%2Fuploads%2Fitem%2F201208%2F29%2F20120829103142_Vcaze.jpeg", @"iconUrl", nil]; | 70 | + NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:@"我的名字好长啊", @"name", @"http://www.qq745.com/uploads/allimg/150318/1-15031PGF8-51.jpg", @"iconUrl", nil]; |
| 71 | _kitCN.extensions = [self dictionaryToJson:userInfo]; | 71 | _kitCN.extensions = [self dictionaryToJson:userInfo]; |
| 72 | 72 | ||
| 73 | // 设置推流配置 | 73 | // 设置推流配置 |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Model/LVCUGCLiveListModel.m
| @@ -18,6 +18,7 @@ | @@ -18,6 +18,7 @@ | ||
| 18 | return @{@"activityList":@"LVCUGCLivePlayerModel"}; | 18 | return @{@"activityList":@"LVCUGCLivePlayerModel"}; |
| 19 | // return @{@"list":[SearchRecomListModel class]};二选一 | 19 | // return @{@"list":[SearchRecomListModel class]};二选一 |
| 20 | }]; | 20 | }]; |
| 21 | + | ||
| 21 | } | 22 | } |
| 22 | 23 | ||
| 23 | @end | 24 | @end |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Model/LVCUGCLivePlayerModel.h
| @@ -21,7 +21,8 @@ | @@ -21,7 +21,8 @@ | ||
| 21 | @property (nonatomic ,copy) NSString * _Nullable rates; | 21 | @property (nonatomic ,copy) NSString * _Nullable rates; |
| 22 | @property (nonatomic ,copy) NSString * _Nullable activityCategory; | 22 | @property (nonatomic ,copy) NSString * _Nullable activityCategory; |
| 23 | @property (nonatomic ,copy) NSString * _Nullable endTime; | 23 | @property (nonatomic ,copy) NSString * _Nullable endTime; |
| 24 | -@property (nonatomic ,copy) NSString * _Nullable extensions; | 24 | +@property (nonatomic ,copy) NSString * _Nullable extensionName; |
| 25 | +@property (nonatomic ,copy) NSString * _Nullable extensionIcon; | ||
| 25 | @property (nonatomic ,copy) NSString * _Nullable activityName; | 26 | @property (nonatomic ,copy) NSString * _Nullable activityName; |
| 26 | 27 | ||
| 27 | @end | 28 | @end |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Model/LVCUGCLivePlayerModel.m
| @@ -13,6 +13,11 @@ | @@ -13,6 +13,11 @@ | ||
| 13 | - (void)loadModel | 13 | - (void)loadModel |
| 14 | { | 14 | { |
| 15 | [super loadModel]; | 15 | [super loadModel]; |
| 16 | + | ||
| 17 | + [LVCUGCLivePlayerModel mj_setupReplacedKeyFromPropertyName:^NSDictionary *{ return @{ | ||
| 18 | + @"extensionName":@"extensions.name", | ||
| 19 | + @"extensionIcon":@"extensions.iconUrl" | ||
| 20 | + };}]; | ||
| 16 | 21 | ||
| 17 | } | 22 | } |
| 18 | 23 |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCUGCLivePlayerCell.m
| @@ -55,11 +55,19 @@ | @@ -55,11 +55,19 @@ | ||
| 55 | if (_model != model) { | 55 | if (_model != model) { |
| 56 | _model = model; | 56 | _model = model; |
| 57 | } | 57 | } |
| 58 | - _titleLabel.text = model.activityName; | ||
| 59 | - NSString *path = [[NSBundle mainBundle] pathForResource:@"timg" ofType:@"jpeg"]; | ||
| 60 | - UIImage *image = [UIImage imageWithContentsOfFile:path]; | 58 | + _titleLabel.text = model.activityName; // 标题 |
| 61 | 59 | ||
| 60 | + NSString *path = [[NSBundle mainBundle] pathForResource:@"timg" ofType:@"jpeg"];// 封面图 | ||
| 61 | + UIImage *image = [UIImage imageWithContentsOfFile:path]; | ||
| 62 | [_imageView sd_setImageWithURL:[NSURL URLWithString:model.coverImgUrl] placeholderImage:image]; | 62 | [_imageView sd_setImageWithURL:[NSURL URLWithString:model.coverImgUrl] placeholderImage:image]; |
| 63 | + | ||
| 64 | + if (model.extensionName.length > 0) { | ||
| 65 | + _nameLabel.text = model.extensionName; | ||
| 66 | + } | ||
| 67 | + NSString *iconPath = [[NSBundle mainBundle] pathForResource:@"头像" ofType:@"jpg"]; | ||
| 68 | + UIImage *iconImage = [UIImage imageWithContentsOfFile:iconPath]; | ||
| 69 | + [_iconView sd_setImageWithURL:[NSURL URLWithString:model.extensionIcon] placeholderImage:iconImage]; | ||
| 70 | + | ||
| 63 | switch ([model.activityStatus intValue]) { | 71 | switch ([model.activityStatus intValue]) { |
| 64 | case -2: // 异常 | 72 | case -2: // 异常 |
| 65 | _stateLabel.text = @"异常"; | 73 | _stateLabel.text = @"异常"; |
| @@ -86,10 +94,9 @@ | @@ -86,10 +94,9 @@ | ||
| 86 | - (UIImageView *)iconView { | 94 | - (UIImageView *)iconView { |
| 87 | 95 | ||
| 88 | if (!_iconView) { | 96 | if (!_iconView) { |
| 89 | - NSString *path = [[NSBundle mainBundle] pathForResource:@"头像" ofType:@"jpg"]; | ||
| 90 | - UIImage *image = [UIImage imageWithContentsOfFile:path]; | ||
| 91 | - _iconView = [[UIImageView alloc] initWithImage:image]; | 97 | + _iconView = [[UIImageView alloc] init]; |
| 92 | _iconView.frame = CGRectMake(10, 10, 50, 50); | 98 | _iconView.frame = CGRectMake(10, 10, 50, 50); |
| 99 | + _iconView.contentMode = UIViewContentModeScaleAspectFit; | ||
| 93 | _iconView.layer.cornerRadius = 25; | 100 | _iconView.layer.cornerRadius = 25; |
| 94 | _iconView.layer.masksToBounds = YES; | 101 | _iconView.layer.masksToBounds = YES; |
| 95 | } | 102 | } |