Commit 16b03d616a875cee7406f0c87f8a4ea574f32702

Authored by 朱林
2 parents d2f4f768 8598c3ab

Merge branch 'master' of bj.gitlab.cnlive.com:ios-team/LiveVideoCloud

Conflicts:
	LiveVideoCloud.xcodeproj/project.pbxproj
	LiveVideoCloud/PrefixHeader.pch
LiveVideoCloud.xcodeproj/project.pbxproj
@@ -280,6 +280,7 @@ @@ -280,6 +280,7 @@
280 D25BF8A31E80C4FC007FB138 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D25BF8A21E80C4FC007FB138 /* Accelerate.framework */; }; 280 D25BF8A31E80C4FC007FB138 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D25BF8A21E80C4FC007FB138 /* Accelerate.framework */; };
281 D25BF8A51E80EC76007FB138 /* 头像.jpg in Resources */ = {isa = PBXBuildFile; fileRef = D25BF8A41E80EC76007FB138 /* 头像.jpg */; }; 281 D25BF8A51E80EC76007FB138 /* 头像.jpg in Resources */ = {isa = PBXBuildFile; fileRef = D25BF8A41E80EC76007FB138 /* 头像.jpg */; };
282 D260E6101F0CE8690095E49D /* praiseModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D260E60F1F0CE8690095E49D /* praiseModel.m */; }; 282 D260E6101F0CE8690095E49D /* praiseModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D260E60F1F0CE8690095E49D /* praiseModel.m */; };
  283 + D263AFC21F13300600A963A6 /* CNLiveStat.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D263AFC11F13300600A963A6 /* CNLiveStat.framework */; };
283 D2888D941E6EB8B4003A77C8 /* LVCTabBar.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888D931E6EB8B4003A77C8 /* LVCTabBar.m */; }; 284 D2888D941E6EB8B4003A77C8 /* LVCTabBar.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888D931E6EB8B4003A77C8 /* LVCTabBar.m */; };
284 D2888D9E1E6EBF1B003A77C8 /* LVCLiveViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888D9B1E6EBF1B003A77C8 /* LVCLiveViewController.m */; }; 285 D2888D9E1E6EBF1B003A77C8 /* LVCLiveViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888D9B1E6EBF1B003A77C8 /* LVCLiveViewController.m */; };
285 D29D88481E88C53300543A03 /* LVCUGCLivePrepareView.m in Sources */ = {isa = PBXBuildFile; fileRef = D29D88471E88C53300543A03 /* LVCUGCLivePrepareView.m */; }; 286 D29D88481E88C53300543A03 /* LVCUGCLivePrepareView.m in Sources */ = {isa = PBXBuildFile; fileRef = D29D88471E88C53300543A03 /* LVCUGCLivePrepareView.m */; };
@@ -877,6 +878,7 @@ @@ -877,6 +878,7 @@
877 D25BF8A41E80EC76007FB138 /* 头像.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "头像.jpg"; sourceTree = "<group>"; }; 878 D25BF8A41E80EC76007FB138 /* 头像.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "头像.jpg"; sourceTree = "<group>"; };
878 D260E60E1F0CE8690095E49D /* praiseModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = praiseModel.h; sourceTree = "<group>"; }; 879 D260E60E1F0CE8690095E49D /* praiseModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = praiseModel.h; sourceTree = "<group>"; };
879 D260E60F1F0CE8690095E49D /* praiseModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = praiseModel.m; sourceTree = "<group>"; }; 880 D260E60F1F0CE8690095E49D /* praiseModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = praiseModel.m; sourceTree = "<group>"; };
  881 + D263AFC11F13300600A963A6 /* CNLiveStat.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLiveStat.framework; sourceTree = "<group>"; };
880 D2888D921E6EB8B4003A77C8 /* LVCTabBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCTabBar.h; sourceTree = "<group>"; }; 882 D2888D921E6EB8B4003A77C8 /* LVCTabBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCTabBar.h; sourceTree = "<group>"; };
881 D2888D931E6EB8B4003A77C8 /* LVCTabBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCTabBar.m; sourceTree = "<group>"; }; 883 D2888D931E6EB8B4003A77C8 /* LVCTabBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCTabBar.m; sourceTree = "<group>"; };
882 D2888D9A1E6EBF1B003A77C8 /* LVCLiveViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCLiveViewController.h; sourceTree = "<group>"; }; 884 D2888D9A1E6EBF1B003A77C8 /* LVCLiveViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCLiveViewController.h; sourceTree = "<group>"; };
@@ -957,6 +959,7 @@ @@ -957,6 +959,7 @@
957 8181D5441F1366F500959E3D /* GPUImage.framework in Frameworks */, 959 8181D5441F1366F500959E3D /* GPUImage.framework in Frameworks */,
958 8181D5721F13674200959E3D /* CNLivePlayerSDK.framework in Frameworks */, 960 8181D5721F13674200959E3D /* CNLivePlayerSDK.framework in Frameworks */,
959 D2575C7D1E76A4F300E3A8FC /* NHGiftAnimtionSDK.a in Frameworks */, 961 D2575C7D1E76A4F300E3A8FC /* NHGiftAnimtionSDK.a in Frameworks */,
  962 + D263AFC21F13300600A963A6 /* CNLiveStat.framework in Frameworks */,
