Commit a07077e0240f144990ec4227178d461d3839c26d

Authored by 王军波
1 parent 546f1a6e

结束界面

LiveVideoCloud/LiveVideoCloud.xcodeproj/project.pbxproj
... ... @@ -193,6 +193,7 @@
193 193 D2B2ED7B1E88F90C00F7538A /* CNLiveChatManager.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B21E88F8E600B7C517 /* CNLiveChatManager.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
194 194 D2B2ED7C1E88F90F00F7538A /* CNLiveMsgTools.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B31E88F8E600B7C517 /* CNLiveMsgTools.framework */; };
195 195 D2B2ED7D1E88F90F00F7538A /* CNLiveMsgTools.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D2D236B31E88F8E600B7C517 /* CNLiveMsgTools.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
  196 + D2B2ED801E88FC5200F7538A /* LVCUGCLiveEndView.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B2ED7F1E88FC5200F7538A /* LVCUGCLiveEndView.m */; };
196 197 D2B7B2511E8247D400ED084E /* ChatBarrageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B7B2501E8247D400ED084E /* ChatBarrageManager.m */; };
197 198 D2B7B2541E824B2D00ED084E /* ChatBarrageView.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B7B2531E824B2D00ED084E /* ChatBarrageView.m */; };
198 199 D2B7B2571E8261EF00ED084E /* ChatBarrOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B7B2561E8261EF00ED084E /* ChatBarrOperation.m */; };
... ... @@ -611,6 +612,8 @@
611 612 D29D88471E88C53300543A03 /* LVCUGCLivePrepareView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCUGCLivePrepareView.m; sourceTree = "<group>"; };
612 613 D2A803061E80BD6F009D6F1C /* TopToolView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopToolView.h; sourceTree = "<group>"; };
613 614 D2A803071E80BD6F009D6F1C /* TopToolView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopToolView.m; sourceTree = "<group>"; };
  615 + D2B2ED7E1E88FC5200F7538A /* LVCUGCLiveEndView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCUGCLiveEndView.h; sourceTree = "<group>"; };
  616 + D2B2ED7F1E88FC5200F7538A /* LVCUGCLiveEndView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCUGCLiveEndView.m; sourceTree = "<group>"; };
614 617 D2B7B24F1E8247D400ED084E /* ChatBarrageManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChatBarrageManager.h; sourceTree = "<group>"; };
615 618 D2B7B2501E8247D400ED084E /* ChatBarrageManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChatBarrageManager.m; sourceTree = "<group>"; };
616 619 D2B7B2521E824B2D00ED084E /* ChatBarrageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChatBarrageView.h; sourceTree = "<group>"; };
... ... @@ -1517,6 +1520,8 @@
1517 1520 D25BF8791E7B8A82007FB138 /* SliderView.m */,
1518 1521 D29D88461E88C53300543A03 /* LVCUGCLivePrepareView.h */,
1519 1522 D29D88471E88C53300543A03 /* LVCUGCLivePrepareView.m */,
  1523 + D2B2ED7E1E88FC5200F7538A /* LVCUGCLiveEndView.h */,
  1524 + D2B2ED7F1E88FC5200F7538A /* LVCUGCLiveEndView.m */,
1520 1525 );
1521 1526 path = View;
1522 1527 sourceTree = "<group>";
... ... @@ -1924,6 +1929,7 @@
1924 1929 D2029C9A1E6EADE10027CD92 /* MJProperty.m in Sources */,
1925 1930 D2029CB91E6EADE10027CD92 /* SDWebImageCompat.m in Sources */,
1926 1931 D2029CB61E6EADE10027CD92 /* MKAnnotationView+WebCache.m in Sources */,
  1932 + D2B2ED801E88FC5200F7538A /* LVCUGCLiveEndView.m in Sources */,
1927 1933 810B64FE1E779B1F00133E15 /* MASCompositeConstraint.m in Sources */,
1928 1934 D2029C981E6EADE10027CD92 /* MJExtensionConst.m in Sources */,
1929 1935 D2575C671E76A25400E3A8FC /* LVCInteractionController.m in Sources */,
... ... @@ -1943,7 +1949,6 @@
1943 1949 D2029D041E6EAE2E0027CD92 /* UILabel+ContentSize.m in Sources */,
1944 1950 D25530031E79115100DF38A5 /* AnimQueueManager.m in Sources */,
1945 1951 D2029C871E6EADE10027CD92 /* AFHTTPSessionManager.m in Sources */,
1946   - D236968D1E7FC7C200E4BF71 /* CNBarrageManager.m in Sources */,
1947 1952 81A482F81E88AFA20097A80A /* LVCFirstHeaderReusableView.m in Sources */,
1948 1953 D2029B861E6EAAA50027CD92 /* main.m in Sources */,
1949 1954 D2029C8C1E6EADE10027CD92 /* AFURLSessionManager.m in Sources */,
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/LiveSections/Controller/LVCLiveViewController.m
... ... @@ -11,11 +11,15 @@
11 11 #import <CNLivePlayerSDK/CNLiveWebcastManager.h>
12 12 #import "FilterFunctionView.h"
13 13 #import "LVCUGCLivePrepareView.h"
  14 +#import "LVCUGCLiveEndView.h"
