Commit 3311d5962ea620d42e693ab3bb1dc6e2479043ca
1 parent
4445cfb4
no message
Showing
4 changed files
with
18 additions
and
17 deletions
CNLivePlayer/Classes/Player/CNLivePlayer.h
| @@ -16,10 +16,10 @@ | @@ -16,10 +16,10 @@ | ||
| 16 | // 播放器管理类 | 16 | // 播放器管理类 |
| 17 | #import "CNLivePlayerManager.h" | 17 | #import "CNLivePlayerManager.h" |
| 18 | 18 | ||
| 19 | -//缓存url | 19 | +// 缓存url |
| 20 | #import "CNLivePlayerDBTool.h" | 20 | #import "CNLivePlayerDBTool.h" |
| 21 | 21 | ||
| 22 | -//缓存h视频 | 22 | +// 缓存视频 |
| 23 | #import "CNLiveHTTPProxyService.h" | 23 | #import "CNLiveHTTPProxyService.h" |
| 24 | 24 | ||
| 25 | NS_ASSUME_NONNULL_BEGIN | 25 | NS_ASSUME_NONNULL_BEGIN |
| @@ -88,13 +88,14 @@ typedef void(^AuthFailureBlock)(NSDictionary *errorInfo); | @@ -88,13 +88,14 @@ typedef void(^AuthFailureBlock)(NSDictionary *errorInfo); | ||
| 88 | 88 | ||
| 89 | /* 初始化音频播放器 初始化成功后才能对播放器进行设置(如:自动播放、是否开启硬件解码等)和调用准备播放视频方法(prepareToPlay) | 89 | /* 初始化音频播放器 初始化成功后才能对播放器进行设置(如:自动播放、是否开启硬件解码等)和调用准备播放视频方法(prepareToPlay) |
| 90 | * | 90 | * |
| 91 | - * contentId 音频Id | ||
| 92 | - * authSuccess 初始化成功block | ||
| 93 | - * authFailed 初始化失败block 回调一个errorInfo的字典 | 91 | + * audioId 音频Id |
| 92 | + * authSuccess 初始化成功block | ||
| 93 | + * authFailed 初始化失败block 回调一个errorInfo的字典 | ||
| 94 | * | 94 | * |
| 95 | */ | 95 | */ |
| 96 | - (instancetype)initAudioPlayerWithAudioId:(NSString *)audioId authSuccess:(AuthSuccessBlock)authSuccessBlock authFailure:(AuthFailureBlock)authFailureBlock; | 96 | - (instancetype)initAudioPlayerWithAudioId:(NSString *)audioId authSuccess:(AuthSuccessBlock)authSuccessBlock authFailure:(AuthFailureBlock)authFailureBlock; |
| 97 | 97 | ||
| 98 | + | ||
| 98 | #pragma mark - 属性 | 99 | #pragma mark - 属性 |
| 99 | /** | 100 | /** |
| 100 | @abstract 正在播放的视频文件的地址,该地址可以是本地地址或者服务器地址。 | 101 | @abstract 正在播放的视频文件的地址,该地址可以是本地地址或者服务器地址。 |
CNLivePlayer/Classes/Player/CNLivePlayer.m
| @@ -160,8 +160,8 @@ NSString * const CNLiveHostStatusChangedNotification = @"CNLiveAnchorStatusChang | @@ -160,8 +160,8 @@ NSString * const CNLiveHostStatusChangedNotification = @"CNLiveAnchorStatusChang | ||
| 160 | /* 初始化音频播放器 初始化成功后才能对播放器进行设置(如:自动播放、是否开启硬件解码等)和调用准备播放视频方法(prepareToPlay) | 160 | /* 初始化音频播放器 初始化成功后才能对播放器进行设置(如:自动播放、是否开启硬件解码等)和调用准备播放视频方法(prepareToPlay) |
| 161 | * | 161 | * |
| 162 | * audioId 音频Id | 162 | * audioId 音频Id |
| 163 | - * authSuccess 初始化成功block | ||
| 164 | - * authFailure 初始化失败block 回调一个errorInfo的字典 | 163 | + * authSuccess 初始化成功block |
| 164 | + * authFailure 初始化失败block 回调一个errorInfo的字典 | ||
| 165 | * | 165 | * |
| 166 | */ | 166 | */ |
| 167 | - (instancetype)initAudioPlayerWithAudioId:(NSString *)audioId authSuccess:(AuthSuccessBlock)authSuccessBlock authFailure:(AuthFailureBlock)authFailureBlock{ | 167 | - (instancetype)initAudioPlayerWithAudioId:(NSString *)audioId authSuccess:(AuthSuccessBlock)authSuccessBlock authFailure:(AuthFailureBlock)authFailureBlock{ |
CNLivePlayer/Classes/Player/CNLivePlayerManager.h
| @@ -8,13 +8,13 @@ | @@ -8,13 +8,13 @@ | ||
| 8 | 8 | ||
| 9 | #import <Foundation/Foundation.h> | 9 | #import <Foundation/Foundation.h> |
| 10 | 10 | ||
| 11 | -#define PLAYER_AppID [CNLivePlayerManager manager].appId?[CNLivePlayerManager manager].appId:@"" | ||
| 12 | -#define PLAYER_AppKey [CNLivePlayerManager manager].appKey?[CNLivePlayerManager manager].appKey:@"" | ||
| 13 | -#define PLAYER_UserId [CNLivePlayerManager manager].userId?[CNLivePlayerManager manager].userId:@"" | ||
| 14 | -#define PLAYER_ChannelName [CNLivePlayerManager manager].channelName?[CNLivePlayerManager manager].channelName:@"" | ||
| 15 | -#define PLAYER_Tag [CNLivePlayerManager manager].tag?[CNLivePlayerManager manager].tag:@"" | ||
| 16 | -#define PLAYER_TestEnvironment [CNLivePlayerManager manager].isTestEnvironment | ||
| 17 | -#define PLAYER_OpenCache [CNLivePlayerManager manager].openCache | 11 | +#define PLAYER_AppID [CNLivePlayerManager manager].appId?[CNLivePlayerManager manager].appId:@"" |
| 12 | +#define PLAYER_AppKey [CNLivePlayerManager manager].appKey?[CNLivePlayerManager manager].appKey:@"" | ||
| 13 | +#define PLAYER_UserId [CNLivePlayerManager manager].userId?[CNLivePlayerManager manager].userId:@"" | ||
| 14 | +#define PLAYER_ChannelName [CNLivePlayerManager manager].channelName?[CNLivePlayerManager manager].channelName:@"" | ||
| 15 | +#define PLAYER_Tag [CNLivePlayerManager manager].tag?[CNLivePlayerManager manager].tag:@"" | ||
| 16 | +#define PLAYER_TestEnvironment [CNLivePlayerManager manager].isTestEnvironment | ||
| 17 | +#define PLAYER_OpenCache [CNLivePlayerManager manager].openCache | ||
| 18 | 18 | ||
| 19 | NS_ASSUME_NONNULL_BEGIN | 19 | NS_ASSUME_NONNULL_BEGIN |
| 20 | 20 |
Example/CNLivePlayer/Player/CNLivePlayerController.m
| @@ -54,7 +54,7 @@ | @@ -54,7 +54,7 @@ | ||
| 54 | 54 | ||
| 55 | UIButton *btn1 = [UIButton buttonWithType:UIButtonTypeCustom]; | 55 | UIButton *btn1 = [UIButton buttonWithType:UIButtonTypeCustom]; |
| 56 | btn1.frame = CGRectMake(0, 0, 100, 50); | 56 | btn1.frame = CGRectMake(0, 0, 100, 50); |
| 57 | - btn1.center = CGPointMake(self.view.center.x, self.view.center.y-120); | 57 | + btn1.center = CGPointMake(self.view.center.x, self.view.center.y); |
| 58 | btn1.backgroundColor = [UIColor redColor]; | 58 | btn1.backgroundColor = [UIColor redColor]; |
| 59 | [btn1 setTitle:@"下一个" forState:UIControlStateNormal]; | 59 | [btn1 setTitle:@"下一个" forState:UIControlStateNormal]; |
| 60 | [btn1 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; | 60 | [btn1 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; |
| @@ -63,7 +63,7 @@ | @@ -63,7 +63,7 @@ | ||
| 63 | 63 | ||
| 64 | UIButton *btn2 = [UIButton buttonWithType:UIButtonTypeCustom]; | 64 | UIButton *btn2 = [UIButton buttonWithType:UIButtonTypeCustom]; |
| 65 | btn2.frame = CGRectMake(0, 0, 100, 50); | 65 | btn2.frame = CGRectMake(0, 0, 100, 50); |
| 66 | - btn2.center = CGPointMake(self.view.center.x, self.view.center.y); | 66 | + btn2.center = CGPointMake(self.view.center.x, self.view.center.y+100); |
| 67 | btn2.backgroundColor = [UIColor redColor]; | 67 | btn2.backgroundColor = [UIColor redColor]; |
| 68 | [btn2 setTitle:@"切换码率" forState:UIControlStateNormal]; | 68 | [btn2 setTitle:@"切换码率" forState:UIControlStateNormal]; |
| 69 | [btn2 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; | 69 | [btn2 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; |
| @@ -72,7 +72,7 @@ | @@ -72,7 +72,7 @@ | ||
| 72 | 72 | ||
| 73 | UIButton *btn3 = [UIButton buttonWithType:UIButtonTypeCustom]; | 73 | UIButton *btn3 = [UIButton buttonWithType:UIButtonTypeCustom]; |
| 74 | btn3.frame = CGRectMake(0, 0, 100, 50); | 74 | btn3.frame = CGRectMake(0, 0, 100, 50); |
| 75 | - btn3.center = CGPointMake(self.view.center.x, self.view.center.y+120); | 75 | + btn3.center = CGPointMake(self.view.center.x, self.view.center.y+200); |
| 76 | btn3.backgroundColor = [UIColor redColor]; | 76 | btn3.backgroundColor = [UIColor redColor]; |
| 77 | [btn3 setTitle:@"返回" forState:UIControlStateNormal]; | 77 | [btn3 setTitle:@"返回" forState:UIControlStateNormal]; |
| 78 | [btn3 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; | 78 | [btn3 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; |