960 D2393D071F02505400D3EE17 /* TencentOpenAPI.framework in Frameworks */, 963 D2393D071F02505400D3EE17 /* TencentOpenAPI.framework in Frameworks */,
961 ); 964 );
962 runOnlyForDeploymentPostprocessing = 0; 965 runOnlyForDeploymentPostprocessing = 0;
@@ -1271,6 +1274,7 @@ @@ -1271,6 +1274,7 @@
1271 8181D5401F1366F500959E3D /* CNLiveShortVideoSDK.framework */, 1274 8181D5401F1366F500959E3D /* CNLiveShortVideoSDK.framework */,
1272 8181D5411F1366F500959E3D /* GPUImage.framework */, 1275 8181D5411F1366F500959E3D /* GPUImage.framework */,
1273 8181D5421F1366F500959E3D /* libksygpulive.framework */, 1276 8181D5421F1366F500959E3D /* libksygpulive.framework */,
  1277 + D263AFC11F13300600A963A6 /* CNLiveStat.framework */,
1274 D2EBC8A51F03926E00F198FB /* CNLiveChatManager.framework */, 1278 D2EBC8A51F03926E00F198FB /* CNLiveChatManager.framework */,
1275 D2EBC88F1F0241AD00F198FB /* CNLiveMsgTools.framework */, 1279 D2EBC88F1F0241AD00F198FB /* CNLiveMsgTools.framework */,
1276 D2393D2B1F02682000D3EE17 /* CNLiveUserSystemSDK.framework */, 1280 D2393D2B1F02682000D3EE17 /* CNLiveUserSystemSDK.framework */,
LiveVideoCloud/AppDelegate/AppDelegate.m
@@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
22 self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 22 self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
23 self.window.rootViewController = [[ZXTabBarController alloc] init]; 23 self.window.rootViewController = [[ZXTabBarController alloc] init];
24 24
25 - //测试环境开关,只在初始化时有效 25 + //测试环境开关,只在初始化时设置有效
26 self.isTestEnvironment = YES; 26 self.isTestEnvironment = YES;
27 27
28 [[CNLiveMediaEditKit manager] initWithAppId:UserAppId appKey:UserAppKey isTestEnvironment:self.isTestEnvironment]; 28 [[CNLiveMediaEditKit manager] initWithAppId:UserAppId appKey:UserAppKey isTestEnvironment:self.isTestEnvironment];
@@ -39,19 +39,11 @@ @@ -39,19 +39,11 @@
39 //初始化聊天SDK并连接服务器 39 //初始化聊天SDK并连接服务器
40 [[CNLiveChatManager sharedCNLiveChatManager] initWithAppKey:UserAppKey appId:UserAppId isTestEnvironment:self.isTestEnvironment]; 40 [[CNLiveChatManager sharedCNLiveChatManager] initWithAppKey:UserAppKey appId:UserAppId isTestEnvironment:self.isTestEnvironment];
41 41
42 - /*  
43 - [[CNLiveChatManager sharedCNLiveChatManager] connectServerSuccess:^{  
44 - NSLog(@"连接服务器-----success");  
45 - } error:^(CNLiveChatConnectErrorCode errors) {  
46 - NSLog(@"连接服务器失败-----%ld", errors);  
47 - }];  
48 - */ 42 + //初始化统计SDK
  43 + [CNLiveStat registerApp:UserAppId appKey:UserAppKey isTestEnvironment:self.isTestEnvironment];
