观看协议
接入步骤
#import <VHLiveSDK/VHWebinarInfo.h>
接口列表
接口名称 | 接口说明 |
---|---|
fetchViewProtocol | 获取观看协议 |
agreeViewProtocol | 同意观看协议 |
获取观看协议
+ (void)fetchViewProtocol:(NSString *)webinarId
success:(void(^)(VHViewProtocolModel *protocolModel))success
fail:(void(^)(NSError *error))fail;
| --------- | ---------- | --------- | ------- | --- |
| webinarId | 是 | 234700561 | 活动 id |
| success | 返回数据类 | | |
| fail | 返回数据类 | | | |
参数名称 | 备注 |
---|---|
is_agree | 用户协议是否同意 0:未同意,1:同意 |
is_open | 观看协议开关 0:关闭,1:打开 |
title | 观看协议标题 |
content | 观看协议内容 |
rule | 协议规则 0:强制 1:非强制 |
statement_status | 声明状态 0:关 1:开 |
statement_content | 协议提示内容 |
statement_info | 协议介绍 |
[VHWebinarBaseInfo fetchViewProtocol:watchActivityID success:^(VHViewProtocolModel * _Nonnull protocolModel)
{
if (protocolModel.is_agree == 1) {
// 如果同意则直接进行播放
return;
}
if (protocolModel.is_open == 1) {
// 开启观看协议,则弹出对应的协议内容,包含title、content、状态等等
// protocolModel.title、protocolModel.content...
}else{
//未开启观看协议,直接进行播放
}
} fail:^(NSError * _Nonnull error) {
// 弹出错误提示
}];
同意观看协议
+ (void)agreeViewProtocol:(NSString *)webinarId
success:(void(^)(void))success
fail:(void(^)(NSError *error))fail;
| --------- | ---------- | --------- | ------- | --- |
| webinarId | 是 | 234700561 | 活动 id |
| success | 返回数据类 | | |
| fail | 返回数据类 | | | |
| ------------------ | ---- | --- |
| 请求成功无返回数据 | | |
[VHWebinarBaseInfo agreeViewProtocol:watchActivityID success:^{
// 直接进行播放
} fail:^(NSError * _Nonnull error){
// 弹出错误提示
VH_ShowToast(error.localizedDescription);
}];
修改于 2025-05-27 11:59:31