Commit a8c7064696d0d4d7acf57a8e05899f2d9c536659
1 parent
4b2c9ea2
替换播放SDK
Showing
14 changed files
with
119 additions
and
41 deletions
LiveVideoCloud.xcodeproj/project.pbxproj
| ... | ... | @@ -66,8 +66,6 @@ |
| 66 | 66 | 4BD856121EBAD2640082061D /* ProgramModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BD856111EBAD2640082061D /* ProgramModel.m */; }; |
| 67 | 67 | 4BD856151EBAD31A0082061D /* NSString+UrlEncode.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BD856141EBAD31A0082061D /* NSString+UrlEncode.m */; }; |
| 68 | 68 | 4BD856181EBAD35C0082061D /* NSDictionary+Safety.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BD856171EBAD35C0082061D /* NSDictionary+Safety.m */; }; |
| 69 | - 4BD856191EBAD4E30082061D /* CNLiveUserSystemSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BD855D21EBAC8B20082061D /* CNLiveUserSystemSDK.framework */; }; | |
| 70 | - 4BD8561A1EBAD4E30082061D /* CNLiveUserSystemSDK.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4BD855D21EBAC8B20082061D /* CNLiveUserSystemSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; | |
| 71 | 69 | 4BD8561D1EBAD6490082061D /* ZXConst.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BD8561C1EBAD6490082061D /* ZXConst.m */; }; |
| 72 | 70 | 810B64E01E779AE900133E15 /* LVCPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 810B64DF1E779AE900133E15 /* LVCPlayer.m */; }; |
| 73 | 71 | 810B64E31E779AFE00133E15 /* LVCLivePlayerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 810B64E21E779AFE00133E15 /* LVCLivePlayerController.m */; }; |
| ... | ... | @@ -89,9 +87,8 @@ |
| 89 | 87 | 8128E2881E8A6A3600B40E75 /* CNBarrageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 8128E2851E8A6A3600B40E75 /* CNBarrageManager.m */; }; |
| 90 | 88 | 8128E2891E8A6A3600B40E75 /* CNBarrageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8128E2871E8A6A3600B40E75 /* CNBarrageView.m */; }; |
| 91 | 89 | 8130911E1E84C0F0005F0BFF /* LVCMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = 8130911D1E84C0F0005F0BFF /* LVCMessage.m */; }; |
| 92 | - 8157A0181EE1451800ADD6B9 /* CNLivePlayerSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8157A0171EE1451800ADD6B9 /* CNLivePlayerSDK.framework */; }; | |
| 93 | - 8157A0191EE1452800ADD6B9 /* CNLivePlayerSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8157A0171EE1451800ADD6B9 /* CNLivePlayerSDK.framework */; }; | |
| 94 | - 8157A01A1EE1452800ADD6B9 /* CNLivePlayerSDK.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 8157A0171EE1451800ADD6B9 /* CNLivePlayerSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; | |
| 90 | + 8178D4171F01FA2900AA78A4 /* CNLivePlayerSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8178D4161F01FA2900AA78A4 /* CNLivePlayerSDK.framework */; }; | |
| 91 | + 8178D4191F01FA3600AA78A4 /* CNLivePlayerSDK.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 8178D4161F01FA2900AA78A4 /* CNLivePlayerSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; | |
| 95 | 92 | 81A1B9A91E8277410079FF5F /* LVCInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 81A1B9A81E8277410079FF5F /* LVCInputView.m */; }; |
| 96 | 93 | 81A482F81E88AFA20097A80A /* LVCFirstHeaderReusableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 81A482F71E88AFA20097A80A /* LVCFirstHeaderReusableView.m */; }; |
| 97 | 94 | 81A483021E88B0130097A80A /* LVCChatRoomModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 81A483001E88B0130097A80A /* LVCChatRoomModel.m */; }; |
| ... | ... | @@ -256,8 +253,6 @@ |
| 256 | 253 | D2888DB11E6EC05F003A77C8 /* TempViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888DB01E6EC05F003A77C8 /* TempViewController.m */; }; |
| 257 | 254 | D2888DB41E6EC154003A77C8 /* HomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888DB31E6EC154003A77C8 /* HomeViewController.m */; }; |
| 258 | 255 | D28F5FFF1E8BC7EF00914142 /* LVCUGCLiveListView.m in Sources */ = {isa = PBXBuildFile; fileRef = D28F5FFE1E8BC7EF00914142 /* LVCUGCLiveListView.m */; }; |
| 259 | - D2994BA61E8F48DE00E8D2CC /* CNLiveChatManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2994BA41E8F48DE00E8D2CC /* CNLiveChatManager.framework */; }; | |
| 260 | - D2994BA71E8F48DE00E8D2CC /* CNLiveMsgTools.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2994BA51E8F48DE00E8D2CC /* CNLiveMsgTools.framework */; }; | |
| 261 | 256 | D2994BA81E8F490400E8D2CC /* CNLiveChatManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2994BA41E8F48DE00E8D2CC /* CNLiveChatManager.framework */; }; |
| 262 | 257 | D2994BA91E8F490400E8D2CC /* CNLiveChatManager.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D2994BA41E8F48DE00E8D2CC /* CNLiveChatManager.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; |
| 263 | 258 | D2994BAA1E8F490700E8D2CC /* CNLiveMsgTools.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2994BA51E8F48DE00E8D2CC /* CNLiveMsgTools.framework */; }; |
| ... | ... | @@ -302,8 +297,7 @@ |
| 302 | 297 | dstPath = ""; |
| 303 | 298 | dstSubfolderSpec = 10; |
| 304 | 299 | files = ( |
| 305 | - 4BD8561A1EBAD4E30082061D /* CNLiveUserSystemSDK.framework in Embed Frameworks */, | |
| 306 | - 8157A01A1EE1452800ADD6B9 /* CNLivePlayerSDK.framework in Embed Frameworks */, | |
| 300 | + 8178D4191F01FA3600AA78A4 /* CNLivePlayerSDK.framework in Embed Frameworks */, | |
| 307 | 301 | D2994BA91E8F490400E8D2CC /* CNLiveChatManager.framework in Embed Frameworks */, |
| 308 | 302 | D2994BAB1E8F490700E8D2CC /* CNLiveMsgTools.framework in Embed Frameworks */, |
| 309 | 303 | ); |
| ... | ... | @@ -481,7 +475,7 @@ |
| 481 | 475 | 8128E2871E8A6A3600B40E75 /* CNBarrageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNBarrageView.m; sourceTree = "<group>"; }; |
| 482 | 476 | 8130911C1E84C0F0005F0BFF /* LVCMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCMessage.h; sourceTree = "<group>"; }; |
| 483 | 477 | 8130911D1E84C0F0005F0BFF /* LVCMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCMessage.m; sourceTree = "<group>"; }; |
| 484 | - 8157A0171EE1451800ADD6B9 /* CNLivePlayerSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLivePlayerSDK.framework; sourceTree = "<group>"; }; | |
| 478 | + 8178D4161F01FA2900AA78A4 /* CNLivePlayerSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLivePlayerSDK.framework; sourceTree = "<group>"; }; | |
| 485 | 479 | 81A1B9A71E8277410079FF5F /* LVCInputView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCInputView.h; sourceTree = "<group>"; }; |
| 486 | 480 | 81A1B9A81E8277410079FF5F /* LVCInputView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCInputView.m; sourceTree = "<group>"; }; |
| 487 | 481 | 81A482F61E88AFA20097A80A /* LVCFirstHeaderReusableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCFirstHeaderReusableView.h; sourceTree = "<group>"; }; |
| ... | ... | @@ -856,14 +850,10 @@ |
| 856 | 850 | files = ( |
| 857 | 851 | 4BD855D31EBAC8B20082061D /* CNLiveUserSystemSDK.framework in Frameworks */, |
| 858 | 852 | D25BF8A31E80C4FC007FB138 /* Accelerate.framework in Frameworks */, |
| 859 | - D2994BA71E8F48DE00E8D2CC /* CNLiveMsgTools.framework in Frameworks */, | |
| 860 | - 8157A0181EE1451800ADD6B9 /* CNLivePlayerSDK.framework in Frameworks */, | |
| 853 | + 8178D4171F01FA2900AA78A4 /* CNLivePlayerSDK.framework in Frameworks */, | |
| 861 | 854 | D2575C7D1E76A4F300E3A8FC /* NHGiftAnimtionSDK.a in Frameworks */, |
| 862 | 855 | D2994BAA1E8F490700E8D2CC /* CNLiveMsgTools.framework in Frameworks */, |
| 863 | - 4BD856191EBAD4E30082061D /* CNLiveUserSystemSDK.framework in Frameworks */, | |
| 864 | - D2994BA61E8F48DE00E8D2CC /* CNLiveChatManager.framework in Frameworks */, | |
| 865 | 856 | D2994BA81E8F490400E8D2CC /* CNLiveChatManager.framework in Frameworks */, |
| 866 | - 8157A0191EE1452800ADD6B9 /* CNLivePlayerSDK.framework in Frameworks */, | |
| 867 | 857 | ); |
| 868 | 858 | runOnlyForDeploymentPostprocessing = 0; |
| 869 | 859 | }; |
| ... | ... | @@ -1150,7 +1140,7 @@ |
| 1150 | 1140 | 812E504E1E7699B9004F5FCD /* CNLiveSDK */ = { |
| 1151 | 1141 | isa = PBXGroup; |
| 1152 | 1142 | children = ( |
| 1153 | - 8157A0171EE1451800ADD6B9 /* CNLivePlayerSDK.framework */, | |
| 1143 | + 8178D4161F01FA2900AA78A4 /* CNLivePlayerSDK.framework */, | |
| 1154 | 1144 | D2994BA41E8F48DE00E8D2CC /* CNLiveChatManager.framework */, |
| 1155 | 1145 | D2994BA51E8F48DE00E8D2CC /* CNLiveMsgTools.framework */, |
| 1156 | 1146 | D25BF87C1E7B8C78007FB138 /* KSYGPUResource.bundle */, | ... | ... |
LiveVideoCloud/Classes/CNLiveSDK/CNLivePlayerSDK.framework/CNLivePlayerSDK
No preview for this file type
LiveVideoCloud/Classes/CNLiveSDK/CNLivePlayerSDK.framework/Headers/CNLiveGPUStreamerKit.h
| ... | ... | @@ -109,6 +109,17 @@ |
| 109 | 109 | - (void)startStreamWithUrl:(NSString *)url activityId:(NSString *)activityId success:(void (^)(void))successBlock failure:(void (^)(NSDictionary *errorDic))failureBlock; |
| 110 | 110 | |
| 111 | 111 | |
| 112 | +/** | |
| 113 | + @abstract 暂停推流 | |
| 114 | + @warning 恢复推流时根据情况调用 startStream: 或 startStreamWithUrl:方法 | |
| 115 | + */ | |
| 116 | +- (void)pauseStreaming; | |
| 117 | + | |
| 118 | +/** | |
| 119 | + * 主播端未停止推流,但是服务端认为该视频不合法,断开推流,接收到该通知主播端应结束推流(视讯云平台有效) | |
| 120 | + */ | |
| 121 | +FOUNDATION_EXPORT NSString *const CNLiveServiceConnectBreakNotification NS_AVAILABLE_IOS(7_0); | |
| 122 | + | |
| 112 | 123 | #pragma mark - 普通推流 |
| 113 | 124 | |
| 114 | 125 | /** | ... | ... |
LiveVideoCloud/Classes/CNLiveSDK/CNLivePlayerSDK.framework/Headers/CNLiveMoviePlayerController.h
| ... | ... | @@ -25,11 +25,12 @@ |
| 25 | 25 | authSuccess:(void(^)(void))authSuccessBlock |
| 26 | 26 | authFailed:(void(^)(NSDictionary *errorInfo))authFailedBlock; |
| 27 | 27 | |
| 28 | -/* 初始化直播播放器 初始化成功后才能对播放器进行设置(如:自动播放、是否开启硬件解码等)和调用准备播放视频方法(prepareToPlay) | |
| 28 | +/* 初始化直播播放器(* 以channelId播放) 初始化成功后才能对播放器进行设置(如:自动播放、是否开启硬件解码等)和调用准备播放视频方法(prepareToPlay) | |
| 29 | 29 | * |
| 30 | 30 | * 当前版本只支持单实例的CNLiveMoviePlayerController对象,多实例将导致播放异常 |
| 31 | 31 | * |
| 32 | 32 | * channelId 直播视频Id |
| 33 | + * agree 是否允许获取主播状态 YES:获取 NO:不获取 | |
| 33 | 34 | * authSuccess 初始化成功block |
| 34 | 35 | * authFailed 初始化失败block 回调一个errorInfo的字典 |
| 35 | 36 | * |
| ... | ... | @@ -38,6 +39,29 @@ |
| 38 | 39 | * - (void)retryToGetAnchorStatusResult:(void(^)(BOOL result))result;方法重新获取 |
| 39 | 40 | */ |
| 40 | 41 | - (instancetype)initLivePlayWithChannelId:(NSString *)channelId |
| 42 | + anchorStatus:(BOOL)agree | |
| 43 | + authSuccess:(void(^)(void))authSuccessBlock | |
| 44 | + authFailed:(void(^)(NSDictionary *errorInfo))authFailedBlock | |
| 45 | + getAnchorStatusResult:(void(^)(BOOL result))result; | |
| 46 | + | |
| 47 | + | |
| 48 | +/* 初始化直播播放器(* 以channelId播放) 初始化成功后才能对播放器进行设置(如:自动播放、是否开启硬件解码等)和调用准备播放视频方法(prepareToPlay) | |
| 49 | + * | |
| 50 | + * 当前版本只支持单实例的CNLiveMoviePlayerController对象,多实例将导致播放异常 | |
| 51 | + * | |
| 52 | + * channelId 直播视频Id (注* 若agree为YES时,必传,用于获取主播状态; 若agree为NO,可不传) | |
| 53 | + * activityId 活动Id | |
| 54 | + * agree 是否允许获取主播状态 YES:获取 NO:不获取 | |
| 55 | + * authSuccess 初始化成功block | |
| 56 | + * authFailed 初始化失败block 回调一个errorInfo的字典 | |
| 57 | + * | |
| 58 | + * result 获取主播状态 YES:获取状态成功 | |
| 59 | + * NO:获取失败,不影响视频播放,但是获取不到主播离开、回来、直播结束等通知。可通过 | |
| 60 | + * - (void)retryToGetAnchorStatusResult:(void(^)(BOOL result))result;方法重新获取 | |
| 61 | + */ | |
| 62 | +- (instancetype)initLivePlayWithChannelId:(NSString *)channelId | |
| 63 | + activityId:(NSString *)activityId | |
| 64 | + anchorStatus:(BOOL)agree | |
| 41 | 65 | authSuccess:(void(^)(void))authSuccessBlock |
| 42 | 66 | authFailed:(void(^)(NSDictionary *errorInfo))authFailedBlock |
| 43 | 67 | getAnchorStatusResult:(void(^)(BOOL result))result; |
| ... | ... | @@ -268,6 +292,12 @@ MP_EXTERN NSString * const MPMoviePlayerFirstVideoFrameRenderedNotification; |
| 268 | 292 | |
| 269 | 293 | MP_EXTERN NSString * const MPMoviePlayerFirstAudioFrameRenderedNotification; |
| 270 | 294 | |
| 295 | +//Posted when the network status change | |
| 296 | +MP_EXTERN NSString * const MPMoviePlayerNetworkStatusChangeNotification; | |
| 297 | +MP_EXTERN NSString * const MPMoviePlayerCurrNetworkStatusUserInfoKey; // NSNumber (KSYNetworkStatus) | |
| 298 | +MP_EXTERN NSString * const MPMoviePlayerLastNetworkStatusUserInfoKey; // NSNumber (KSYNetworkStatus) | |
| 299 | + | |
| 300 | + | |
| 271 | 301 | /* bufferTimeMax指定直播流播放时的最大缓冲时长,单位为秒 |
| 272 | 302 | * |
| 273 | 303 | * 当buffer为负数时,关闭直播追赶 | ... | ... |
LiveVideoCloud/Classes/CNLiveSDK/CNLivePlayerSDK.framework/Headers/CNLiveTypeDef.h
| ... | ... | @@ -237,4 +237,13 @@ typedef NS_ENUM(NSUInteger, CNLiveAnchorStatus) { |
| 237 | 237 | CNLiveAnchorStatusEnd, |
| 238 | 238 | }; |
| 239 | 239 | |
| 240 | +/** | |
| 241 | + * 播放时网络状态 | |
| 242 | + */ | |
| 243 | +typedef NS_ENUM(NSInteger, CNLiveNetworkStatus) { | |
| 244 | + CNLiveNotReachable = 0, | |
| 245 | + CNLiveReachableViaWiFi = 2, | |
| 246 | + CNLiveReachableViaWWAN = 1 | |
| 247 | +}; | |
| 248 | + | |
| 240 | 249 | #endif /* CNLiveTypeDef_h */ | ... | ... |
LiveVideoCloud/Classes/CNLiveSDK/CNLivePlayerSDK.framework/Headers/CNLiveWebcastManager.h
| ... | ... | @@ -18,6 +18,8 @@ |
| 18 | 18 | |
| 19 | 19 | @interface CNLiveWebcastManager : NSObject |
| 20 | 20 | |
| 21 | ++ (CNLiveWebcastManager *)manager; | |
| 22 | + | |
| 21 | 23 | /** |
| 22 | 24 | * 应用ID(只读) |
| 23 | 25 | */ |
| ... | ... | @@ -28,10 +30,13 @@ |
| 28 | 30 | */ |
| 29 | 31 | @property (nonatomic, readonly) NSString *appKey; |
| 30 | 32 | |
| 31 | -+ (CNLiveWebcastManager *)manager; | |
| 33 | +/** | |
| 34 | + * 是否是测试环境 | |
| 35 | + */ | |
| 36 | +@property (nonatomic, readonly) BOOL isTestEnvironment; | |
| 32 | 37 | |
| 33 | 38 | /** |
| 34 | - @abstract 初始化直播云SDK | |
| 39 | + @abstract 初始化直播云SDK(该方法默认正式环境) | |
| 35 | 40 | @param appId 在open.cnlive.com网站申请得到的appId |
| 36 | 41 | @param appKey 在open.cnlive.com网站申请得到的appKey |
| 37 | 42 | @warning 必传参数 |
| ... | ... | @@ -39,6 +44,15 @@ |
| 39 | 44 | - (void)initWithAppId:(NSString *)appId appKey:(NSString *)appKey; |
| 40 | 45 | |
| 41 | 46 | /** |
| 47 | + @abstract 初始化直播云SDK | |
| 48 | + @param appId 在open.cnlive.com网站申请得到的appId | |
| 49 | + @param appKey 在open.cnlive.com网站申请得到的appKey | |
| 50 | + @param isTestEnvironment YES:测试环境 NO:正式环境 | |
| 51 | + @warning 必传参数 | |
| 52 | + */ | |
| 53 | +- (void)initWithAppId:(NSString *)appId appKey:(NSString *)appKey isTestEnvironment:(BOOL)isTestEnvironment; | |
| 54 | + | |
| 55 | +/** | |
| 42 | 56 | @abstract 获取版本号 |
| 43 | 57 | */ |
| 44 | 58 | + (NSString *)getVersion; | ... | ... |
LiveVideoCloud/Classes/CNLiveSDK/CNLivePlayerSDK.framework/Info.plist
No preview for this file type
LiveVideoCloud/Classes/Sections/homeSections/ChatView/LVCChatView.h
LiveVideoCloud/Classes/Sections/homeSections/ChatView/LVCChatView.m
LiveVideoCloud/Classes/Sections/homeSections/Controller/HomeViewController.m
| ... | ... | @@ -30,8 +30,7 @@ |
| 30 | 30 | |
| 31 | 31 | - (void)viewDidLoad { |
| 32 | 32 | [super viewDidLoad]; |
| 33 | - | |
| 34 | - self.navigationItem.title = @"直播"; | |
| 33 | + self.view.backgroundColor = [UIColor whiteColor]; | |
| 35 | 34 | |
| 36 | 35 | _titleArr = @[@"直播",@"频道"]; |
| 37 | 36 | CGFloat width = 0; |
| ... | ... | @@ -47,10 +46,9 @@ |
| 47 | 46 | |
| 48 | 47 | self.navigationItem.titleView = self.titleView; |
| 49 | 48 | |
| 50 | - [self.view addSubview:self.pageView]; | |
| 51 | 49 | [_pageView reloadPages]; |
| 52 | 50 | [_titleView reloadData]; |
| 53 | - [self.titleView scrollToElement:0 animated:NO]; | |
| 51 | + [self.view addSubview:self.pageView]; | |
| 54 | 52 | |
| 55 | 53 | } |
| 56 | 54 | |
| ... | ... | @@ -156,7 +154,6 @@ |
| 156 | 154 | _pageView.pagingDelegate = self; |
| 157 | 155 | _pageView.delegate = self; |
| 158 | 156 | _pageView.scrollsToTop = NO; |
| 159 | - _pageView.bounces = NO; | |
| 160 | 157 | } |
| 161 | 158 | return _pageView; |
| 162 | 159 | } | ... | ... |
LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCLivePlayerController.m
| ... | ... | @@ -30,9 +30,6 @@ |
| 30 | 30 | @property (nonatomic, strong) LVCInputView *inputView; |
| 31 | 31 | @property (nonatomic, strong) LVCChatView *chatView; |
| 32 | 32 | |
| 33 | -@property (nonatomic, strong) NSTimer *timer; | |
| 34 | -@property (nonatomic, assign) NSTimeInterval countTime; | |
| 35 | - | |
| 36 | 33 | @property (nonatomic, strong) CNBarrageManager *barrageManager; //弹幕管理者 |
| 37 | 34 | @property (nonatomic ,strong) UIView *barrageBaseView; //弹幕总View |
| 38 | 35 | @property (nonatomic, strong) UITapGestureRecognizer *tap; |
| ... | ... | @@ -263,8 +260,7 @@ |
| 263 | 260 | [_player stopPlaying]; |
| 264 | 261 | |
| 265 | 262 | //退出聊天室 |
| 266 | - [[CNLiveChatManager sharedCNLiveChatManager] quitChatRoom:_roomId success:NULL error:NULL]; | |
| 267 | - | |
| 263 | + [_chatView quitChatroom]; | |
| 268 | 264 | [self removeViews]; |
| 269 | 265 | |
| 270 | 266 | self.navigationController.navigationBar.hidden = NO; |
| ... | ... | @@ -317,10 +313,16 @@ |
| 317 | 313 | [_player removeFromSuperview]; |
| 318 | 314 | [_chatView removeFromSuperview]; |
| 319 | 315 | [_inputView removeFromSuperview]; |
| 316 | + | |
| 320 | 317 | _player = nil; |
| 318 | + _player.delegate = nil; | |
| 319 | + | |
| 320 | + _chatView.delegate = nil; | |
| 321 | 321 | _chatView = nil; |
| 322 | + | |
| 323 | + _inputView.delegate = nil; | |
| 322 | 324 | _inputView = nil; |
| 323 | - _player.delegate = nil; | |
| 325 | + | |
| 324 | 326 | [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 325 | 327 | } |
| 326 | 328 | |
| ... | ... | @@ -436,6 +438,11 @@ |
| 436 | 438 | // Dispose of any resources that can be recreated. |
| 437 | 439 | } |
| 438 | 440 | |
| 441 | +- (void)dealloc | |
| 442 | +{ | |
| 443 | + NSLog(@"LVCLivePlayerController dealloc"); | |
| 444 | +} | |
| 445 | + | |
| 439 | 446 | /* |
| 440 | 447 | #pragma mark - Navigation |
| 441 | 448 | ... | ... |
LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCUGCLivePlayerController.m
| ... | ... | @@ -137,8 +137,7 @@ |
| 137 | 137 | |
| 138 | 138 | if ([model.activityStatus isEqualToString:@"1"]) { |
| 139 | 139 | |
| 140 | - _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:model.channelId | |
| 141 | - authSuccess:^{ | |
| 140 | + _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:model.channelId anchorStatus:YES authSuccess:^{ | |
| 142 | 141 | |
| 143 | 142 | _player.videoDecoderMode = CNLiveMovieVideoDecoderMode_AUTO; |
| 144 | 143 | _player.view.frame = self.view.bounds; |
| ... | ... | @@ -274,8 +273,7 @@ |
| 274 | 273 | |
| 275 | 274 | [self addLiveBaseView]; |
| 276 | 275 | |
| 277 | - _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:_playArray[_index].channelId | |
| 278 | - authSuccess:^{ | |
| 276 | + _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:_playArray[_index].channelId anchorStatus:YES authSuccess:^{ | |
| 279 | 277 | |
| 280 | 278 | _player.videoDecoderMode = CNLiveMovieVideoDecoderMode_AUTO; |
| 281 | 279 | _player.view.frame = self.view.bounds; |
| ... | ... | @@ -379,8 +377,7 @@ |
| 379 | 377 | } else if ([_playArray[_index].activityStatus isEqualToString:@"1"]) { |
| 380 | 378 | [self addLiveBaseView]; |
| 381 | 379 | |
| 382 | - _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:_playArray[_index].channelId | |
| 383 | - authSuccess:^{ | |
| 380 | + _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:_playArray[_index].channelId anchorStatus:YES authSuccess:^{ | |
| 384 | 381 | |
| 385 | 382 | _player.videoDecoderMode = CNLiveMovieVideoDecoderMode_AUTO; |
| 386 | 383 | _player.view.frame = self.view.bounds; | ... | ... |
LiveVideoCloud/Classes/Sections/homeSections/View/LVCPlayer.m
| ... | ... | @@ -30,6 +30,11 @@ |
| 30 | 30 | |
| 31 | 31 | @implementation LVCPlayer |
| 32 | 32 | |
| 33 | +- (void)dealloc | |
| 34 | +{ | |
| 35 | + NSLog(@"LVCPlayer dealloc"); | |
| 36 | +} | |
| 37 | + | |
| 33 | 38 | - (instancetype)initWithFrame:(CGRect)frame playerModel:(LVCChannelDetailsModel *)model |
| 34 | 39 | { |
| 35 | 40 | self = [super initWithFrame:frame]; |
| ... | ... | @@ -62,7 +67,7 @@ |
| 62 | 67 | /* |
| 63 | 68 | */ |
| 64 | 69 | NSString *channelId = [NSString stringWithFormat:@"82_%@",model.mediaId]; |
| 65 | - _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:channelId authSuccess:^{ | |
| 70 | + _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:channelId anchorStatus:NO authSuccess:^{ | |
| 66 | 71 | [self addObservers]; |
| 67 | 72 | _player.videoDecoderMode = CNLiveMovieVideoDecoderMode_AUTO; |
| 68 | 73 | _player.shouldAutoplay = YES; |
| ... | ... | @@ -512,6 +517,21 @@ |
| 512 | 517 | } |
| 513 | 518 | } |
| 514 | 519 | |
| 520 | +- (void)exitPlayer { | |
| 521 | + if (_player.isPlaying) { | |
| 522 | + [_player stop]; | |
| 523 | + } | |
| 524 | + | |
| 525 | + [_player destroyPlayer]; | |
| 526 | + _player = nil; | |
| 527 | + [self removeMovieNotificationObservers]; | |
| 528 | + | |
| 529 | + if (_timer) { | |
| 530 | + [_timer invalidate]; | |
| 531 | + _timer = nil; | |
| 532 | + } | |
| 533 | +} | |
| 534 | + | |
| 515 | 535 | #pragma mark - |
| 516 | 536 | #pragma mark - getter |
| 517 | 537 | ... | ... |
LiveVideoCloud/Classes/Sections/homeSections/View/LVCTelevisionView.m
| ... | ... | @@ -22,8 +22,8 @@ static NSString *otherHeaderId = @"LVCOtherHeaderReusableView"; |
| 22 | 22 | |
| 23 | 23 | @property (nonatomic, strong) UICollectionView *collectionView; |
| 24 | 24 | @property (nonatomic, strong) NSArray *bannerModelArray; //banner数据源 |
| 25 | -@property (nonatomic, strong) NSArray *marqueeModelArray; // | |
| 26 | -@property (nonatomic, strong) NSArray *channelsModelArray; // | |
| 25 | +@property (nonatomic, strong) NSArray *marqueeModelArray; | |
| 26 | +@property (nonatomic, strong) NSArray *channelsModelArray; | |
| 27 | 27 | |
| 28 | 28 | @end |
| 29 | 29 | |
| ... | ... | @@ -35,6 +35,7 @@ static NSString *otherHeaderId = @"LVCOtherHeaderReusableView"; |
| 35 | 35 | if (self) { |
| 36 | 36 | |
| 37 | 37 | self.backgroundColor = [UIColor whiteColor]; |
| 38 | + | |
| 38 | 39 | [self addSubview:self.collectionView]; |
| 39 | 40 | [self loadData]; |
| 40 | 41 | |
| ... | ... | @@ -188,7 +189,7 @@ static NSString *otherHeaderId = @"LVCOtherHeaderReusableView"; |
| 188 | 189 | [_collectionView registerClass:[LVCLiveListCollectionViewCell class] forCellWithReuseIdentifier:cellId]; |
| 189 | 190 | [_collectionView registerClass:[LVCFirstHeaderReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:firstHeaderId]; |
| 190 | 191 | [_collectionView registerClass:[LVCOtherHeaderReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:otherHeaderId]; |
| 191 | - | |
| 192 | + _collectionView.scrollsToTop = NO; | |
| 192 | 193 | _collectionView.dataSource = self; |
| 193 | 194 | _collectionView.delegate = self; |
| 194 | 195 | } | ... | ... |