49 44
50 - /*  
51 - CNLiveChatUserInfo *userInfo = [[CNLiveChatUserInfo alloc] initWithUserId:@"20170311" name:@"zzllzzzll" portrait:@"https://y3.cnliveimg.com/mobile/images/mobilehead/2017/03/30/1490844962259_small.jpg"];  
52 - */  
53 -  
54 - // 20170327 20170328 45 + //启动事件数量统计
  46 + [CNLiveStat event:@"iOS AppStartTest"];
55 47
56 if ([UserTools isLogin]) { 48 if ([UserTools isLogin]) {
57 49
LiveVideoCloud/Classes/CNLiveSDK/CNLiveStat.framework/CNLiveStat 0 → 100644
No preview for this file type
LiveVideoCloud/Classes/CNLiveSDK/CNLiveStat.framework/Headers/CNLiveStat.h 0 → 100644
  1 +//
  2 +// CNLiveStat.h
  3 +// CNLiveStat
  4 +//
  5 +// Created by 雷浩杰 on 2016/11/10.
  6 +// Copyright © 2016年 雷浩杰. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +@interface CNLiveStat : NSObject
  12 +
  13 +/*
  14 + * 获取SDK版本号
  15 + */
  16 ++ (NSString *)getVersion;
  17 +
  18 +/*
  19 + * 注册APP 注册成功或失败信息以log形式输出(CNLiveStatManager registerApp Success 或者 CNLiveStatManager registerApp Error :)
  20 +
  21 + @param appId AppId
  22 + @param appKey AppKey
  23 +
  24 + 此方法默认将统计数据上传到正式环境,如果需要测试SDK,强烈建议用
  25 + + (void)registerApp:(NSString *)appId appKey:(NSString *)appKey isTestEnvironment:(BOOL)isTestEnvironment 方法初始化SDK
  26 + */
  27 ++ (void)registerApp:(NSString *)appId appKey:(NSString *)appKey;
  28 +
  29 +/**
  30 + 注册APP 注册成功或失败信息以log形式输出(CNLiveStatManager registerApp Success 或者 CNLiveStatManager registerApp Error :)
  31 +
  32 + @param appId AppId
  33 + @param appKey AppKey
  34 + @param isTestEnvironment 测试环境开关,YES为测试环境,NO为正式环境
  35 +
  36 + */
  37 ++ (void)registerApp:(NSString *)appId appKey:(NSString *)appKey isTestEnvironment:(BOOL)isTestEnvironment;
  38 +
  39 +/* 数量统计
  40 + *
  41 + * eventID 事件ID
  42 + *
  43 + */
  44 ++ (void)event:(NSString *)eventID;
  45 +
  46 +/* 时长统计 在调用endEvent:方法前,多次使用同一个eventID调用此方法,只会将第一次视为有效调用
  47 + *
  48 + * eventID 事件ID
  49 + *
  50 + */
  51 ++ (void)beginEvent:(NSString *)eventID;
  52 +
  53 +/* 时长统计 多次使用同一个eventID调用此方法,只会将第一次视为有效调用
  54 + *
  55 + * eventID 事件ID
  56 + *
  57 + */
  58 ++ (void)endEvent:(NSString *)eventID;
  59 +
  60 +/* 直播播放统计
  61 + *
  62 + * channelId 直播channelId
  63 + *
  64 + */
  65 ++ (void)statLivePlayerWithChannelId:(NSString *)channelId;
  66 +
  67 +/* 点播播放统计
  68 + *
  69 + * vId 点播vId
  70 + *
  71 + */
  72 ++ (void)statVodPlayerWithVId:(NSString *)vId;
  73 +
  74 +@end
LiveVideoCloud/Classes/CNLiveSDK/CNLiveStat.framework/Info.plist 0 → 100644
No preview for this file type
LiveVideoCloud/Classes/CNLiveSDK/CNLiveStat.framework/Modules/module.modulemap 0 → 100644
  1 +framework module CNLiveStat {
  2 + umbrella header "CNLiveStat.h"
  3 +
  4 + export *
  5 + module * { export * }
  6 +}
LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftViews/GiftListView.m
@@ -154,6 +154,15 @@ @@ -154,6 +154,15 @@
154 return giftView; 154 return giftView;
155 } 155 }
156 156
  157 +- (void)giftViewAddBgView:(UIView *)giftView
  158 +{
  159 + UIImageView *bgView = [[UIImageView alloc] initWithFrame:giftView.bounds];
  160 + bgView.backgroundColor = [UIColor blackColor];
  161 + bgView.tag = giftView.tag + 100;
  162 + bgView.alpha = 0.2;
  163 + [giftView addSubview:bgView];
  164 +}
  165 +
