Commit c0cf25a898f7530da442d881653391ca6ba3b968
Merge branch 'master' of bj.gitlab.cnlive.com:ios-team/ScioLive into App-Store配置
Showing
19 changed files
with
260 additions
and
71 deletions
CNLiveScioLive.xcodeproj/project.pbxproj
| @@ -1699,22 +1699,22 @@ | @@ -1699,22 +1699,22 @@ | ||
| 1699 | 085D85FA2159C72F0037D480 /* Classes */ = { | 1699 | 085D85FA2159C72F0037D480 /* Classes */ = { |
| 1700 | isa = PBXGroup; | 1700 | isa = PBXGroup; |
| 1701 | children = ( | 1701 | children = ( |
| 1702 | + 085D85FF2159C72F0037D480 /* ZXVideoPlayerController.h */, | ||
| 1703 | + 085D86072159C72F0037D480 /* ZXVideoPlayerController.m */, | ||
| 1704 | + 085D86002159C72F0037D480 /* ZXVideoPlayerControlView.h */, | ||
| 1705 | + 085D86062159C72F0037D480 /* ZXVideoPlayerControlView.m */, | ||
| 1702 | 085D86942159C8110037D480 /* JGMusicManager.h */, | 1706 | 085D86942159C8110037D480 /* JGMusicManager.h */, |
| 1703 | 085D86932159C8100037D480 /* JGMusicManager.m */, | 1707 | 085D86932159C8100037D480 /* JGMusicManager.m */, |
| 1704 | - 085D85FB2159C72F0037D480 /* ZXVideo.m */, | ||
| 1705 | - 085D85FC2159C72F0037D480 /* ZXVideoPlayerTimeIndicatorView.h */, | ||
| 1706 | 085D85FD2159C72F0037D480 /* ZXVideoPlayerVolumeView.h */, | 1708 | 085D85FD2159C72F0037D480 /* ZXVideoPlayerVolumeView.h */, |
| 1709 | + 085D86042159C72F0037D480 /* ZXVideo.h */, | ||
| 1710 | + 085D85FB2159C72F0037D480 /* ZXVideo.m */, | ||
| 1707 | 085D85FE2159C72F0037D480 /* ZXVideoPlayerBrightnessView.h */, | 1711 | 085D85FE2159C72F0037D480 /* ZXVideoPlayerBrightnessView.h */, |
| 1708 | - 085D85FF2159C72F0037D480 /* ZXVideoPlayerController.h */, | ||
| 1709 | - 085D86002159C72F0037D480 /* ZXVideoPlayerControlView.h */, | ||
| 1710 | - 085D86012159C72F0037D480 /* ZXVideoPlayerBatteryView.m */, | 1712 | + 085D86052159C72F0037D480 /* ZXVideoPlayerBrightnessView.m */, |
| 1711 | 085D86022159C72F0037D480 /* ZXVideoPlayerVolumeView.m */, | 1713 | 085D86022159C72F0037D480 /* ZXVideoPlayerVolumeView.m */, |
| 1714 | + 085D85FC2159C72F0037D480 /* ZXVideoPlayerTimeIndicatorView.h */, | ||
| 1712 | 085D86032159C72F0037D480 /* ZXVideoPlayerTimeIndicatorView.m */, | 1715 | 085D86032159C72F0037D480 /* ZXVideoPlayerTimeIndicatorView.m */, |
| 1713 | - 085D86042159C72F0037D480 /* ZXVideo.h */, | ||
| 1714 | - 085D86052159C72F0037D480 /* ZXVideoPlayerBrightnessView.m */, | ||
| 1715 | - 085D86062159C72F0037D480 /* ZXVideoPlayerControlView.m */, | ||
| 1716 | - 085D86072159C72F0037D480 /* ZXVideoPlayerController.m */, | ||
| 1717 | 085D86082159C72F0037D480 /* ZXVideoPlayerBatteryView.h */, | 1716 | 085D86082159C72F0037D480 /* ZXVideoPlayerBatteryView.h */, |
| 1717 | + 085D86012159C72F0037D480 /* ZXVideoPlayerBatteryView.m */, | ||
| 1718 | ); | 1718 | ); |
| 1719 | path = Classes; | 1719 | path = Classes; |
| 1720 | sourceTree = "<group>"; | 1720 | sourceTree = "<group>"; |
| @@ -1757,8 +1757,8 @@ | @@ -1757,8 +1757,8 @@ | ||
| 1757 | 085D86982159CBBB0037D480 /* CNLivePlayer */ = { | 1757 | 085D86982159CBBB0037D480 /* CNLivePlayer */ = { |
| 1758 | isa = PBXGroup; | 1758 | isa = PBXGroup; |
| 1759 | children = ( | 1759 | children = ( |
| 1760 | - 085D86992159CBBB0037D480 /* CNLivePlayerController.m */, | ||
| 1761 | 085D869A2159CBBB0037D480 /* CNLivePlayerController.h */, | 1760 | 085D869A2159CBBB0037D480 /* CNLivePlayerController.h */, |
| 1761 | + 085D86992159CBBB0037D480 /* CNLivePlayerController.m */, | ||
| 1762 | ); | 1762 | ); |
| 1763 | path = CNLivePlayer; | 1763 | path = CNLivePlayer; |
| 1764 | sourceTree = "<group>"; | 1764 | sourceTree = "<group>"; |
CNLiveScioLive/Assets.xcassets/live/cnlive_live_share.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "scale" : "1x" | ||
| 6 | + }, | ||
| 7 | + { | ||
| 8 | + "idiom" : "universal", | ||
| 9 | + "filename" : "cnlive_live_share@2x.png", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "idiom" : "universal", | ||
| 14 | + "filename" : "cnlive_live_share@3x.png", | ||
| 15 | + "scale" : "3x" | ||
| 16 | + } | ||
| 17 | + ], | ||
| 18 | + "info" : { | ||
| 19 | + "version" : 1, | ||
| 20 | + "author" : "xcode" | ||
| 21 | + } | ||
| 22 | +} | ||
| 0 | \ No newline at end of file | 23 | \ No newline at end of file |
CNLiveScioLive/Assets.xcassets/live/cnlive_live_share.imageset/cnlive_live_share@2x.png
0 → 100644
2.99 KB
CNLiveScioLive/Assets.xcassets/live/cnlive_live_share.imageset/cnlive_live_share@3x.png
0 → 100644
5.09 KB
CNLiveScioLive/Pages/Base/CNLiveENTabBarController.m
| @@ -9,7 +9,9 @@ | @@ -9,7 +9,9 @@ | ||
| 9 | #import "CNLiveENTabBarController.h" | 9 | #import "CNLiveENTabBarController.h" |
| 10 | #import "XWTabBarModel.h" | 10 | #import "XWTabBarModel.h" |
| 11 | 11 | ||
| 12 | -@interface CNLiveENTabBarController () | 12 | +@interface CNLiveENTabBarController ()<UITabBarDelegate>{ |
| 13 | + NSInteger _indexFlag; | ||
| 14 | +} | ||
| 13 | @property (nonatomic, copy) NSMutableArray *controllers; | 15 | @property (nonatomic, copy) NSMutableArray *controllers; |
| 14 | 16 | ||
| 15 | @end | 17 | @end |
| @@ -19,7 +21,8 @@ | @@ -19,7 +21,8 @@ | ||
| 19 | - (void)viewDidLoad { | 21 | - (void)viewDidLoad { |
| 20 | [super viewDidLoad]; | 22 | [super viewDidLoad]; |
| 21 | // Do any additional setup after loading the view. | 23 | // Do any additional setup after loading the view. |
| 22 | - | 24 | + _indexFlag = 0; |
| 25 | + | ||
| 23 | [self initItemsAndViewContorllers]; | 26 | [self initItemsAndViewContorllers]; |
| 24 | // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeLanguageVersion:) name:@"changeLanguageVersion" object:nil]; | 27 | // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeLanguageVersion:) name:@"changeLanguageVersion" object:nil]; |
| 25 | 28 | ||
| @@ -127,5 +130,31 @@ | @@ -127,5 +130,31 @@ | ||
| 127 | return [self.selectedViewController supportedInterfaceOrientations]; | 130 | return [self.selectedViewController supportedInterfaceOrientations]; |
| 128 | 131 | ||
| 129 | } | 132 | } |
| 130 | - | 133 | +- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item{ |
| 134 | + NSInteger index = [self.tabBar.items indexOfObject:item]; | ||
| 135 | + if (_indexFlag != index) { | ||
| 136 | + [self animationWithIndex:index]; | ||
| 137 | + } | ||
| 138 | +} | ||
| 139 | +// 动画 | ||
| 140 | +- (void)animationWithIndex:(NSInteger) index { | ||
| 141 | + NSMutableArray * tabbarbuttonArray = [NSMutableArray array]; | ||
| 142 | + for (UIView *tabBarButton in self.tabBar.subviews) { | ||
| 143 | + if ([tabBarButton isKindOfClass:NSClassFromString(@"UITabBarButton")]) { | ||
| 144 | + [tabbarbuttonArray addObject:tabBarButton]; | ||
| 145 | + } | ||
| 146 | + } | ||
| 147 | + CABasicAnimation*pulse = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; | ||
| 148 | + pulse.timingFunction= [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; | ||
| 149 | + pulse.duration = 0.15; | ||
| 150 | + pulse.repeatCount= 1; | ||
| 151 | + pulse.autoreverses= YES; | ||
| 152 | + pulse.fromValue= [NSNumber numberWithFloat:0.7]; | ||
| 153 | + pulse.toValue= [NSNumber numberWithFloat:1.3]; | ||
| 154 | + [[tabbarbuttonArray[index] layer] | ||
| 155 | + addAnimation:pulse forKey:nil]; | ||
| 156 | + | ||
| 157 | + _indexFlag = index; | ||
| 158 | + | ||
| 159 | +} | ||
| 131 | @end | 160 | @end |
CNLiveScioLive/Pages/Base/CNLiveTabBarController.m
| @@ -9,17 +9,19 @@ | @@ -9,17 +9,19 @@ | ||
| 9 | #import "CNLiveTabBarController.h" | 9 | #import "CNLiveTabBarController.h" |
| 10 | #import "XWTabBarModel.h" | 10 | #import "XWTabBarModel.h" |
| 11 | 11 | ||
| 12 | -@interface CNLiveTabBarController () | 12 | +@interface CNLiveTabBarController ()<UITabBarDelegate>{ |
| 13 | + NSInteger _indexFlag; | ||
| 14 | +} | ||
| 13 | @property (nonatomic, copy) NSMutableArray *controllers; | 15 | @property (nonatomic, copy) NSMutableArray *controllers; |
| 14 | 16 | ||
| 15 | @end | 17 | @end |
| 16 | 18 | ||
| 17 | @implementation CNLiveTabBarController | 19 | @implementation CNLiveTabBarController |
| 18 | - | 20 | +#pragma mark - life cycle |
| 19 | - (void)viewDidLoad { | 21 | - (void)viewDidLoad { |
| 20 | [super viewDidLoad]; | 22 | [super viewDidLoad]; |
| 21 | // Do any additional setup after loading the view. | 23 | // Do any additional setup after loading the view. |
| 22 | - | 24 | + _indexFlag = 0; |
| 23 | [self initItemsAndViewContorllers]; | 25 | [self initItemsAndViewContorllers]; |
| 24 | // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeLanguageVersion:) name:@"changeLanguageVersion" object:nil]; | 26 | // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeLanguageVersion:) name:@"changeLanguageVersion" object:nil]; |
| 25 | 27 | ||
| @@ -34,6 +36,7 @@ | @@ -34,6 +36,7 @@ | ||
| 34 | // } | 36 | // } |
| 35 | // | 37 | // |
| 36 | //} | 38 | //} |
| 39 | +#pragma mark - private methods | ||
| 37 | - (void)initItemsAndViewContorllers { | 40 | - (void)initItemsAndViewContorllers { |
| 38 | 41 | ||
| 39 | NSMutableArray *viewControllerArr = [NSMutableArray array]; | 42 | NSMutableArray *viewControllerArr = [NSMutableArray array]; |
| @@ -71,7 +74,7 @@ | @@ -71,7 +74,7 @@ | ||
| 71 | } | 74 | } |
| 72 | self.viewControllers = viewControllerArr; | 75 | self.viewControllers = viewControllerArr; |
| 73 | } | 76 | } |
| 74 | -#pragma mark --懒加载 | 77 | +#pragma mark - getters and setters |
| 75 | - (NSMutableArray *)controllers { | 78 | - (NSMutableArray *)controllers { |
| 76 | if (!_controllers) { | 79 | if (!_controllers) { |
| 77 | _controllers = [NSMutableArray array]; | 80 | _controllers = [NSMutableArray array]; |
| @@ -138,4 +141,32 @@ | @@ -138,4 +141,32 @@ | ||
| 138 | 141 | ||
| 139 | } | 142 | } |
| 140 | 143 | ||
| 144 | +#pragma mark - UITabBarDelegate | ||
| 145 | +- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item{ | ||
| 146 | + NSInteger index = [self.tabBar.items indexOfObject:item]; | ||
| 147 | + if (_indexFlag != index) { | ||
| 148 | + [self animationWithIndex:index]; | ||
| 149 | + } | ||
| 150 | +} | ||
| 151 | +// 动画 | ||
| 152 | +- (void)animationWithIndex:(NSInteger) index { | ||
| 153 | + NSMutableArray * tabbarbuttonArray = [NSMutableArray array]; | ||
| 154 | + for (UIView *tabBarButton in self.tabBar.subviews) { | ||
| 155 | + if ([tabBarButton isKindOfClass:NSClassFromString(@"UITabBarButton")]) { | ||
| 156 | + [tabbarbuttonArray addObject:tabBarButton]; | ||
| 157 | + } | ||
| 158 | + } | ||
| 159 | + CABasicAnimation*pulse = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; | ||
| 160 | + pulse.timingFunction= [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; | ||
| 161 | + pulse.duration = 0.20; | ||
| 162 | + pulse.repeatCount= 1; | ||
| 163 | + pulse.autoreverses= YES; | ||
| 164 | + pulse.fromValue= [NSNumber numberWithFloat:0.9]; | ||
| 165 | + pulse.toValue= [NSNumber numberWithFloat:1.1]; | ||
| 166 | + [[tabbarbuttonArray[index] layer] | ||
| 167 | + addAnimation:pulse forKey:nil]; | ||
| 168 | + | ||
| 169 | + _indexFlag = index; | ||
| 170 | + | ||
| 171 | +} | ||
| 141 | @end | 172 | @end |
CNLiveScioLive/Pages/Live/Controller/CNLiveViewController.m
| @@ -173,6 +173,8 @@ static NSString *indicatorTableViewCell = @"CNLiveIndicatorTableViewCell"; | @@ -173,6 +173,8 @@ static NSString *indicatorTableViewCell = @"CNLiveIndicatorTableViewCell"; | ||
| 173 | 173 | ||
| 174 | self.navigationController.navigationBar.barTintColor = [UIColor whiteColor]; | 174 | self.navigationController.navigationBar.barTintColor = [UIColor whiteColor]; |
| 175 | self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:[UIColor whiteColor], NSFontAttributeName:[UIFont systemFontOfSize:18]}; | 175 | self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:[UIColor whiteColor], NSFontAttributeName:[UIFont systemFontOfSize:18]}; |
| 176 | + [self.navigationController setNavigationBarHidden:NO]; | ||
| 177 | + | ||
| 176 | } | 178 | } |
| 177 | 179 | ||
| 178 | - (void)viewDidLoad { | 180 | - (void)viewDidLoad { |
CNLiveScioLive/Pages/Live/Controller/GraphicLiveViewController.h
| @@ -54,5 +54,7 @@ typedef NS_ENUM(NSInteger, PlayerType) { | @@ -54,5 +54,7 @@ typedef NS_ENUM(NSInteger, PlayerType) { | ||
| 54 | @property (nonatomic, assign) PlayerType type; | 54 | @property (nonatomic, assign) PlayerType type; |
| 55 | 55 | ||
| 56 | @property (nonatomic, strong) NSArray *relatedArray; | 56 | @property (nonatomic, strong) NSArray *relatedArray; |
| 57 | --(id)initWithDictionary:(NSDictionary*)dictionary; | 57 | + |
| 58 | +- (id)initWithDictionary:(NSDictionary*)dictionary; | ||
| 59 | + | ||
| 58 | @end | 60 | @end |
CNLiveScioLive/Pages/Live/Controller/GraphicLiveViewController.m
| @@ -9,14 +9,15 @@ | @@ -9,14 +9,15 @@ | ||
| 9 | #import "GraphicLiveViewController.h" | 9 | #import "GraphicLiveViewController.h" |
| 10 | #import "OldVideoDetailViewController.h" | 10 | #import "OldVideoDetailViewController.h" |
| 11 | 11 | ||
| 12 | -@interface GraphicLiveViewController () | 12 | +@interface GraphicLiveViewController ()<CNLivePlayerControllerDelegate> |
| 13 | @end | 13 | @end |
| 14 | @implementation GraphicLiveViewController | 14 | @implementation GraphicLiveViewController |
| 15 | - (void)Pop:(id)sender{ | 15 | - (void)Pop:(id)sender{ |
| 16 | [self.videoController stop]; | 16 | [self.videoController stop]; |
| 17 | [self.navigationController popViewControllerAnimated:YES]; | 17 | [self.navigationController popViewControllerAnimated:YES]; |
| 18 | } | 18 | } |
| 19 | -- (id)initWithDictionary:(NSDictionary*)dictionary { | 19 | + |
| 20 | +- (id)initWithDictionary:(NSDictionary *)dictionary { | ||
| 20 | if (self = [super init]) { | 21 | if (self = [super init]) { |
| 21 | _dictionary = [NSDictionary dictionaryWithDictionary:dictionary]; | 22 | _dictionary = [NSDictionary dictionaryWithDictionary:dictionary]; |
| 22 | int status = [_dictionary[@"status"] intValue]; | 23 | int status = [_dictionary[@"status"] intValue]; |
| @@ -44,12 +45,14 @@ | @@ -44,12 +45,14 @@ | ||
| 44 | } | 45 | } |
| 45 | return self; | 46 | return self; |
| 46 | } | 47 | } |
| 48 | + | ||
| 47 | - (NSString *)setHTMLString { | 49 | - (NSString *)setHTMLString { |
| 48 | NSString* htmlBody = [[NSString alloc] initWithFormat:@"<p><font style=\"font-size:%@px;\">%@</font></p>",fontArray[fontIndex],[_dic objectForKey:@"Content"]]; | 50 | NSString* htmlBody = [[NSString alloc] initWithFormat:@"<p><font style=\"font-size:%@px;\">%@</font></p>",fontArray[fontIndex],[_dic objectForKey:@"Content"]]; |
| 49 | NSString* htmlFooter = @"</body></html>"; | 51 | NSString* htmlFooter = @"</body></html>"; |
| 50 | NSString* strHtml = [[NSString alloc] initWithFormat:@"%@%@",htmlBody,htmlFooter]; | 52 | NSString* strHtml = [[NSString alloc] initWithFormat:@"%@%@",htmlBody,htmlFooter]; |
| 51 | return strHtml; | 53 | return strHtml; |
| 52 | } | 54 | } |
| 55 | + | ||
| 53 | - (void)loadData { | 56 | - (void)loadData { |
| 54 | if (![[Reachability reachabilityForInternetConnection] currentReachabilityStatus]) { | 57 | if (![[Reachability reachabilityForInternetConnection] currentReachabilityStatus]) { |
| 55 | [AlertViewTool showHUDViewText:CustomStr(@"NetworkiInterruption")]; | 58 | [AlertViewTool showHUDViewText:CustomStr(@"NetworkiInterruption")]; |
| @@ -89,12 +92,14 @@ | @@ -89,12 +92,14 @@ | ||
| 89 | [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error: &error]; | 92 | [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error: &error]; |
| 90 | [[AVAudioSession sharedInstance] setActive:YES error:nil]; | 93 | [[AVAudioSession sharedInstance] setActive:YES error:nil]; |
| 91 | } | 94 | } |
| 95 | + | ||
| 92 | - (void)viewWillDisappear:(BOOL)animated { | 96 | - (void)viewWillDisappear:(BOOL)animated { |
| 93 | [super viewWillDisappear:animated]; | 97 | [super viewWillDisappear:animated]; |
| 94 | [self.liveController stop]; | 98 | [self.liveController stop]; |
| 95 | self.liveController = nil; | 99 | self.liveController = nil; |
| 96 | [self.navigationController setNavigationBarHidden:NO]; | 100 | [self.navigationController setNavigationBarHidden:NO]; |
| 97 | } | 101 | } |
| 102 | + | ||
| 98 | - (void)viewDidLoad { | 103 | - (void)viewDidLoad { |
| 99 | [super viewDidLoad]; | 104 | [super viewDidLoad]; |
| 100 | self.view.backgroundColor = [UIColor whiteColor]; | 105 | self.view.backgroundColor = [UIColor whiteColor]; |
| @@ -168,15 +173,73 @@ | @@ -168,15 +173,73 @@ | ||
| 168 | - (void)loadMovieView { | 173 | - (void)loadMovieView { |
| 169 | [[NSUserDefaults standardUserDefaults] setObject:@0 forKey:@"GraphicLive_DidLockScreen"]; | 174 | [[NSUserDefaults standardUserDefaults] setObject:@0 forKey:@"GraphicLive_DidLockScreen"]; |
| 170 | imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, iPhoneX ? 44 : 0, MainScreenWidth, videoHeight)]; | 175 | imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, iPhoneX ? 44 : 0, MainScreenWidth, videoHeight)]; |
| 171 | - imageView.image = [UIImage imageNamed:@"cnlive_placeholder"]; | 176 | + [imageView sd_setImageWithURL:[NSURL URLWithString:_dictionary[@"poster"]] placeholderImage:[UIImage imageNamed:@"cnlive_placeholder"]]; |
| 172 | [self.view addSubview:imageView]; | 177 | [self.view addSubview:imageView]; |
| 173 | 178 | ||
| 174 | UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom]; | 179 | UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom]; |
| 175 | [backButton addTarget:self action:@selector(Pop:) forControlEvents:UIControlEventTouchUpInside]; | 180 | [backButton addTarget:self action:@selector(Pop:) forControlEvents:UIControlEventTouchUpInside]; |
| 176 | [backButton setImage:[UIImage imageNamed:@"cnlive_white_back"] forState:UIControlStateNormal]; | 181 | [backButton setImage:[UIImage imageNamed:@"cnlive_white_back"] forState:UIControlStateNormal]; |
| 177 | - [backButton setFrame:CGRectMake(0, 20, 44, 44)]; | 182 | + [backButton setFrame:CGRectMake(0, StatusBarHeight, 44, 44)]; |
| 178 | [self.view addSubview:backButton]; | 183 | [self.view addSubview:backButton]; |
| 184 | + | ||
| 185 | + UIButton *shareButton = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 186 | + [shareButton addTarget:self action:@selector(shareButton:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 187 | + [shareButton setImage:[UIImage imageNamed:@"cnlive_live_share"] forState:UIControlStateNormal]; | ||
| 188 | + [shareButton setFrame:CGRectMake(MainScreenWidth-40, StatusBarHeight+7, 30, 30)]; | ||
| 189 | + [self.view addSubview:shareButton]; | ||
| 190 | + | ||
| 179 | } | 191 | } |
| 192 | + | ||
| 193 | +- (void)shareButton:(UIButton *)btn{ | ||
| 194 | + NSString *text = [NSString stringWithFormat:@"%@",_dictionary[@"Description"]]; | ||
| 195 | + NSString *shareUrl = [NSString stringWithFormat:@"%@",_dictionary[@"shareUrl"]]; | ||
| 196 | + | ||
| 197 | + if ([text isEqualToString:@"<null>"]) { | ||
| 198 | + text = _dictionary[@"title"]; | ||
| 199 | + } | ||
| 200 | + if ([shareUrl isEqualToString:@"<null>"]||[shareUrl isEqualToString:@"(null)"]) { | ||
| 201 | + shareUrl = @"http://app.scio.gov.cn/gxbShare.html"; | ||
| 202 | + } | ||
| 203 | + NSMutableDictionary *shareParams = [NSMutableDictionary dictionary]; | ||
| 204 | + [shareParams SSDKSetupShareParamsByText:text | ||
| 205 | + images:@[[UIImage imageNamed:@"cnlive_zhouxin_icon"]] | ||
| 206 | + url:[NSURL URLWithString:shareUrl] | ||
| 207 | + title:_dictionary[@"title"] | ||
| 208 | + type:SSDKContentTypeAuto]; | ||
| 209 | + //2、分享(可以弹出我们的分享菜单和编辑界面) | ||
| 210 | + //要显示菜单的视图, iPad版中此参数作为弹出菜单的参照视图,只有传这个才可以弹出我们的分享菜单,可以传分享的按钮对象或者自己创建小的view 对象,iPhone可以传nil不会影响 | ||
| 211 | + [ShareSDK showShareActionSheet:nil items:nil shareParams:shareParams onShareStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error, BOOL end) { | ||
| 212 | + | ||
| 213 | + switch (state) { | ||
| 214 | + case SSDKResponseStateSuccess: | ||
| 215 | + { | ||
| 216 | + UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:CustomStr(@"ShareSuccess") | ||
| 217 | + message:nil | ||
| 218 | + delegate:nil | ||
| 219 | + cancelButtonTitle:CustomStr(@"Sure") | ||
| 220 | + otherButtonTitles:nil]; | ||
| 221 | + [alertView show]; | ||
| 222 | + break; | ||
| 223 | + } | ||
| 224 | + case SSDKResponseStateFail: | ||
| 225 | + { | ||
| 226 | + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:CustomStr(@"ShareFailure") | ||
| 227 | + message:[NSString stringWithFormat:@"%@",error] | ||
| 228 | + delegate:nil | ||
| 229 | + cancelButtonTitle:CustomStr(@"Sure") | ||
| 230 | + otherButtonTitles:nil, nil]; | ||
| 231 | + [alert show]; | ||
| 232 | + break; | ||
| 233 | + } | ||
| 234 | + default: | ||
| 235 | + break; | ||
| 236 | + | ||
| 237 | + } | ||
| 238 | + | ||
| 239 | + }]; | ||
| 240 | + | ||
| 241 | +} | ||
| 242 | + | ||
| 180 | - (void)pausePlayer { | 243 | - (void)pausePlayer { |
| 181 | [self.liveController pause]; | 244 | [self.liveController pause]; |
| 182 | } | 245 | } |
| @@ -187,12 +250,19 @@ | @@ -187,12 +250,19 @@ | ||
| 187 | CGRect frame = CGRectMake(0, iPhoneX ? 44 : 0, MainScreenWidth, videoHeight); | 250 | CGRect frame = CGRectMake(0, iPhoneX ? 44 : 0, MainScreenWidth, videoHeight); |
| 188 | UIView *bgView = [[UIView alloc] initWithFrame:frame]; | 251 | UIView *bgView = [[UIView alloc] initWithFrame:frame]; |
| 189 | bgView.backgroundColor = [UIColor blackColor]; | 252 | bgView.backgroundColor = [UIColor blackColor]; |
| 253 | + [self.view addSubview:bgView]; | ||
| 254 | + | ||
| 190 | UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom]; | 255 | UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom]; |
| 191 | backButton.frame = CGRectMake(20, 20, 25, 41); | 256 | backButton.frame = CGRectMake(20, 20, 25, 41); |
| 192 | [backButton setImage:[UIImage imageNamed:@"cnlive_white_back"] forState:UIControlStateNormal]; | 257 | [backButton setImage:[UIImage imageNamed:@"cnlive_white_back"] forState:UIControlStateNormal]; |
| 193 | [backButton addTarget:self action:@selector(backButtonAction:) forControlEvents:UIControlEventTouchUpInside]; | 258 | [backButton addTarget:self action:@selector(backButtonAction:) forControlEvents:UIControlEventTouchUpInside]; |
| 194 | [bgView addSubview:backButton]; | 259 | [bgView addSubview:backButton]; |
| 195 | - [self.view addSubview:bgView]; | 260 | + |
| 261 | + UIButton *shareButton = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 262 | + [shareButton addTarget:self action:@selector(shareButton:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 263 | + [shareButton setImage:[UIImage imageNamed:@"cnlive_live_share"] forState:UIControlStateNormal]; | ||
| 264 | + [shareButton setFrame:CGRectMake(MainScreenWidth-40, StatusBarHeight+7, 30, 30)]; | ||
| 265 | + [bgView addSubview:shareButton]; | ||
| 196 | 266 | ||
| 197 | if (self.type == PlayerTypeLiving) { | 267 | if (self.type == PlayerTypeLiving) { |
| 198 | // 直播 | 268 | // 直播 |
| @@ -205,6 +275,8 @@ | @@ -205,6 +275,8 @@ | ||
| 205 | } getAnchorStatusResult:^(BOOL result) { | 275 | } getAnchorStatusResult:^(BOOL result) { |
| 206 | NSLog(@"获取主播状态%d", result ? YES : NO); | 276 | NSLog(@"获取主播状态%d", result ? YES : NO); |
| 207 | }]; | 277 | }]; |
| 278 | + self.liveController.delegate = self; | ||
| 279 | + | ||
| 208 | } else { | 280 | } else { |
| 209 | // 点播 | 281 | // 点播 |
| 210 | self.liveController = [[CNLivePlayerController alloc] initVodPlayWithVId:_dictionary[@"playbackId"] authSuccess:^{ | 282 | self.liveController = [[CNLivePlayerController alloc] initVodPlayWithVId:_dictionary[@"playbackId"] authSuccess:^{ |
| @@ -214,6 +286,7 @@ | @@ -214,6 +286,7 @@ | ||
| 214 | } authFailed:^(NSDictionary *errorInfo) { | 286 | } authFailed:^(NSDictionary *errorInfo) { |
| 215 | NSLog(@"初始化点播播放器失败%@", errorInfo); | 287 | NSLog(@"初始化点播播放器失败%@", errorInfo); |
| 216 | }]; | 288 | }]; |
| 289 | + self.liveController.delegate = self; | ||
| 217 | } | 290 | } |
| 218 | [[NSUserDefaults standardUserDefaults] setObject:@0 forKey:@"ZXVideoPlayer_DidLockScreen"]; | 291 | [[NSUserDefaults standardUserDefaults] setObject:@0 forKey:@"ZXVideoPlayer_DidLockScreen"]; |
| 219 | __weak typeof(self) weakSelf = self; | 292 | __weak typeof(self) weakSelf = self; |
| @@ -230,6 +303,10 @@ | @@ -230,6 +303,10 @@ | ||
| 230 | self.liveController.video = video; | 303 | self.liveController.video = video; |
| 231 | } | 304 | } |
| 232 | 305 | ||
| 306 | +- (void)shareButtonCNLivePlayerController:(CNLivePlayerController *)view{ | ||
| 307 | + [self shareButton:nil]; | ||
| 308 | + | ||
| 309 | +} | ||
| 233 | - (void)backButtonAction:(UIButton *)sender { | 310 | - (void)backButtonAction:(UIButton *)sender { |
| 234 | [self.navigationController popViewControllerAnimated:YES]; | 311 | [self.navigationController popViewControllerAnimated:YES]; |
| 235 | } | 312 | } |
CNLiveScioLive/Pages/Live/Controller/VideoPlayBackViewController.m
| @@ -23,25 +23,35 @@ | @@ -23,25 +23,35 @@ | ||
| 23 | [self.videoController stop]; | 23 | [self.videoController stop]; |
| 24 | [self.navigationController popToRootViewControllerAnimated:YES]; | 24 | [self.navigationController popToRootViewControllerAnimated:YES]; |
| 25 | } | 25 | } |
| 26 | --(id)initWithDictionary:(NSDictionary*)dictionary{ | 26 | +- (id)initWithDictionary:(NSDictionary*)dictionary{ |
| 27 | if (self = [super init]) { | 27 | if (self = [super init]) { |
| 28 | _dictionary = [NSDictionary dictionaryWithDictionary:dictionary]; | 28 | _dictionary = [NSDictionary dictionaryWithDictionary:dictionary]; |
| 29 | - if (![_dictionary[@"videoUrl"] isEqualToString:@""]) { | ||
| 30 | - isPlay = YES; | ||
| 31 | - url = _dictionary[@"videoUrl"]; | ||
| 32 | - if (0 == [url length]) { | ||
| 33 | - url = _dictionary[@"uploadVideoUrl"]; | 29 | + if ([_dictionary[@"videoFlag"] isEqualToString:@"1"]) { |
| 30 | + if (![_dictionary[@"videoUrl"] isEqualToString:@""]) { | ||
| 31 | + isPlay = YES; | ||
| 32 | + url = _dictionary[@"videoUrl"]; | ||
| 33 | + if (0 == [url length]) { | ||
| 34 | + url = _dictionary[@"uploadVideoUrl"]; | ||
| 35 | + } | ||
| 36 | + url = [url stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; | ||
| 37 | + movieUrl = [NSURL URLWithString:url]; | ||
| 38 | + | ||
| 39 | + } else { | ||
| 40 | + isPlay = NO; | ||
| 34 | } | 41 | } |
| 35 | - url = [url stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; | ||
| 36 | - movieUrl = [NSURL URLWithString:url]; | 42 | + |
| 37 | } else { | 43 | } else { |
| 38 | isPlay = NO; | 44 | isPlay = NO; |
| 45 | + | ||
| 39 | } | 46 | } |
| 47 | + | ||
| 40 | NSLog(@"movieUrl -> %@",movieUrl); | 48 | NSLog(@"movieUrl -> %@",movieUrl); |
| 41 | videoHeight = MainScreenWidth * (9.0 / 16.0); | 49 | videoHeight = MainScreenWidth * (9.0 / 16.0); |
| 50 | + | ||
| 42 | } | 51 | } |
| 43 | return self; | 52 | return self; |
| 44 | } | 53 | } |
| 54 | + | ||
| 45 | - (NSString *)setHTMLString { | 55 | - (NSString *)setHTMLString { |
| 46 | // NSString* htmlHeader = [[NSString alloc] initWithFormat:@"<html><p><font style=\"font-size:20px;\"><strong>%@</strong></font><br>%@</p><body>",[_dicArticle objectForKey:@"Tittle"],[_dicArticle objectForKey:@"PublishDateTime"]]; | 56 | // NSString* htmlHeader = [[NSString alloc] initWithFormat:@"<html><p><font style=\"font-size:20px;\"><strong>%@</strong></font><br>%@</p><body>",[_dicArticle objectForKey:@"Tittle"],[_dicArticle objectForKey:@"PublishDateTime"]]; |
| 47 | NSString* htmlBody = [[NSString alloc] initWithFormat:@"<p><font style=\"font-size:%@px;\">%@</font></p>",fontArray[fontIndex],[_dicArticle objectForKey:@"Content"]]; | 57 | NSString* htmlBody = [[NSString alloc] initWithFormat:@"<p><font style=\"font-size:%@px;\">%@</font></p>",fontArray[fontIndex],[_dicArticle objectForKey:@"Content"]]; |
| @@ -126,6 +136,7 @@ | @@ -126,6 +136,7 @@ | ||
| 126 | [shareButton addTarget:self action:@selector(shareButtonTaped:) forControlEvents:UIControlEventTouchUpInside]; | 136 | [shareButton addTarget:self action:@selector(shareButtonTaped:) forControlEvents:UIControlEventTouchUpInside]; |
| 127 | [self.view addSubview:shareButton]; | 137 | [self.view addSubview:shareButton]; |
| 128 | [shareButton setTag:30000]; | 138 | [shareButton setTag:30000]; |
| 139 | + | ||
| 129 | } | 140 | } |
| 130 | - (void)shareButtonTaped:(id)sender { | 141 | - (void)shareButtonTaped:(id)sender { |
| 131 | UIButton *btn = (UIButton *)sender; | 142 | UIButton *btn = (UIButton *)sender; |
| @@ -297,13 +308,13 @@ | @@ -297,13 +308,13 @@ | ||
| 297 | - (void)loadMovieView { | 308 | - (void)loadMovieView { |
| 298 | [[NSUserDefaults standardUserDefaults] setObject:@0 forKey:@"GraphicLive_DidLockScreen"]; | 309 | [[NSUserDefaults standardUserDefaults] setObject:@0 forKey:@"GraphicLive_DidLockScreen"]; |
| 299 | imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, iPhoneX ? 44 : 0, MainScreenWidth, videoHeight)]; | 310 | imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, iPhoneX ? 44 : 0, MainScreenWidth, videoHeight)]; |
| 300 | - imageView.image = [UIImage imageNamed:@"backDefault1"]; | 311 | + [imageView sd_setImageWithURL:[NSURL URLWithString:_dictionary[@"poster"]] placeholderImage:[UIImage imageNamed:@"cnlive_placeholder"]]; |
| 301 | [self.view addSubview:imageView]; | 312 | [self.view addSubview:imageView]; |
| 302 | 313 | ||
| 303 | UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom]; | 314 | UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom]; |
| 304 | [backButton addTarget:self action:@selector(Pop:) forControlEvents:UIControlEventTouchUpInside]; | 315 | [backButton addTarget:self action:@selector(Pop:) forControlEvents:UIControlEventTouchUpInside]; |
| 305 | - [backButton setImage:[UIImage imageNamed:@"navigationBack"] forState:UIControlStateNormal]; | ||
| 306 | - [backButton setFrame:CGRectMake(0, 20, 44, 44)]; | 316 | + [backButton setImage:[UIImage imageNamed:@"cnlive_white_back"] forState:UIControlStateNormal]; |
| 317 | + [backButton setFrame:CGRectMake(0, StatusBarHeight, 44, 44)]; | ||
| 307 | [self.view addSubview:backButton]; | 318 | [self.view addSubview:backButton]; |
| 308 | } | 319 | } |
| 309 | 320 |
CNLiveScioLive/Pages/Live/Model/CNLiveModel.h
| @@ -18,6 +18,12 @@ | @@ -18,6 +18,12 @@ | ||
| 18 | @property (nonatomic, copy) NSString *img; | 18 | @property (nonatomic, copy) NSString *img; |
| 19 | @property (nonatomic, copy) NSString *selectedImage; | 19 | @property (nonatomic, copy) NSString *selectedImage; |
| 20 | @property (nonatomic, copy) NSString *createDate; | 20 | @property (nonatomic, copy) NSString *createDate; |
| 21 | +@property (nonatomic, copy) NSString *liveShow;//liveShow 展示标识 0:APP不展示 1:展示 | ||
| 22 | + | ||
| 23 | + | ||
| 24 | +@property (nonatomic, copy) NSString *liveFlag;//liveFlag 直播标识 0:视频直播 1:图文直播 | ||
| 25 | + | ||
| 26 | +@property (nonatomic, copy) NSString *videoFlag;//videoFlag 0 图文回放 1视频回放 | ||
| 21 | 27 | ||
| 22 | 28 | ||
| 23 | /* | 29 | /* |
| @@ -39,7 +45,6 @@ | @@ -39,7 +45,6 @@ | ||
| 39 | } | 45 | } |
| 40 | */ | 46 | */ |
| 41 | 47 | ||
| 42 | -@property (nonatomic, copy) NSString *liveFlag; | ||
| 43 | @property (nonatomic, copy) NSString *activityId; | 48 | @property (nonatomic, copy) NSString *activityId; |
| 44 | @property (nonatomic, copy) NSString *playbackId; | 49 | @property (nonatomic, copy) NSString *playbackId; |
| 45 | @property (nonatomic, copy) NSString *checkinfo; | 50 | @property (nonatomic, copy) NSString *checkinfo; |
| @@ -63,4 +68,6 @@ | @@ -63,4 +68,6 @@ | ||
| 63 | 68 | ||
| 64 | @property (nonatomic, copy) NSString *publishDate; | 69 | @property (nonatomic, copy) NSString *publishDate; |
| 65 | 70 | ||
| 71 | +@property (nonatomic, copy) NSString *shareUrl; | ||
| 72 | + | ||
| 66 | @end | 73 | @end |
CNLiveScioLive/Pages/Live/View/CNLiveHeaderView.m
| @@ -11,10 +11,8 @@ | @@ -11,10 +11,8 @@ | ||
| 11 | 11 | ||
| 12 | @interface CNLiveHeaderView() | 12 | @interface CNLiveHeaderView() |
| 13 | @property (nonatomic, strong) UIImageView *backgroundImage; | 13 | @property (nonatomic, strong) UIImageView *backgroundImage; |
| 14 | -@property (nonatomic, strong) UILabel *titleLabel; | ||
| 15 | @property (nonatomic, strong) UILabel *stateLabel;//状态 | 14 | @property (nonatomic, strong) UILabel *stateLabel;//状态 |
| 16 | @property (nonatomic, strong) UIButton *playImage;//播放 | 15 | @property (nonatomic, strong) UIButton *playImage;//播放 |
| 17 | -@property (nonatomic, strong) UILabel *timeLabel;//时间 | ||
| 18 | 16 | ||
| 19 | @end | 17 | @end |
| 20 | 18 | ||
| @@ -39,13 +37,6 @@ | @@ -39,13 +37,6 @@ | ||
| 39 | [_playImage addTarget:self action:@selector(playImageClicked:) forControlEvents:UIControlEventTouchUpInside]; | 37 | [_playImage addTarget:self action:@selector(playImageClicked:) forControlEvents:UIControlEventTouchUpInside]; |
| 40 | [self addSubview:_playImage]; | 38 | [self addSubview:_playImage]; |
| 41 | 39 | ||
| 42 | - _titleLabel = [[UILabel alloc] init]; | ||
| 43 | - _titleLabel.numberOfLines = 1; | ||
| 44 | - _titleLabel.lineBreakMode = NSLineBreakByTruncatingTail; | ||
| 45 | - _titleLabel.textColor = [UIColor whiteColor]; | ||
| 46 | - _titleLabel.font = [UIFont systemFontOfSize:14]; | ||
| 47 | - [self addSubview:_titleLabel]; | ||
| 48 | - | ||
| 49 | _stateLabel = [[UILabel alloc] init]; | 40 | _stateLabel = [[UILabel alloc] init]; |
| 50 | _stateLabel.numberOfLines = 1; | 41 | _stateLabel.numberOfLines = 1; |
| 51 | _stateLabel.lineBreakMode = NSLineBreakByTruncatingTail; | 42 | _stateLabel.lineBreakMode = NSLineBreakByTruncatingTail; |
| @@ -55,13 +46,6 @@ | @@ -55,13 +46,6 @@ | ||
| 55 | _stateLabel.layer.masksToBounds = YES; | 46 | _stateLabel.layer.masksToBounds = YES; |
| 56 | _stateLabel.layer.cornerRadius = 2; | 47 | _stateLabel.layer.cornerRadius = 2; |
| 57 | [self addSubview:_stateLabel]; | 48 | [self addSubview:_stateLabel]; |
| 58 | - | ||
| 59 | - _timeLabel = [[UILabel alloc] init]; | ||
| 60 | - _timeLabel.numberOfLines = 1; | ||
| 61 | - _timeLabel.lineBreakMode = NSLineBreakByTruncatingTail; | ||
| 62 | - _timeLabel.textColor = [UIColor lightGrayColor]; | ||
| 63 | - _timeLabel.font = [UIFont systemFontOfSize:12]; | ||
| 64 | - [self addSubview:_timeLabel]; | ||
| 65 | 49 | ||
| 66 | } | 50 | } |
| 67 | return self; | 51 | return self; |
| @@ -69,8 +53,6 @@ | @@ -69,8 +53,6 @@ | ||
| 69 | } | 53 | } |
| 70 | - (void)setModel:(CNLiveModel *)model{ | 54 | - (void)setModel:(CNLiveModel *)model{ |
| 71 | _model = model; | 55 | _model = model; |
| 72 | - _titleLabel.text = @"最新发布会"; | ||
| 73 | - _timeLabel.text = model.liveStartDateTime; | ||
| 74 | [_backgroundImage sd_setImageWithURL:[NSURL URLWithString:model.poster] placeholderImage:[UIImage imageNamed:@"cnlive_placeholder"]]; | 56 | [_backgroundImage sd_setImageWithURL:[NSURL URLWithString:model.poster] placeholderImage:[UIImage imageNamed:@"cnlive_placeholder"]]; |
| 75 | switch ([model.status intValue]) { | 57 | switch ([model.status intValue]) { |
| 76 | case 0: { | 58 | case 0: { |
| @@ -152,29 +134,18 @@ | @@ -152,29 +134,18 @@ | ||
| 152 | 134 | ||
| 153 | }]; | 135 | }]; |
| 154 | 136 | ||
| 155 | - [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 156 | - make.left.equalTo(self->_backgroundImage.mas_left).with.offset(10); | ||
| 157 | - make.top.equalTo(self->_backgroundImage.mas_top).with.offset(10); | ||
| 158 | - make.height.offset(18); | ||
| 159 | - | ||
| 160 | - }]; | ||
| 161 | - | ||
| 162 | [_stateLabel mas_makeConstraints:^(MASConstraintMaker *make) { | 137 | [_stateLabel mas_makeConstraints:^(MASConstraintMaker *make) { |
| 163 | - make.left.equalTo(self->_titleLabel.mas_right).with.offset(5); | ||
| 164 | - make.top.equalTo(self->_backgroundImage.mas_top).with.offset(10); | ||
| 165 | - make.height.offset(18); | ||
| 166 | - | ||
| 167 | - }]; | ||
| 168 | - | ||
| 169 | - [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 170 | - make.right.equalTo(self->_backgroundImage.mas_right).with.offset(-10); | 138 | + make.left.equalTo(self->_backgroundImage.mas_left).with.offset(10); |
| 171 | make.top.equalTo(self->_backgroundImage.mas_top).with.offset(10); | 139 | make.top.equalTo(self->_backgroundImage.mas_top).with.offset(10); |
| 172 | make.height.offset(18); | 140 | make.height.offset(18); |
| 173 | 141 | ||
| 174 | }]; | 142 | }]; |
| 143 | + | ||
| 175 | } | 144 | } |
| 176 | - (void)playImageClicked:(UIButton *)btn{ | 145 | - (void)playImageClicked:(UIButton *)btn{ |
| 177 | self.block?self.block():@""; | 146 | self.block?self.block():@""; |
| 178 | 147 | ||
| 179 | } | 148 | } |
| 149 | + | ||
| 180 | @end | 150 | @end |
| 151 | + |
CNLiveScioLive/Pages/Live/View/CNLiveTableViewCell.m
| @@ -67,6 +67,7 @@ | @@ -67,6 +67,7 @@ | ||
| 67 | _titleLabel.text = model.title; | 67 | _titleLabel.text = model.title; |
| 68 | _timeLabel.text = model.createDate; | 68 | _timeLabel.text = model.createDate; |
| 69 | [_picImage sd_setImageWithURL:[NSURL URLWithString:model.img] placeholderImage:[UIImage imageNamed:@"placeholder"]]; | 69 | [_picImage sd_setImageWithURL:[NSURL URLWithString:model.img] placeholderImage:[UIImage imageNamed:@"placeholder"]]; |
| 70 | + _playImage.hidden = [model.videoFlag isEqualToString:@"0"]; | ||
| 70 | [self layoutSubviews]; | 71 | [self layoutSubviews]; |
| 71 | 72 | ||
| 72 | } | 73 | } |
CNLiveScioLive/Pages/Tools/CNLivePlayer/CNLivePlayerController.h
| @@ -12,8 +12,17 @@ | @@ -12,8 +12,17 @@ | ||
| 12 | #define kZXVideoPlayerOriginalWidth MIN([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) | 12 | #define kZXVideoPlayerOriginalWidth MIN([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) |
| 13 | #define kZXVideoPlayerOriginalHeight (kZXVideoPlayerOriginalWidth * (9.0 / 16.0)) | 13 | #define kZXVideoPlayerOriginalHeight (kZXVideoPlayerOriginalWidth * (9.0 / 16.0)) |
| 14 | 14 | ||
| 15 | +@class CNLivePlayerController; | ||
| 16 | + | ||
| 17 | +@protocol CNLivePlayerControllerDelegate <NSObject> | ||
| 18 | +- (void)shareButtonCNLivePlayerController:(CNLivePlayerController *)view; | ||
| 19 | + | ||
| 20 | +@end | ||
| 21 | + | ||
| 15 | @interface CNLivePlayerController : CNLiveMoviePlayerController | 22 | @interface CNLivePlayerController : CNLiveMoviePlayerController |
| 16 | 23 | ||
| 24 | +@property (nonatomic, weak) id<CNLivePlayerControllerDelegate> delegate; | ||
| 25 | + | ||
| 17 | @property (nonatomic, assign) CGRect frame; | 26 | @property (nonatomic, assign) CGRect frame; |
| 18 | /// video model | 27 | /// video model |
| 19 | @property (nonatomic, strong, readwrite) ZXVideo *video; | 28 | @property (nonatomic, strong, readwrite) ZXVideo *video; |
CNLiveScioLive/Pages/Tools/CNLivePlayer/CNLivePlayerController.m
No preview for this file type
CNLiveScioLive/Pages/Tools/ZXVideoPlayer/Classes/ZXVideoPlayerControlView.h
| @@ -57,6 +57,8 @@ | @@ -57,6 +57,8 @@ | ||
| 57 | @property (nonatomic, strong, readwrite) UILabel *titleLabel; | 57 | @property (nonatomic, strong, readwrite) UILabel *titleLabel; |
| 58 | /// 直播状态 | 58 | /// 直播状态 |
| 59 | @property (nonatomic, assign) int liveStatus; | 59 | @property (nonatomic, assign) int liveStatus; |
| 60 | +///分享 | ||
| 61 | +@property (nonatomic, strong, readwrite) UIButton *shareButton; | ||
| 60 | 62 | ||
| 61 | - (void)animateHide; | 63 | - (void)animateHide; |
| 62 | - (void)animateShow; | 64 | - (void)animateShow; |
CNLiveScioLive/Pages/Tools/ZXVideoPlayer/Classes/ZXVideoPlayerControlView.m
| @@ -74,6 +74,9 @@ static const CGFloat kVideoControlBarAutoFadeOutTimeInterval = 5.0; | @@ -74,6 +74,9 @@ static const CGFloat kVideoControlBarAutoFadeOutTimeInterval = 5.0; | ||
| 74 | // 标题 | 74 | // 标题 |
| 75 | [self.topBar addSubview:self.titleLabel]; | 75 | [self.topBar addSubview:self.titleLabel]; |
| 76 | 76 | ||
| 77 | + // 标题 | ||
| 78 | + [self.topBar addSubview:self.shareButton]; | ||
| 79 | + | ||
| 77 | UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onTap:)]; | 80 | UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onTap:)]; |
| 78 | [self addGestureRecognizer:tapGesture]; | 81 | [self addGestureRecognizer:tapGesture]; |
| 79 | 82 | ||
| @@ -387,6 +390,16 @@ static const CGFloat kVideoControlBarAutoFadeOutTimeInterval = 5.0; | @@ -387,6 +390,16 @@ static const CGFloat kVideoControlBarAutoFadeOutTimeInterval = 5.0; | ||
| 387 | return _retryButton; | 390 | return _retryButton; |
| 388 | } | 391 | } |
| 389 | 392 | ||
| 393 | +- (UIButton *)shareButton { | ||
| 394 | + if (!_shareButton) { | ||
| 395 | + _shareButton = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 396 | + [_shareButton setFrame:CGRectMake(MainScreenWidth-40, 20, 30, 30)]; | ||
| 397 | + [_shareButton setImage:[UIImage imageNamed:@"cnlive_live_share"] forState:UIControlStateNormal]; | ||
| 398 | + | ||
| 399 | + } | ||
| 400 | + return _shareButton; | ||
| 401 | +} | ||
| 402 | + | ||
| 390 | #pragma mark - setter | 403 | #pragma mark - setter |
| 391 | - (void)setLiveStatus:(int)liveStatus { | 404 | - (void)setLiveStatus:(int)liveStatus { |
| 392 | _liveStatus = liveStatus; | 405 | _liveStatus = liveStatus; |
CNLiveScioLive/Pages/Tools/ZXVideoPlayer/Classes/ZXVideoPlayerController.h
| @@ -13,6 +13,7 @@ | @@ -13,6 +13,7 @@ | ||
| 13 | #define kZXVideoPlayerOriginalWidth MIN([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) | 13 | #define kZXVideoPlayerOriginalWidth MIN([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) |
| 14 | #define kZXVideoPlayerOriginalHeight (kZXVideoPlayerOriginalWidth * (9.0 / 16.0)) | 14 | #define kZXVideoPlayerOriginalHeight (kZXVideoPlayerOriginalWidth * (9.0 / 16.0)) |
| 15 | 15 | ||
| 16 | + | ||
| 16 | @interface ZXVideoPlayerController : MPMoviePlayerController | 17 | @interface ZXVideoPlayerController : MPMoviePlayerController |
| 17 | 18 | ||
| 18 | @property (nonatomic, assign) CGRect frame; | 19 | @property (nonatomic, assign) CGRect frame; |
CNLiveScioLive/Pages/Tools/ZXVideoPlayer/Classes/ZXVideoPlayerController.m
No preview for this file type