... | ... | @@ -175,19 +175,44 @@ |
|
|
|
|
|
#### 第五步:初始化房间
|
|
|
|
|
|
##### 初始化直播
|
|
|
##### 初始化直播房间控制器
|
|
|
|
|
|
| 方法 | 注释 |
|
|
|
| ------------------------------------------- | -------------- |
|
|
|
| (instancetype)initWithRoomName: liveConfig: | 初始化横屏直播 |
|
|
|
| 控制器名 | 初始化方法 | 注释 |
|
|
|
| ------------------ | ------------------------------------------- | ------------------------ |
|
|
|
| CCPlayerController | (instancetype)initWithRoomName: liveConfig: | 初始化横屏直播房间控制器 |
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
```objc
|
|
|
/// 初始化横屏直播
|
|
|
/// @param roomName 房间名
|
|
|
/// @param liveConfig 直播配置
|
|
|
- (instancetype)initWithRoomName:(NSString *)roomName liveConfig:(HDSLoginConfig *)liveConfig;
|
|
|
@interface XXXVC ()<HDSLoginProtocol>
|
|
|
|
|
|
@end
|
|
|
|
|
|
- (void)joinRoom {
|
|
|
HDSLoginConfig *config = [[HDSLoginConfig alloc]init];
|
|
|
config.roomId = @""; //房间ID
|
|
|
config.userId = @""; //用户ID
|
|
|
config.viewerName = @""; //用户名
|
|
|
config.token = @""; //密码
|
|
|
config.joinType = HDSJoinTypeModal; //进入方式
|
|
|
config.isPauseInBackGround = NO; //允许后台播放
|
|
|
|
|
|
// 初始化直播控制器
|
|
|
CCPlayerController *liveVC = [[CCPlayerController alloc]initWithRoomName:@"直播" liveConfig:config];
|
|
|
liveVC.delegate = self; //代理方法
|
|
|
liveVC.modalPresentationStyle = 0; //modal样式
|
|
|
[self presentViewController:liveVC animated:NO completion:^{
|
|
|
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
- (void)initSucced:(HDSLoginSource)sourceType {
|
|
|
//登录成功
|
|
|
}
|
|
|
|
|
|
- (void)initFailed:(NSString *)message sourceType:(HDSLoginSource)sourceType {
|
|
|
//登录失败
|
|
|
}
|
|
|
```
|
|
|
|
|
|
|
... | ... | @@ -201,20 +226,22 @@ |
|
|
|
|
|
|
|
|
|
|
|
##### 初始化竖屏直播
|
|
|
##### 初始化竖屏直播房间控制器
|
|
|
|
|
|
| 方法 | 注释 |
|
|
|
| ------------------------------------------- | -------------- |
|
|
|
| (instancetype)initWithRoomName: liveConfig: | 初始化竖屏直播 |
|
|
|
| 控制器名 | 初始化方法 | 注释 |
|
|
|
| ----------------------- | ------------------------------------------- | ------------------------ |
|
|
|
| HDSLiveStreamController | (instancetype)initWithRoomName: liveConfig: | 初始化竖屏直播房间控制器 |
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
```objc
|
|
|
/// 初始化竖屏直播
|
|
|
/// 初始化竖屏直播房间控制器
|
|
|
/// - Parameters:
|
|
|
/// - roomName: 房间名称
|
|
|
/// - liveConfig: 直播配置
|
|
|
- (instancetype)initWithRoomName:(NSString *)roomName liveConfig:(HDSLoginConfig *)liveConfig;
|
|
|
|
|
|
初始化方法参考 初始化直播房间控制器
|
|
|
```
|
|
|
|
|
|
代理方法
|
... | ... | @@ -226,19 +253,42 @@ |
|
|
|
|
|
|
|
|
|
|
|
##### 初始化在线回放
|
|
|
##### 初始化在线回放房间控制器
|
|
|
|
|
|
| 方法 | 注释 |
|
|
|
| ------------------------------------- | -------------- |
|
|
|
| (instancetype)initWithPlayBackConfig: | 初始化观看回放 |
|
|
|
| 控制器名 | 初始化方法 | 注释 |
|
|
|
| -------------------- | ------------------------------------- | ------------------------ |
|
|
|
| CCPlayBackController | (instancetype)initWithPlayBackConfig: | 初始化在线回放房间控制器 |
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
```objc
|
|
|
/// 初始化观看回放
|
|
|
/// - Parameters:
|
|
|
/// - playBackConfig: 回放配置
|
|
|
- (instancetype)initWithPlayBackConfig:(HDSLoginConfig *)playBackConfig;
|
|
|
@interface XXXVC ()<HDSLoginProtocol>
|
|
|
|
|
|
@end
|
|
|
|
|
|
- (void)joinRoom {
|
|
|
HDSLoginConfig *config = [[HDSLoginConfig alloc]init];
|
|
|
config.roomId = @""; //房间ID
|
|
|
config.userId = @""; //用户ID
|
|
|
config.recordId = @""; //回放ID
|
|
|
config.viewerName = @""; //用户名
|
|
|
config.token = @""; //密码
|
|
|
config.joinType = HDSJoinTypePush; //加入方式
|
|
|
config.isPauseInBackGround = NO; //允许后台播放
|
|
|
|
|
|
//初始化在线回放房间控制器
|
|
|
CCPlayBackController *playBackVC = [[CCPlayBackController alloc]initWithPlayBackConfig:config];
|
|
|
playBackVC.delegate = self; //代理方法
|
|
|
[self.navigationController pushViewController:playBackVC animated:YES];
|
|
|
}
|
|
|
|
|
|
- (void)initSucced:(HDSLoginSource)sourceType {
|
|
|
//登录成功
|
|
|
}
|
|
|
|
|
|
- (void)initFailed:(NSString *)message sourceType:(HDSLoginSource)sourceType {
|
|
|
//登录失败
|
|
|
}
|
|
|
```
|
|
|
|
|
|
代理方法
|
... | ... | @@ -250,20 +300,38 @@ |
|
|
|
|
|
|
|
|
|
|
|
##### 初始化离线回放
|
|
|
##### 初始化离线回放房间控制器
|
|
|
|
|
|
| 方法 | 注释 |
|
|
|
| ---------------------------------------------- | -------------- |
|
|
|
| (instancetype)initWithfileName: offlineConfig: | 初始化离线回放 |
|
|
|
| 控制器名 | 初始化方法 | 注释 |
|
|
|
| ----------------------------- | ---------------------------------------------- | ------------------------ |
|
|
|
| OfflinePlayBackViewController | (instancetype)initWithfileName: offlineConfig: | 初始化离线回放房间控制器 |
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
```objc
|
|
|
/// 初始化离线回放
|
|
|
/// - Parameters:
|
|
|
/// - fileName: 文件名
|
|
|
/// - offlineConfig: 离线配置
|
|
|
- (instancetype)initWithfileName:(NSString *)fileName offlineConfig:(HDSLoginConfig *)offlineConfig;
|
|
|
@interface XXXVC ()<HDSLoginProtocol>
|
|
|
|
|
|
@end
|
|
|
|
|
|
- (void)joinRoom {
|
|
|
HDSLoginConfig *config = [[HDSLoginConfig alloc]init];
|
|
|
config.ccrPath = @""; //ccr路径
|
|
|
config.joinType = HDSJoinTypePush; //进入方式
|
|
|
config.isPauseInBackGround = NO; //允许后台播放
|
|
|
|
|
|
// 初始化离线回放控制器
|
|
|
OfflinePlayBackViewController *offlineVC = [[OfflinePlayBackViewController alloc]initWithfileName:@"离线回放" offlineConfig:config];
|
|
|
offlineVC.delegate = self;
|
|
|
[self.navigationController pushViewController:offlineVC animated:YES];
|
|
|
}
|
|
|
|
|
|
- (void)initSucced:(HDSLoginSource)sourceType {
|
|
|
//登录成功
|
|
|
}
|
|
|
|
|
|
- (void)initFailed:(NSString *)message sourceType:(HDSLoginSource)sourceType {
|
|
|
//登录失败
|
|
|
}
|
|
|
```
|
|
|
|
|
|
代理方法
|
... | ... | |