157 #pragma mark - 选择礼物点击 166 #pragma mark - 选择礼物点击
158 - (void)gestureClick:(UITapGestureRecognizer *)gesture 167 - (void)gestureClick:(UITapGestureRecognizer *)gesture
159 { 168 {
@@ -161,35 +170,45 @@ @@ -161,35 +170,45 @@
161 NSLog(@"%zd",tag); 170 NSLog(@"%zd",tag);
162 171
163 if (_curruntSelectIdx == 0 && _isSelectedGift == NO) {//没选过 172 if (_curruntSelectIdx == 0 && _isSelectedGift == NO) {//没选过
164 - UIView *giftView = gesture.view;  
165 -  
166 - UIImageView *bgView = [[UIImageView alloc] initWithFrame:giftView.bounds];  
167 - bgView.backgroundColor = [UIColor blackColor];  
168 - bgView.tag = giftView.tag + 100;  
169 - bgView.alpha = 0.2;  
170 - [giftView addSubview:bgView]; 173 + [self giftViewAddBgView:gesture.view];
  174 + _isSelectedGift = YES;
171 } 175 }
172 176
173 if (_curruntSelectIdx != 0 && _isSelectedGift == YES) {//选过 177 if (_curruntSelectIdx != 0 && _isSelectedGift == YES) {//选过
174 - UIView *gView = gesture.view;  
175 - for (UIView *view in self.scrollView.subviews) {//移除上一个bgView  
176 - if (view.tag == _curruntSelectIdx) {  
177 - for (UIView *bg in view.subviews) {  
178 - if (bg.tag == view.tag + 100) {  
179 - [bg removeFromSuperview];  
180 - break; 178 +
  179 + if (gesture.view.tag != _curruntSelectIdx) {//选的其他礼物
  180 + //增加当前bgView
  181 + [self giftViewAddBgView:gesture.view];
  182 + for (UIView *view in self.scrollView.subviews) {//移除上一个bgView
  183 + if (view.tag == _curruntSelectIdx) {
  184 + for (UIView *bg in view.subviews) {
  185 + if (bg.tag == view.tag + 100) {
  186 + [bg removeFromSuperview];
  187 + break;
  188 + }
  189 + }
  190 + }
  191 + }
  192 + _isSelectedGift = YES;
  193 + }else{//选的当前礼物 ,根据是否选中做变化
  194 + if (_isSelectedGift == YES) {
  195 + _isSelectedGift = NO;
  196 + for (UIView *view in self.scrollView.subviews) {//移除上一个bgView
  197 + if (view.tag == _curruntSelectIdx) {
  198 + for (UIView *bg in view.subviews) {
  199 + if (bg.tag == view.tag + 100) {
  200 + [bg removeFromSuperview];
  201 + break;
  202 + }
  203 + }
181 } 204 }
182 } 205 }
  206 + }else{
  207 + _isSelectedGift = YES;
  208 + [self giftViewAddBgView:gesture.view];
183 } 209 }
184 } 210 }
185 - //增加当前bgView  
186 - UIImageView *bgView = [[UIImageView alloc] initWithFrame:gView.bounds];  
187 - bgView.backgroundColor = [UIColor blackColor];  
188 - bgView.tag = gView.tag + 100;  
189 - bgView.alpha = 0.2;  
190 - [gView addSubview:bgView];  
191 } 211 }
192 - _isSelectedGift = YES;  
193 _curruntSelectIdx = gesture.view.tag; 212 _curruntSelectIdx = gesture.view.tag;
194 213
195 GiftModel *model = self.giftArray[tag]; 214 GiftModel *model = self.giftArray[tag];
LiveVideoCloud/Classes/Sections/Mine/Controllers/MinePersonalDataController.m
@@ -28,45 +28,38 @@ @@ -28,45 +28,38 @@
28 [super viewDidLoad]; 28 [super viewDidLoad];
29 29
30 self.title = @"个人资料"; 30 self.title = @"个人资料";
31 - // self.view.backgroundColor = CommonBgColor;  
32 } 31 }
33 32
34 33
35 - (void)viewWillAppear:(BOOL)animated 34 - (void)viewWillAppear:(BOOL)animated
36 { 35 {
37 [super viewWillAppear:animated]; 36 [super viewWillAppear:animated];
38 - [_tbv reloadData]; 37 + [self updateUserData];
39 } 38 }
40 39
  40 +- (void)updateUserData
  41 +{
  42 + [CNLiveUserSystemCenter queryUserInfoWithUid:[UserInformationModel manager].uid srcUid:[UserInformationModel manager].uid success:^(id result) {
  43 + NSLog(@"query result = %@",result);
  44 + [UserTools clearLocalUserInfo];
  45 + [UserTools saveUserinfoDic:result[@"data"]];
  46 + [_tbv reloadData];
  47 +
  48 + } failure:^(NSDictionary *errorDic) {
  49 + NSLog(@"query errorDic = %@",errorDic);
  50 + }];
  51 +}