14 15  
15 16 #define KAppId @"60_irn9edco29"
16 17 #define KAppKey @"69fe70bda67e059286ad509d9f5377f815955645b52f94"
17 18  
18   -@interface LVCLiveViewController ()<UIGestureRecognizerDelegate>
  19 +@interface LVCLiveViewController ()<UIGestureRecognizerDelegate> {
  20 +
  21 + BOOL _isStreaming;
  22 +}
19 23  
20 24 @property (nonatomic, strong) LVCUGCLivePrepareView *prepareView;
21 25  
... ... @@ -33,6 +37,8 @@
33 37  
34 38 @property (nonatomic, strong) UIButton *openFlashButton;
35 39  
  40 +@property (nonatomic, strong) LVCUGCLiveEndView *endView;
  41 +
36 42 @end
37 43  
38 44 @implementation LVCLiveViewController
... ... @@ -104,6 +110,7 @@
104 110 #pragma mark - UIButton Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
105 111 - (void)startCapture:(UIButton *)button { // 开始推流
106 112  
  113 + _isStreaming = YES;
107 114 [_prepareView removeFromSuperview];
108 115  
109 116 [_kitCN startStream:^{
... ... @@ -172,19 +179,31 @@
172 179  
173 180 - (void)quitBtnClick { // 退出
174 181  
  182 + if (_isStreaming) {
  183 + [self.view addSubview:self.endView];
  184 + } else {
  185 + if (_kitCN.captureState == CNLiveCaptureStateCapturing) {
  186 + [_kitCN stopPreview];
  187 + }
  188 + [self dismissViewControllerAnimated:YES completion:nil];
  189 + }
  190 +}
  191 +
  192 +- (void)continueButtonClick {
  193 +
  194 + [_endView removeFromSuperview];
  195 +}
  196 +
  197 +- (void)endButtonClick {
  198 +
175 199 if (_kitCN.streamState == CNLiveStreamStateConnected) {
176 200 [_kitCN stopStream];
177 201 }
178   - if (_kitCN.captureState == CNLiveCaptureStateCapturing) {
179   - [_kitCN stopPreview];
180   - }
181   -
182 202 [self dismissViewControllerAnimated:YES completion:nil];
183 203 }
184 204  
185 205  
186   -#pragma mark - UIGestureRecognizer Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
187   -
  206 +#pragma mark - UIGestureRecognizer Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
188 207 - (void)onTap:(UIGestureRecognizer *)sender { //对焦与曝光
189 208  
190 209 CGPoint current = [sender locationInView:self.view];
... ... @@ -197,8 +216,7 @@
197 216 }
198 217 }
199 218  
200   -#pragma mark - notification !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
201   -
  219 +#pragma mark - notification !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
202 220 - (void)enterBg { // 进入后台
203 221  
204 222 [_kitCN appEnterBackground];
... ... @@ -461,6 +479,18 @@
461 479 return _openFilterButton;
462 480 }
463 481  
  482 +- (LVCUGCLiveEndView *)endView {
  483 +
  484 + if (!_endView) {
  485 + _endView = [[LVCUGCLiveEndView alloc] initWithFrame:CGRectMake(20, SCREEN_HEIGHT * 0.3, SCREEN_WIDTH - 40, SCREEN_WIDTH - 40)];
  486 + _endView.layer.cornerRadius = 20;
  487 + _endView.layer.masksToBounds = YES;
  488 + [_endView.continueButton addTarget:self action:@selector(continueButtonClick) forControlEvents:UIControlEventTouchUpInside];
  489 + [_endView.endButton addTarget:self action:@selector(endButtonClick) forControlEvents:UIControlEventTouchUpInside];
  490 + }
  491 + return _endView;
  492 +}
  493 +
464 494 #pragma mark - Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
465 495 - (void)addObservers {
466 496  
... ... @@ -482,25 +512,6 @@
482 512 object:nil];
483 513 }
484 514  
485   -- (UIButton *)addButton:(NSString*)title
486   - frame:(CGRect)frame
487   - action:(SEL)action {
488   - UIButton * button;
489   - button = [UIButton buttonWithType:UIButtonTypeCustom];
490   - button.frame = frame;
491   - [button setTitle: title forState: UIControlStateNormal];
492   - [button addTarget:self action:action forControlEvents:UIControlEventTouchUpInside];
493   - button.titleLabel.font = [UIFont systemFontOfSize:15];
494   - [button setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal];
495   - button.layer.cornerRadius = 10;
496   - button.layer.masksToBounds = YES;
497   - button.layer.borderColor = [UIColor blackColor].CGColor;
498   - button.layer.borderWidth = 1;
499   - [self.captureView addSubview:button];
500   - return button;
501   -
502   -}
503   -
504 515 - (UIButton *)createButtonWithFrame:(CGRect)frame image:(NSString *)image selected:(NSString *)selected {
505 516  
506 517 UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/LiveSections/View/LVCUGCLiveEndView.h 0 → 100644
  1 +//
  2 +// LVCUGCLiveEndView.h
  3 +// LiveVideoCloud
  4 +//
  5 +// Created by cnliveJunBo on 17/3/27.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +@interface LVCUGCLiveEndView : UIView
  12 +
  13 +@property (nonatomic, strong) UIButton *continueButton;
  14 +
  15 +@property (nonatomic, strong) UIButton *endButton;
  16 +
  17 +@end
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/LiveSections/View/LVCUGCLiveEndView.m 0 → 100644
  1 +//
  2 +// LVCUGCLiveEndView.m
  3 +// LiveVideoCloud
  4 +//
  5 +// Created by cnliveJunBo on 17/3/27.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "LVCUGCLiveEndView.h"
  10 +
  11 +#define selfLength self.bounds.size.width
  12 +
  13 +@interface LVCUGCLiveEndView()
  14 +
  15 +@property (nonatomic, strong) UIImageView *iconView;
  16 +
  17 +@property (nonatomic, strong) UILabel *infoLabel;
  18 +@property (nonatomic, strong) UILabel *attentionLabel;
  19 +
  20 +@end
  21 +
  22 +@implementation LVCUGCLiveEndView
  23 +
  24 +- (instancetype)initWithFrame:(CGRect)frame
  25 +{
  26 + self = [super initWithFrame:frame];
  27 + if (self) {
  28 + self.backgroundColor = [UIColor whiteColor];
  29 + [self addSubview:self.iconView];
  30 + [self addSubview:self.infoLabel];
  31 + [self addSubview:self.attentionLabel];
  32 + [self addSubview:self.continueButton];
  33 + [self addSubview:self.endButton];
  34 + }
  35 + return self;
  36 +}
  37 +
  38 +#pragma mark - GetMethod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  39 +- (UIImageView *)iconView {
  40 +
  41 + if (!_iconView) {
  42 + NSString *path = [[NSBundle mainBundle] pathForResource:@"头像" ofType:@"jpg"];
  43 + UIImage *image = [UIImage imageWithContentsOfFile:path];
  44 + _iconView = [[UIImageView alloc] initWithImage:image];
  45 + _iconView.frame = CGRectMake((selfLength - 50) * 0.5, 20, 50, 50);
  46 + _iconView.layer.cornerRadius = 25;
  47 + _iconView.layer.masksToBounds = YES;
  48 + }
  49 + return _iconView;
  50 +}
  51 +
  52 +- (UILabel *)infoLabel {
  53 +
  54 + if (!_infoLabel) {
  55 + _infoLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, selfLength * 0.3, selfLength, 20)];
  56 + _infoLabel.text = @"10000人看过你的直播~";
  57 + _infoLabel.textAlignment = NSTextAlignmentCenter;
  58 + _infoLabel.textColor = [UIColor grayColor];
  59 + }
  60 + return _infoLabel;
  61 +}
  62 +
  63 +- (UILabel *)attentionLabel {
  64 +
  65 + if (!_attentionLabel) {
  66 + _attentionLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, selfLength * 0.5, selfLength, 30)];
  67 + _attentionLabel.text = @"确定要结束直播吗?";
  68 + _attentionLabel.textAlignment = NSTextAlignmentCenter;
  69 + _attentionLabel.textColor = [UIColor orangeColor];
  70 + _attentionLabel.font = [UIFont systemFontOfSize:21];
  71 + }
  72 + return _attentionLabel;
  73 +}
  74 +
  75 +- (UIButton *)continueButton {
  76 +
  77 + if (!_continueButton) {
  78 + _continueButton = [UIButton buttonWithType:UIButtonTypeCustom];
  79 + _continueButton.frame = CGRectMake(15, selfLength * 0.7, selfLength * 0.4, 35);
  80 + [_continueButton setTitle:@"继续" forState:UIControlStateNormal];
  81 + [_continueButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  82 + [_continueButton setTitleColor:[UIColor blackColor] forState:UIControlStateHighlighted];
  83 + _continueButton.backgroundColor = [UIColor redColor];
  84 + _continueButton.layer.cornerRadius = 17.5;
  85 + _continueButton.layer.masksToBounds = YES;
  86 + }
  87 + return _continueButton;
  88 +}
  89 +
  90 +- (UIButton *)endButton {
  91 +
  92 + if (!_endButton) {
  93 + _endButton = [UIButton buttonWithType:UIButtonTypeCustom];
  94 + _endButton.frame = CGRectMake(selfLength * 0.6 - 15, selfLength * 0.7, selfLength * 0.4, 35);
  95 + [_endButton setTitle:@"结束" forState:UIControlStateNormal];
  96 + [_endButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  97 + [_endButton setTitleColor:[UIColor blackColor] forState:UIControlStateHighlighted];
  98 + _endButton.backgroundColor = [UIColor redColor];
  99 + _endButton.layer.cornerRadius = 17.5;
  100 + _endButton.layer.masksToBounds = YES;
  101 + }
  102 + return _endButton;
  103 +}
  104 +
  105 +@end
... ...