|
|
[TOC]
|
|
|
|
|
|
# 云直播观看端SDK开发指南
|
|
|
|
|
|
|
|
|
# 1.概述
|
|
|
|
... | ... | @@ -53,25 +53,26 @@ |
|
|
**必须 ** 需在 Podfile 文件中添加以下代码(最新)
|
|
|
|
|
|
```shell
|
|
|
pod 'CCLivePlaySDK'
|
|
|
pod 'HDVideoClass_BSDK', '6.20.0'
|
|
|
pod 'CCLivePlaySDK', '4.9.0'
|
|
|
pod 'HDVideoClass_BSDK', '6.25.0'
|
|
|
pod 'HDSSZip'
|
|
|
pod 'HDSCocoaLumberjack'
|
|
|
pod 'AgoraRtcEngine_iOS', '3.4.8'
|
|
|
pod 'HDSAliyunPlayer'
|
|
|
pod 'HDSCocoaLumberjack', '4.9.0'
|
|
|
pod 'AgoraRtcEngine_iOS', '3.7.2'
|
|
|
pod 'HDSAliyunPlayer', '4.9.0'
|
|
|
pod 'HDStreamLib'
|
|
|
```
|
|
|
|
|
|
**可选**(互动组件)
|
|
|
|
|
|
```shell
|
|
|
pod 'HDSInteractionEngine'
|
|
|
pod 'HDSLikeModule'
|
|
|
pod 'HDSGiftModule'
|
|
|
pod 'HDSVoteModule'
|
|
|
pod 'HDSRedEnvelopeModule'
|
|
|
pod 'HDSInvitationCardModule'
|
|
|
pod 'HDSQuestionnaireModule'
|
|
|
pod 'HDSLiveStoreModule'
|
|
|
pod 'HDSInteractionEngine', '4.9.0'
|
|
|
pod 'HDSLikeModule', '4.9.0'
|
|
|
pod 'HDSGiftModule', '4.9.0'
|
|
|
pod 'HDSVoteModule', '4.9.0'
|
|
|
pod 'HDSRedEnvelopeModule', '4.9.0'
|
|
|
pod 'HDSInvitationCardModule', '4.9.0'
|
|
|
pod 'HDSQuestionnaireModule', '4.9.0'
|
|
|
pod 'HDSLiveStoreModule', '4.9.0'
|
|
|
```
|
|
|
|
|
|
|
... | ... | @@ -1585,6 +1586,484 @@ typedef void (^pullStreamFailedClosure)(HDSMediaCallError error); // 拉远端 |
|
|
|
|
|
## 3.6 问答功能
|
|
|
|
|
|
##### 问答支持发送图片权限开关(代理方法)
|
|
|
|
|
|
| 方法 | 说明 |
|
|
|
| ------------------------------ | -------------------- |
|
|
|
| (void)onQuestionPictureSwitch: | 问答支持图片开关权限 |
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
```objc
|
|
|
/// 4.9.0 new
|
|
|
/// 问答支持图片开关权限
|
|
|
/// @param QPSwitch 开关
|
|
|
- (void)onQuestionPictureSwitch:(NSInteger)QPSwitch;
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
##### 房间历史问答 (代理方法)(新增)
|
|
|
|
|
|
| 方法 | 说明 |
|
|
|
| ------------------ | ------------ |
|
|
|
| (void)onHistoryQA: | 房间历史问答 |
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
```objc
|
|
|
/// 4.9.0 new
|
|
|
/// 房间历史问答
|
|
|
/// @param model 问答model
|
|
|
- (void)onHistoryQA:(HDSHistoryQAModel * _Nullable)model;
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
###### HDSHistoryQAModel
|
|
|
|
|
|
| 参数 | 数据类型 | 说明 | 所在类 |
|
|
|
| --------- | ---------------------------- | ---------- | --------------------- |
|
|
|
| questions | Array [HDSQuestionModel] | 问题 | CCSDK/PlayParameter.h |
|
|
|
| answers | Array [HDSAnswererUserModel] | 答案 | CCSDK/PlayParameter.h |
|
|
|
| count | Integer | 问题总条数 | CCSDK/PlayParameter.h |
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
```objc
|
|
|
@interface HDSHistoryQAModel : NSObject
|
|
|
/// 问题
|
|
|
@property (nonatomic, strong) NSArray <HDSQuestionModel *>* _Nullable questions;
|
|
|
/// 答案
|
|
|
@property (nonatomic, strong) NSArray <HDSAnswererUserModel *>* _Nullable answers;
|
|
|
/// 问题总条数
|
|
|
@property (nonatomic, assign) NSUInteger count;
|
|
|
|
|
|
@end
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
###### HDSQuestionModel
|
|
|
|
|
|
| 参数 | 数据类型 | 说明 | 所在类 |
|
|
|
| ----------- | ---------------------- | -------------------------------- | --------------------- |
|
|
|
| id | String | 问题Id | CCSDK/PlayParameter.h |
|
|
|
| content | String | 提问内容 | CCSDK/PlayParameter.h |
|
|
|
| time | Integer | 提问时间(秒)(相对直播开始时间) | CCSDK/PlayParameter.h |
|
|
|
| triggerTime | String | 绝对时间 "yyyy-MM-dd HH:mm:ss" | CCSDK/PlayParameter.h |
|
|
|
| publish | Integer | 是否发布 0:不发布 1:发布 | CCSDK/PlayParameter.h |
|
|
|
| user | HDSQuestionerUserModel | 提问者 | CCSDK/PlayParameter.h |
|
|
|
| extar | HDSQAExtra | 文件 | CCSDK/PlayParameter.h |
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
```objc
|
|
|
@interface HDSQuestionModel : NSObject
|
|
|
|
|
|
/// id
|
|
|
@property (nonatomic, copy) NSString * _Nullable id;
|
|
|
/// 提问内容
|
|
|
@property (nonatomic, copy) NSString * _Nullable content;
|
|
|
/// 提问时间(秒)(相对直播开始时间)
|
|
|
@property (nonatomic, assign) NSUInteger time;
|
|
|
/// 绝对时间 "yyyy-MM-dd HH:mm:ss"
|
|
|
@property (nonatomic, copy) NSString * _Nullable triggerTime;
|
|
|
/// 是否发布 0:不发布 1:发布
|
|
|
@property (nonatomic, assign) NSUInteger publish;
|
|
|
/// 提问者
|
|
|
@property (nonatomic, strong) HDSQuestionerUserModel * _Nullable user;
|
|
|
/// 文件
|
|
|
@property (nonatomic, strong) HDSQAExtra * _Nullable extar;
|
|
|
|
|
|
@end
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
###### HDSQuestionerUserModel
|
|
|
|
|
|
| 参数 | 数据类型 | 说明 | 所在类 |
|
|
|
| ------- | -------- | ---------- | --------------------- |
|
|
|
| id | String | 提问者Id | CCSDK/PlayParameter.h |
|
|
|
| name | String | 提问者名称 | CCSDK/PlayParameter.h |
|
|
|
| avatar | String | 提问者头像 | CCSDK/PlayParameter.h |
|
|
|
| groupId | String | 提问者组 | CCSDK/PlayParameter.h |
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
```objc
|
|
|
@interface HDSQuestionerUserModel : NSObject
|
|
|
/// 提问者id
|
|
|
@property (nonatomic, copy) NSString * _Nullable id;
|
|
|
/// 提问者名称
|
|
|
@property (nonatomic, copy) NSString * _Nullable name;
|
|
|
/// 提问者头像
|
|
|
@property (nonatomic, copy) NSString * _Nullable avatar;
|
|
|
/// 提问者组
|
|
|
@property (nonatomic, copy) NSString * _Nullable groupId;
|
|
|
|
|
|
@end
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
###### HDSQAExtra
|
|
|
|
|
|
| 参数 | 数据类型 | 说明 | 所在类 |
|
|
|
| ---- | ----------------------- | -------- | --------------------- |
|
|
|
| img | Array [HDSQAExtraImage] | 图片数组 | CCSDK/PlayParameter.h |
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
```objc
|
|
|
@interface HDSQAExtra : NSObject
|
|
|
/// 图片数组
|
|
|
@property (nonatomic, strong) NSArray <HDSQAExtraImage *>* _Nullable img;
|
|
|
|
|
|
@end
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
###### HDSQAExtraImage
|
|
|
|
|
|
| 参数 | 数据类型 | 说明 | 所在类 |
|
|
|
| ----- | -------- | ---- | --------------------- |
|
|
|
| order | Integer | 序号 | CCSDK/PlayParameter.h |
|
|
|
| url | String | 地址 | CCSDK/PlayParameter.h |
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
```objc
|
|
|
@interface HDSQAExtraImage : NSObject
|
|
|
/// 序号
|
|
|
@property (nonatomic, assign) NSInteger order;
|
|
|
/// 地址
|
|
|
@property (nonatomic, copy) NSString * _Nullable url;
|
|
|
|
|
|
@end
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
###### HDSAnserModel
|
|
|
|
|
|
| 参数 | 数据类型 | 说明 | 所在类 |
|
|
|
| ----------- | ---------------------- | -------------------------------- | --------------------- |
|
|
|
| questionId | String | 问题ID | CCSDK/PlayParameter.h |
|
|
|
| content | String | 问答内容 | CCSDK/PlayParameter.h |
|
|
|
| time | Integer | 回答时间(秒)(相对直播开始时间) | CCSDK/PlayParameter.h |
|
|
|
| triggerTime | String | 绝对时间 "yyyy-MM-dd HH:mm:ss" | CCSDK/PlayParameter.h |
|
|
|
| isPrivate | Integer | 是否私聊 0:否 1:是 | CCSDK/PlayParameter.h |
|
|
|
| user | HDSQuestionerUserModel | 回答者 | CCSDK/PlayParameter.h |
|
|
|
| extar | HDSQAExtra | 文件 | CCSDK/PlayParameter.h |
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
```objc
|
|
|
@interface HDSAnserModel : NSObject
|
|
|
/// 问题ID
|
|
|
@property (nonatomic, copy) NSString * _Nullable questionId;
|
|
|
/// 问答内容
|
|
|
@property (nonatomic, copy) NSString * _Nullable content;
|
|
|
/// 回答时间(秒)(相对直播开始时间)
|
|
|
@property (nonatomic, assign) NSUInteger time;
|
|
|
/// 绝对时间 "yyyy-MM-dd HH:mm:ss"
|
|
|
@property (nonatomic, copy) NSString * _Nullable triggerTime;
|
|
|
/// 是否私聊 0:否 1:是
|
|
|
@property (nonatomic, assign) NSUInteger isPrivate;
|
|
|
/// 回答者
|
|
|
@property (nonatomic, strong) HDSAnswererUserModel * _Nonnull user;
|
|
|
/// 文件
|
|
|
@property (nonatomic, strong) HDSQAExtra * _Nullable extar;
|
|
|
|
|
|
@end
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
###### HDSAnswererUserModel
|
|
|
|
|
|
| 参数 | 数据类型 | 说明 | 所在类 |
|
|
|
| ------- | -------- | ---------- | --------------------- |
|
|
|
| id | String | 提问者Id | CCSDK/PlayParameter.h |
|
|
|
| name | String | 提问者名称 | CCSDK/PlayParameter.h |
|
|
|
| role | String | 回答者角色 | CCSDK/PlayParameter.h |
|
|
|
| avatar | String | 提问者头像 | CCSDK/PlayParameter.h |
|
|
|
| groupId | String | 提问者组 | CCSDK/PlayParameter.h |
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
```objc
|
|
|
@interface HDSAnswererUserModel : NSObject
|
|
|
|
|
|
/// 回答者id
|
|
|
@property (nonatomic, copy) NSString * _Nullable id;
|
|
|
/// 回答者名称
|
|
|
@property (nonatomic, copy) NSString * _Nullable name;
|
|
|
/// 回答者角色
|
|
|
@property (nonatomic, copy) NSString * _Nullable role;
|
|
|
/// 回答者头像
|
|
|
@property (nonatomic, copy) NSString * _Nullable avatar;
|
|
|
/// 回答者组
|
|
|
@property (nonatomic, copy) NSString * _Nullable groupId;
|
|
|
|
|
|
@end
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
##### 房间历史问答 (代理方法)(改动)
|
|
|
|
|
|
| 方法 | 说明 |
|
|
|
| --------------------------------- | ------------------------------------------------------------ |
|
|
|
| (void)onQuestionArr: onAnswerArr: | 收到提问&回答,在用户登录之前,主讲和其他用户的历史互动问答信息 (会多次回调) |
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
```objc
|
|
|
/**
|
|
|
* @brief 收到提问&回答,在用户登录之前,主讲和其他用户的历史互动问答信息 (会多次回调)
|
|
|
*/
|
|
|
- (void)onQuestionArr:(NSArray *)questionArr onAnswerArr:(NSArray *)answerArr {
|
|
|
questionArr = [{
|
|
|
"content" = "";
|
|
|
"encryptId" = "";
|
|
|
"groupId" = "";
|
|
|
"id" = "";
|
|
|
"isPublish" = (0);
|
|
|
"questionUserAvatar" = "";
|
|
|
"questionUserId" = "";
|
|
|
"questionUserName" = "";
|
|
|
"time" = (0);
|
|
|
"triggerTime" = "";
|
|
|
新增字段 --> "extra" = {"img":[{
|
|
|
"order":0,
|
|
|
"url":""
|
|
|
}]
|
|
|
};
|
|
|
}]
|
|
|
|
|
|
answerArr = [{
|
|
|
"content" = "";
|
|
|
"encryptId"= "";
|
|
|
"groupId" = "";
|
|
|
"id" = "";
|
|
|
"isPrivate" = (0);
|
|
|
"answerUserAvatar" = "";
|
|
|
"answerUserId" = "";
|
|
|
"answerUserName" = "";
|
|
|
"time" = (0);
|
|
|
"triggerTime" = "";
|
|
|
"answerUserRole" = "";
|
|
|
新增字段 --> "extra" = {"img":[{
|
|
|
"order":0,
|
|
|
"url":""
|
|
|
}]
|
|
|
};
|
|
|
}]
|
|
|
}
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
##### 收到提问(代理方法)(改动)
|
|
|
|
|
|
| 方法 | 说明 |
|
|
|
| -------------------- | ---------------------------------------- |
|
|
|
| (void)onQuestionDic: | 收到提问,用户观看时和主讲的互动问答信息 |
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
```objc
|
|
|
/**
|
|
|
* @brief 收到提问,用户观看时和主讲的互动问答信息
|
|
|
*/
|
|
|
- (void)onQuestionDic:(NSDictionary *)questionDic {
|
|
|
questionDic = {
|
|
|
"content" = "";
|
|
|
"groupId" = "";
|
|
|
"id" = "";
|
|
|
"userAvatar" = "";
|
|
|
"userId" = "";
|
|
|
"userName" = "";
|
|
|
"triggerTime" = "";
|
|
|
新增字段 --> "extra" = {"img":[{
|
|
|
"order":0,
|
|
|
"url":""
|
|
|
}]
|
|
|
};
|
|
|
}
|
|
|
}
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
##### 收到回答(代理方法)(改动)
|
|
|
|
|
|
| 方法 | 说明 |
|
|
|
| ------------------ | ---------------------------------------- |
|
|
|
| (void)onAnswerDic: | 收到回答,用户观看时和主讲的互动问答信息 |
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
```objc
|
|
|
/**
|
|
|
* @brief 收到回答,用户观看时和主讲的互动问答信息
|
|
|
*/
|
|
|
- (void)onAnswerDic:(NSDictionary *)answerDic {
|
|
|
answerDic = {
|
|
|
"content" = "";
|
|
|
"groupId" = "";
|
|
|
"isPrivate" = 0;
|
|
|
"questionId" = "";
|
|
|
"questionUserId" = "";
|
|
|
"triggerTime" = "";
|
|
|
"userAvatar" = "";
|
|
|
"userId" = "";
|
|
|
"userName" = "";
|
|
|
"userRole" = "";
|
|
|
新增字段 --> "extra" = {"img":[{
|
|
|
"order":0,
|
|
|
"url":""
|
|
|
}]
|
|
|
};
|
|
|
}
|
|
|
}
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
##### 提交问答(主动方法)
|
|
|
|
|
|
| 方法 | 说明 |
|
|
|
| ------------------------------------------ | -------- |
|
|
|
| (void)commitQuestion: imageArray: closure: | 提交问答 |
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
```objc
|
|
|
/// 4.9.0 new
|
|
|
/// 提交问答
|
|
|
/// @param questionText 问答信息(不可为空)
|
|
|
/// @param imageArray 图片数据(可为空)
|
|
|
/// @param closure 回调
|
|
|
- (void)commitQuestion:(NSString * _Nonnull)questionText
|
|
|
imageArray:(NSArray <HDSCommitImageModel *>* _Nullable)imageArray
|
|
|
closure:(void(^_Nullable)(BOOL succed, NSString * _Nonnull message, NSArray <HDSUploadErrorModel *>* _Nullable failedArray))closure;
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
###### HDSCommitImageModel
|
|
|
|
|
|
| 参数 | 数据类型 | 说明 | 所在类 |
|
|
|
| -------- | -------- | -------- | --------------------- |
|
|
|
| name | String | 文件名 | CCSDK/PlayParameter.h |
|
|
|
| order | Integer | 序号 | CCSDK/PlayParameter.h |
|
|
|
| size | Integer | 文件大小 | CCSDK/PlayParameter.h |
|
|
|
| type | String | 文件类型 | CCSDK/PlayParameter.h |
|
|
|
| fullPath | String | 文件路径 | CCSDK/PlayParameter.h |
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
```objc
|
|
|
/// 文件名
|
|
|
@property (nonatomic, copy) NSString * _Nonnull name;
|
|
|
/// 序号
|
|
|
@property (nonatomic, assign) NSUInteger order;
|
|
|
/// 文件大小
|
|
|
@property (nonatomic, assign) NSUInteger size;
|
|
|
/// 文件类型
|
|
|
@property (nonatomic, copy) NSString * _Nonnull type;
|
|
|
/// 文件路径
|
|
|
@property (nonatomic, copy) NSString * _Nonnull fullPath;
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
###### HDSUploadErrorModel
|
|
|
|
|
|
| 参数 | 数据类型 | 说明 | 所在类 |
|
|
|
| ------- | -------- | -------- | --------------------- |
|
|
|
| order | Integer | 序号 | CCSDK/PlayParameter.h |
|
|
|
| name | String | 文件名 | CCSDK/PlayParameter.h |
|
|
|
| message | String | 错误信息 | CCSDK/PlayParameter.h |
|
|
|
| code | Integer | 错误码 | CCSDK/PlayParameter.h |
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
```objc
|
|
|
@interface HDSUploadErrorModel : NSObject
|
|
|
/// 序号
|
|
|
@property (nonatomic, assign) NSInteger order;
|
|
|
/// 文件名
|
|
|
@property (nonatomic, copy) NSString * _Nullable name;
|
|
|
/// 错误信息
|
|
|
@property (nonatomic, copy) NSString * _Nullable message;
|
|
|
/// 错误码
|
|
|
@property (nonatomic, assign) NSInteger code;
|
|
|
|
|
|
@end
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
##### 错误原因
|
|
|
|
|
|
| 错误值 | 说明 |
|
|
|
| ---------------------------------- | ---------------------------------------------------- |
|
|
|
| ERROR_HISTORY_QUESTION_ANSWER_LIST | 获取房间历史问答列表失败 |
|
|
|
| ERROR_NOT_LIVING | 请在直播中发送问答 |
|
|
|
| ERROR_TEMPLATE_INVALID | 房间不支持问答 |
|
|
|
| ERROR_DEBOUNCE | 操作太频繁了,休息一下吧 |
|
|
|
| ERROR_CONTENT_EMPTY | 请输入内容,内容不可为空 |
|
|
|
| ERROR_CONTENT_INVALID | 请输入内容,并保证长度小于1000 |
|
|
|
| ERROR_IMG_NUMBER_INVALID | 最多只能发送6张图片 |
|
|
|
| ERROR_FILE_INVALID | 图片文件校验失败,包括文件不存在、接口返回文件不合法 |
|
|
|
| ERROR_REQUEST_FAILED | 请求失败,请检查网络 |
|
|
|
| ERROR_FILE_UPLOAD_FAILED | 图片文件上传失败,请重试 |
|
|
|
| ERROR_FILE_LARGE | 图片过大,请上传小于20M的图片 |
|
|
|
| ERROR_FILE_TYPE_SUPPORTED | 格式不支持,请选择 JPG、PNG、JPED、BMP格式的图片 |
|
|
|
| ERROR_FILE_PARAMETER | 参数错误,请稍后重试,或联系客服 |
|
|
|
| ERROR_FILE_LOGIN_FAILED | 登陆异常,请重新登陆或者刷新后重试 |
|
|
|
| ERROR_FILE_NOT_EXISTS | 图片文件不存在,请重试 |
|
|
|
| FILE_UPLOAD_SUCCED | 图片文件上传成功 |
|
|
|
| COMMIT_QUESTION_SUCCED | 问答提交成功 |
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
```objc
|
|
|
ERROR_HISTORY_QUESTION_ANSWER_LIST,//获取房间历史问答列表失败
|
|
|
ERROR_NOT_LIVING, //请在直播中发送问答
|
|
|
ERROR_TEMPLATE_INVALID, //房间不支持问答
|
|
|
ERROR_DEBOUNCE, //操作太频繁了,休息一下吧
|
|
|
ERROR_CONTENT_EMPTY, //请输入内容,内容不可为空
|
|
|
ERROR_CONTENT_INVALID, //请输入内容,并保证长度小于1000
|
|
|
ERROR_IMG_NUMBER_INVALID, //最多只能发送6张图片
|
|
|
ERROR_FILE_INVALID, //图片文件校验失败,包括文件不存在、接口返回文件不合法
|
|
|
ERROR_REQUEST_FAILED, //请求失败,请检查网络
|
|
|
ERROR_FILE_UPLOAD_FAILED, //图片文件上传失败,请重试
|
|
|
ERROR_FILE_LARGE, //图片过大,请上传小于20M的图片
|
|
|
ERROR_FILE_TYPE_SUPPORTED, //格式不支持,请选择 JPG、PNG、JPED、BMP格式的图片
|
|
|
ERROR_FILE_PARAMETER, //参数错误,请稍后重试,或联系客服
|
|
|
ERROR_FILE_LOGIN_FAILED, //登陆异常,请重新登陆或者刷新后重试
|
|
|
ERROR_FILE_NOT_EXISTS, //图片文件不存在,请重试
|
|
|
FILE_UPLOAD_SUCCED, //图片文件上传成功
|
|
|
COMMIT_QUESTION_SUCCED, //问答提交成功
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
代理方法(可选)
|
|
|
|
|
|
```objc
|
... | ... | @@ -3099,6 +3578,151 @@ typedef NS_ENUM(NSUInteger, HDSMediaLoadState) { |
|
|
|
|
|
|
|
|
|
|
|
## 3.27 自定义表情
|
|
|
|
|
|
#### 聊天支持自定义表情
|
|
|
|
|
|
##### 房间是否拥有自定义表情使用权限
|
|
|
|
|
|
| 方法 | 说明 |
|
|
|
| ---------------------------- | ------------------------------------------------------------ |
|
|
|
| (BOOL)hasEmojisUsePermission | 房间是否拥有自定义表情使用权限(房间有聊天模版 + 自定义表情开关打开) |
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
```objc
|
|
|
/**
|
|
|
* @brief 房间是否拥有自定义表情使用权限(房间有聊天模版 + 自定义表情开关打开)
|
|
|
*/
|
|
|
+ (BOOL)hasEmojisUsePermission;
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
##### 每个聊天表情对应的key的集合
|
|
|
|
|
|
| 方法 | 说明 |
|
|
|
| -------------------- | --------------------------- |
|
|
|
| (NSArray *)emojiKeys | 每个聊天表情对应的key的集合 |
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
```objc
|
|
|
/**
|
|
|
* @brief 每个聊天表情对应的key的集合
|
|
|
*/
|
|
|
+ (NSArray *)emojiKeys;
|
|
|
|
|
|
Example code:
|
|
|
(lldb) po [RequestData emojiKeys]
|
|
|
<__NSFrozenArrayM 0x11fd8bde0>(
|
|
|
[大笑],
|
|
|
[哭],
|
|
|
[白眼],
|
|
|
[啊],
|
|
|
[卖萌],
|
|
|
[晕],
|
|
|
[可怜],
|
|
|
[无语],
|
|
|
[愤怒],
|
|
|
[色]
|
|
|
)
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
##### 聊天表情对应plist文件配置表
|
|
|
|
|
|
| 方法 | 说明 |
|
|
|
| -------------------------- | --------------------------- |
|
|
|
| (NSArray *)emojisPlistInfo | 聊天表情对应plist文件配置表 |
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
```objc
|
|
|
/**
|
|
|
* @brief 聊天表情对应plist文件配置表
|
|
|
*/
|
|
|
+ (NSArray *)emojisPlistInfo;
|
|
|
|
|
|
Example code:
|
|
|
(lldb) po [RequestData emojisPlistInfo]
|
|
|
<__NSArrayI 0x119ad16d0>(
|
|
|
{
|
|
|
img = "https://cclivematerial.oss-cn-beijing.aliyuncs.com/image/41A6BAB5115465D1/1678179715016_48_1847987378_%E6%99%95.png";
|
|
|
name = "[大笑]";
|
|
|
},
|
|
|
{
|
|
|
img = "https://cclivematerial.oss-cn-beijing.aliyuncs.com/image/41A6BAB5115465D1/1678179674548_24_1542554140_%E5%93%AD.png";
|
|
|
name = "[哭]";
|
|
|
}
|
|
|
)
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
##### 根据表情name获取本地缓存表情image (如果该表情加载失败,会提供占位图)
|
|
|
|
|
|
| 方法 | 说明 |
|
|
|
| ------------------------------ | ------------------------------------------------------------ |
|
|
|
| (UIImage *)emojiCachedForName: | 根据表情name获取本地缓存表情image (如果该表情加载失败,会提供占位图) |
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
```objc
|
|
|
/**
|
|
|
* @brief 根据表情name获取本地缓存表情image (如果该表情加载失败,会提供占位图)
|
|
|
*/
|
|
|
+ (UIImage *)emojiCachedForName:(NSString *)emojiName;
|
|
|
|
|
|
Example code:
|
|
|
(lldb) po [RequestData emojiCachedForName:@"[大笑]"]
|
|
|
<UIImage: 0x11ff91870>, {27, 27}
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
##### 检查自定义聊天表情是否加载完成 (如果加载失败,会再次触发加载逻辑)
|
|
|
|
|
|
| 方法 | 说明 |
|
|
|
| ------------------------- | ------------------------------------------------------------ |
|
|
|
| (BOOL)isEmojiLoadComplete | 检查自定义聊天表情是否加载完成 (如果加载失败,会再次触发加载逻辑) |
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
```objc
|
|
|
/**
|
|
|
* @brief 检查自定义聊天表情是否加载完成 (如果加载失败,会再次触发加载逻辑)
|
|
|
*/
|
|
|
- (BOOL)isEmojiLoadComplete;
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
##### 自定义表情加载回调监听
|
|
|
|
|
|
| 方法 | 说明 |
|
|
|
| --------------------------- | -------------------------- |
|
|
|
| (void)onEmojiLoadingResult: | 自定义聊天表情加载状态回调 |
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
```objc
|
|
|
/**
|
|
|
* @brief 自定义聊天表情加载状态回调
|
|
|
*/
|
|
|
- (void)onEmojiLoadingResult:(BOOL)result message:(NSString *)message;
|
|
|
|
|
|
|
|
|
Example code:
|
|
|
|
|
|
- (void)onEmojiLoadingResult:(BOOL)result message:(NSString *)message {
|
|
|
NSLog(@"%s--%d--%@",__func__,result,message);
|
|
|
}
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 4.常见问题
|
... | ... | |