41 52
42 - (void)bindView 53 - (void)bindView
43 { 54 {
44 self.tbv.frame = CGRectMake(0, 0, SCREEN_W, SCREEN_H -64 ); 55 self.tbv.frame = CGRectMake(0, 0, SCREEN_W, SCREEN_H -64 );
45 [self.view addSubview:self.tbv]; 56 [self.view addSubview:self.tbv];
46 } 57 }
47 --(void)bindModel 58 +- (void)bindModel
48 { 59 {
49 [self.dataarray removeAllObjects]; 60 [self.dataarray removeAllObjects];
50 - // isLogin = NO;  
51 - //  
52 - // if ([UserTools isLogin])  
53 - // {  
54 - // isLogin = YES;  
55 - // }else  
56 - // {  
57 - // isLogin = NO;  
58 - // }  
59 } 61 }
60 62
61 -//- (UIButton *)quitBtn  
62 -//{  
63 -// if (!_quitBtn) {  
64 -// _quitBtn = [UIButton buttonWithType:UIButtonTypeCustom];  
65 -// [_quitBtn setImage:[UIImage imageNamed:@" edit"] forState:UIControlStateNormal];  
66 -// [_quitBtn addTarget:self action:@selector(quitBtnClick) forControlEvents:UIControlEventTouchUpInside];  
67 -// }  
68 -// return _quitBtn;  
69 -//}  
70 - (NSMutableArray *)dataarray 63 - (NSMutableArray *)dataarray
71 { 64 {
72 if (!_dataarray) { 65 if (!_dataarray) {
LiveVideoCloud/Classes/Sections/PGCSections/Controller/LVCLivePlayerController.m
@@ -44,13 +44,18 @@ @@ -44,13 +44,18 @@
44 self.navigationController.navigationBar.hidden = YES; 44 self.navigationController.navigationBar.hidden = YES;
45 [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; 45 [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
46 [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade]; 46 [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];
47 - 47 +
  48 + //直播时长统计开始
  49 + [CNLiveStat beginEvent:@"PGCLiveEvent"];
48 } 50 }
49 51
50 - (void)viewDidDisappear:(BOOL)animated 52 - (void)viewDidDisappear:(BOOL)animated
51 { 53 {
52 [super viewDidDisappear:animated]; 54 [super viewDidDisappear:animated];
53 self.navigationController.navigationBar.hidden = NO; 55 self.navigationController.navigationBar.hidden = NO;
  56 +
  57 + //直播时长统计结束
  58 + [CNLiveStat endEvent:@"PGCLiveEvent"];
54 } 59 }
55 60
56 - (void)viewWillDisappear:(BOOL)animated 61 - (void)viewWillDisappear:(BOOL)animated
@@ -64,6 +69,9 @@ @@ -64,6 +69,9 @@
64 [super viewDidLoad]; 69 [super viewDidLoad];
65 self.view.backgroundColor = [UIColor blackColor]; 70 self.view.backgroundColor = [UIColor blackColor];
66 71
  72 + //直播播放数量统计
  73 + [CNLiveStat statLivePlayerWithChannelId:@"iosLivePlayStatTest"];
  74 +
67 _roomId = [NSString stringWithFormat:@"syn%@",self.model.mediaId]; 75 _roomId = [NSString stringWithFormat:@"syn%@",self.model.mediaId];
68 playerFrame = CGRectMake(0, 20, SCREEN_WIDTH, SCREEN_WIDTH*9/16); 76 playerFrame = CGRectMake(0, 20, SCREEN_WIDTH, SCREEN_WIDTH*9/16);
69 _originalDirection = 0; 77 _originalDirection = 0;
LiveVideoCloud/Classes/Sections/PGCSections/Controller/LVCTelevisioController.m
@@ -37,7 +37,6 @@ @@ -37,7 +37,6 @@
37 37
38 [self.view addSubview:self.tableView]; 38 [self.view addSubview:self.tableView];
39 [self loadData]; 39 [self loadData];
40 -  
41 } 40 }
42 41
43 - (void)loadData { 42 - (void)loadData {
LiveVideoCloud/Classes/Sections/UGCSections/Controller/LVCUGCLivePlayerController.m
@@ -55,14 +55,12 @@ @@ -55,14 +55,12 @@
55 - (void)viewWillAppear:(BOOL)animated { 55 - (void)viewWillAppear:(BOOL)animated {
56 56
57 [super viewWillAppear:animated]; 57 [super viewWillAppear:animated];
58 -  
59 self.navigationController.navigationBar.hidden = YES; 58 self.navigationController.navigationBar.hidden = YES;
60 } 59 }
61 60
62 - (void)viewWillDisappear:(BOOL)animated { 61 - (void)viewWillDisappear:(BOOL)animated {
63 62
64 [super viewWillDisappear:animated]; 63 [super viewWillDisappear:animated];
65 -  
66 self.navigationController.navigationBar.hidden = NO; 64 self.navigationController.navigationBar.hidden = NO;
67 } 65 }
68 66
@@ -79,6 +77,7 @@ @@ -79,6 +77,7 @@
79 [self.view addSubview:self.viewThird]; 77 [self.view addSubview:self.viewThird];
80 78
81 if ([_model.activityStatus isEqualToString:@"1"]) { 79 if ([_model.activityStatus isEqualToString:@"1"]) {
  80 +
82 [self addLiveBaseViewWithChannelId:_model.channelId]; 81 [self addLiveBaseViewWithChannelId:_model.channelId];
83 } 82 }
84 _bgModel = _model; 83 _bgModel = _model;
@@ -117,29 +116,35 @@ @@ -117,29 +116,35 @@
117 NSLog(@"dealloc"); 116 NSLog(@"dealloc");
118 } 117 }
119 118
120 -- (void)quitBtnClick { // 退出 119 +- (void)quitBtnClick:(UIButton *)btn { // 退出
121 120
122 [_player stop]; 121 [_player stop];
123 -// if (self.navigationController.viewControllers.count > 2) {//判断  
124 -// [self.navigationController popViewControllerAnimated:YES];  
125 -// }  
126 -  
127 - [[CNLiveChatManager sharedCNLiveChatManager] quitChatRoom:_liveBaseView.roomId success:^(NSString *targetId) {  
128 - NSLog(@"quit Success");  
129 - } error:^(CNLiveChatErrorCode errors, NSString *targetId) {  
130 - NSLog(@"quit Failure");  
131 - }];  
132 122
133 - [_liveBaseView clearChatAndGiftData];  
134 -  
135 - for (UIViewController *controller in self.navigationController.viewControllers) {  
136 - if ([controller isKindOfClass:[MineLiveController class]]) {  
137 - MineLiveController *revise =(MineLiveController *)controller;  
138 - [self.navigationController popToViewController:revise animated:YES];  
139 - }  
140 - else if ([controller isKindOfClass:[LVCUGCLiveListController class]]) {  
141 - LVCUGCLiveListController *revise =(LVCUGCLiveListController *)controller;  
142 - [self.navigationController popToViewController:revise animated:YES]; 123 + if ((btn.tag == 1002) || (btn.tag == 1003)) {
  124 + [self.navigationController popViewControllerAnimated:YES];
  125 + //UGC回放时长统计结束
  126 + [CNLiveStat endEvent:@"UGCPlayback"];
  127 + } else if (btn.tag == 1001) {
  128 + //UGC直播时长统计结束
  129 + [CNLiveStat endEvent:@"UGCLive"];
  130 +
  131 + [[CNLiveChatManager sharedCNLiveChatManager] quitChatRoom:_liveBaseView.roomId success:^(NSString *targetId) {
  132 + NSLog(@"quit Success");
  133 + } error:^(CNLiveChatErrorCode errors, NSString *targetId) {
  134 + NSLog(@"quit Failure");
  135 + }];
  136 +
  137 + [_liveBaseView clearChatAndGiftData];
  138 +
  139 + for (UIViewController *controller in self.navigationController.viewControllers) {
  140 + if ([controller isKindOfClass:[MineLiveController class]]) {
  141 + MineLiveController *revise =(MineLiveController *)controller;
  142 + [self.navigationController popToViewController:revise animated:YES];
  143 + }
  144 + else if ([controller isKindOfClass:[LVCUGCLiveListController class]]) {
  145 + LVCUGCLiveListController *revise =(LVCUGCLiveListController *)controller;
  146 + [self.navigationController popToViewController:revise animated:YES];
  147 + }
143 } 148 }
144 } 149 }
145 } 150 }
@@ -156,6 +161,7 @@ @@ -156,6 +161,7 @@
156 if ([model.activityStatus isEqualToString:@"1"]) { 161 if ([model.activityStatus isEqualToString:@"1"]) {
157 162
158 _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:model.channelId anchorStatus:YES authSuccess:^{ 163 _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:model.channelId anchorStatus:YES authSuccess:^{
  164 +
159 165
160 _player.videoDecoderMode = CNLiveMovieVideoDecoderMode_AUTO; 166 _player.videoDecoderMode = CNLiveMovieVideoDecoderMode_AUTO;
161 _player.view.frame = self.view.bounds; 167 _player.view.frame = self.view.bounds;
@@ -163,7 +169,9 @@ @@ -163,7 +169,9 @@
163 [_player prepareToPlay]; 169 [_player prepareToPlay];
164 [self.viewSecond addSubview:_player.view]; 170 [self.viewSecond addSubview:_player.view];
165 [self.viewSecond sendSubviewToBack:_player.view]; 171 [self.viewSecond sendSubviewToBack:_player.view];
166 - 172 +
  173 + //UGC直播时长统计开始
  174 + [CNLiveStat beginEvent:@"UGCLive"];
167 } authFailed:^(NSDictionary *errorInfo) { 175 } authFailed:^(NSDictionary *errorInfo) {
168 NSLog(@"初始化直播播放器失败:%@", errorInfo); 176 NSLog(@"初始化直播播放器失败:%@", errorInfo);
169 177
@@ -193,7 +201,9 @@ @@ -193,7 +201,9 @@
193 [self.viewSecond sendSubviewToBack:_player.view]; 201 [self.viewSecond sendSubviewToBack:_player.view];
194 [_player.view addGestureRecognizer:_pan]; 202 [_player.view addGestureRecognizer:_pan];
195 [_player.view addSubview:self.bottomView]; 203 [_player.view addSubview:self.bottomView];
196 - 204 +
  205 + //UGC回放时长统计开始
  206 + [CNLiveStat beginEvent:@"UGCPlayback"];
197 } authFailed:^(NSDictionary *errorInfo) { 207 } authFailed:^(NSDictionary *errorInfo) {
198 NSLog(@"初始化点播播放器失败%@", errorInfo); 208 NSLog(@"初始化点播播放器失败%@", errorInfo);
199 }]; 209 }];
@@ -669,13 +679,6 @@ @@ -669,13 +679,6 @@
669 }]; 679 }];
670 } 680 }
671 681
672 -#pragma mark - Button Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
673 -- (void)backToList {  
674 -  
675 - [_player stop];  
676 - [self.navigationController popViewControllerAnimated:YES];  
677 -}  
678 -  
679 #pragma mark - GetMethod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 682 #pragma mark - GetMethod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
680 - (LiveBaseView *)liveBaseView 683 - (LiveBaseView *)liveBaseView
681 { 684 {
@@ -685,7 +688,8 @@ @@ -685,7 +688,8 @@
685 _liveBaseView.jumpType = JumpControllerTypePush; 688 _liveBaseView.jumpType = JumpControllerTypePush;
686 _liveBaseView.viewController = self; 689 _liveBaseView.viewController = self;
687 _liveBaseView.backgroundColor = [UIColor clearColor]; 690 _liveBaseView.backgroundColor = [UIColor clearColor];
688 - [_liveBaseView.closeBtn addTarget:self action:@selector(quitBtnClick) forControlEvents:UIControlEventTouchUpInside]; 691 + _liveBaseView.closeBtn.tag = 1001;
  692 + [_liveBaseView.closeBtn addTarget:self action:@selector(quitBtnClick:) forControlEvents:UIControlEventTouchUpInside];
689 } 693 }
690 return _liveBaseView; 694 return _liveBaseView;
691 } 695 }
@@ -695,7 +699,8 @@ @@ -695,7 +699,8 @@
695 if (!_bgView) { 699 if (!_bgView) {
696 _bgView = [[LVCUGCBackgroundView alloc] initWithFrame:self.view.bounds]; 700 _bgView = [[LVCUGCBackgroundView alloc] initWithFrame:self.view.bounds];
697 _bgView.hidden = YES; 701 _bgView.hidden = YES;
698 - [_bgView.backButton addTarget:self action:@selector(backToList) forControlEvents:UIControlEventTouchUpInside]; 702 + _bgView.backButton.tag = 1002;
  703 + [_bgView.backButton addTarget:self action:@selector(quitBtnClick:) forControlEvents:UIControlEventTouchUpInside];
699 } 704 }
700 return _bgView; 705 return _bgView;
701 } 706 }
@@ -749,7 +754,8 @@ @@ -749,7 +754,8 @@
749 _vodPlayerQuitBtn.frame = CGRectMake(SCREEN_WIDTH - 50, 50, 40, 40); 754 _vodPlayerQuitBtn.frame = CGRectMake(SCREEN_WIDTH - 50, 50, 40, 40);
750 [_vodPlayerQuitBtn setImage:[UIImage imageNamed:@"LiveCloseNormal"] forState:UIControlStateNormal]; 755 [_vodPlayerQuitBtn setImage:[UIImage imageNamed:@"LiveCloseNormal"] forState:UIControlStateNormal];
751 [_vodPlayerQuitBtn setImage:[UIImage imageNamed:@"LiveCloseTouch"] forState:UIControlStateHighlighted]; 756 [_vodPlayerQuitBtn setImage:[UIImage imageNamed:@"LiveCloseTouch"] forState:UIControlStateHighlighted];
752 - [_vodPlayerQuitBtn addTarget:self action:@selector(backToList) forControlEvents:UIControlEventTouchUpInside]; 757 + _vodPlayerQuitBtn.tag = 1003;
  758 + [_vodPlayerQuitBtn addTarget:self action:@selector(quitBtnClick:) forControlEvents:UIControlEventTouchUpInside];
753 } 759 }
754 return _vodPlayerQuitBtn; 760 return _vodPlayerQuitBtn;
755 } 761 }
LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCVodPlayerController.m
@@ -88,6 +88,9 @@ typedef enum { @@ -88,6 +88,9 @@ typedef enum {
88 self.view.backgroundColor = [UIColor whiteColor]; 88 self.view.backgroundColor = [UIColor whiteColor];
89 [self.view addSubview:self.playerSuperView]; 89 [self.view addSubview:self.playerSuperView];
90 [self.view addSubview:self.commentView]; 90 [self.view addSubview:self.commentView];
  91 +
  92 + //点播播放数量统计
  93 + [CNLiveStat statVodPlayerWithVId:@"iosVodPlayStatTest"];
91 } 94 }
92 95
93 - (void)setModel:(LVCVodListModel *)model { 96 - (void)setModel:(LVCVodListModel *)model {
LiveVideoCloud/PrefixHeader.pch
@@ -57,6 +57,7 @@ @@ -57,6 +57,7 @@
57 #import <CNLiveChatManager/CNLiveCommentManager.h> 57 #import <CNLiveChatManager/CNLiveCommentManager.h>
58 #import <CNLiveShortVideoSDK/CNLiveMediaEditKit.h> 58 #import <CNLiveShortVideoSDK/CNLiveMediaEditKit.h>
59 #import "NSString+StringSize.h" 59 #import "NSString+StringSize.h"
  60 + #import <CNLiveStat/CNLiveStat.h>
60 61
61 #if TARGET_OS_IPHONE 62 #if TARGET_OS_IPHONE
62 63