@interface ByteWhiteBoard : NSObject
ByteWhiteBoard 类包含应用程序调用的主要方法。
| 返回 | 名称 |
|---|---|
| int | updateByteWhiteBoardDelegate: |
| NSInteger | getWhiteBoardID |
| NSString* | getCurrentPageID |
| NSString* | getWhiteBoardRoomID |
| int | hideDrawing: |
| int | setEditMode: |
| int | setEditType: |
| int | setPenSize: |
| int | setPenColor: |
| int | setShapeWidth: |
| int | setShapeColor: |
| int | setTextFontSize: |
| int | setTextColor: |
| int | undo |
| int | redo |
| int | clearPage |
| int | flipPage: |
| int | createPage:config:isAutoFlip: |
| int | createMultiPages:configs:isAutoFlip: |
| int | changePageBackgroundWhitPageID:bkInfo: |
| int | changeWholeBoardBackgroundWhitBkInfo: |
| ByteWhiteBoardPageInfo* | getCurrentPageInfo |
| NSArray |
GetAllPageInfo |
| NSInteger | getCurrentPageIndex |
| NSInteger | GetAllPagesCount |
| NSInteger | GetPageIndexWhitPageId: |
| ByteWhiteBoardPageInfo* | getPageInfoWhitIndex: |
| int | removePage: |
| int | bindToWindow: |
| int | bindToWindowWithConfig: |
| int | unbindFromWindow |
| int | SetMediaSyncTimestamp: |
- (int)updateByteWhiteBoardDelegate:(id<ByteWhiteBoardDelegate>)delegate;
设置事件回调
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| delegate | id |
事件回调 |
返回值
调用结果
0: 成功
- (NSInteger)getWhiteBoardID;
获取当前白板的ID
返回值 白板ID
- (NSString*)getCurrentPageID;
获取当前白板的PageID
返回值 PageID
- (NSString*)getWhiteBoardRoomID;
获取当前白板的房间号
返回值 房间号
- (int)hideDrawing:(BOOL)ishide;
设置是否隐藏白板
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| ishide | BOOL | 当前白板是否隐藏 |
返回值
调用结果
0: 成功
- (int)setEditMode:(ByteWhiteBoardEditMode)mode;
设置当前白板是否可以编辑
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| mode | ByteWhiteBoardEditMode | 当前白板的编辑模式,详见 ByteWhiteBoardEditMode |
返回值
调用结果
0: 成功
- (int)setEditType:(ByteWhiteBoardShapeType)shapeType;
设置动作类型
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| ByteWhiteBoardShapeType | **** | shapeType 画笔的类型,详见 ByteWhiteBoardShapeType |
返回值 调用结果
- (int)setPenSize:(NSInteger)size;
设置画笔笔迹宽度
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| size | NSInteger | 笔迹宽度,单位为画布宽度的万分之一 |
返回值
调用结果
0: 成功
- (int)setPenColor:(UIColor *)color;
设置画笔颜色
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| color | UIColor* | 格式为 ARGB_8888 |
返回值
调用结果
0: 成功
- (int)setShapeWidth:(NSInteger)width;
设置形状线条宽度
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| width | NSInteger | 形状线条宽度,单位为画布宽度的万分之一 |
返回值
调用结果
0: 成功
- (int)setShapeColor:(UIColor*)color;
设置图形边框颜色
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| color | UIColor* | 颜色,格式为 ARGB_8888 |
返回值
调用结果
0: 成功
- (int)setTextFontSize:(NSInteger)size;
设置文本字号大小
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| size | NSInteger | 文字的高度,单位为画布高的万分之一 |
返回值
调用结果
0: 成功
- (int)setTextColor:(UIColor*)color;
设置文本颜色
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| color | UIColor* | 颜色,格式为 ARGB_8888 |
返回值
调用结果
0: 成功
- (int)undo;
撤销
当 byteWhiteBoard:onCanUndoStateChanged: 返回的状态为 false 时,调用本接口无效。
返回值
调用结果
0: 成功
- (int)redo;
重做
当 byteWhiteBoard:onCanRedoStateChanged: 返回的状态为 false 时,调用本接口无效。
返回值
调用结果
0: 成功
- (int)clearPage;
清空白板
调用成功后在房间内所有客户端触发 byteWhiteBoardClearPage:
返回值
调用结果
0: 成功
- (int)flipPage:(NSString*)pageID;
白板翻页
调用成功后在房间内所有客户端触发 byteWhiteBoard:onPageIndexChanged:pageInfo:
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| pageID | NSString* | 目标页id |
返回值
调用结果
0: 成功
- (int)createPage:(NSString* _Nullable)prePageID config:(ByteWhiteBoardPageInfo*)info isAutoFlip:(BOOL)autoFlip;
新建白板页
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| prePageID | NSString* | 新增白板页的前向页,即新增的白板页将插在prePageID之后,如果prePageID==nil,则插到开头 |
| info | ByteWhiteBoardPageInfo* | 白板页的配置 |
| autoFlip | BOOL | 是否自动翻页 |
返回值
调用结果
0: 成功
- (int)createMultiPages:(NSString *)prePageID configs:(NSArray<ByteWhiteBoardPageInfo*> *)infos isAutoFlip:(BOOL)autoFlip;
新建多个白板页
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| prePageID | NSString* | 新增白板页的前向页,即新增的白板页将插在prePageID之后,如果prePageID==nil,则插到开头 |
| infos | NSArray |
白板页的配置,新增白板页个数和infos配置的个数相同 |
| autoFlip | BOOL | 是否自动翻页 |
返回值
调用结果
0: 成功
- (int)changePageBackgroundWhitPageID:(NSString*)pageID bkInfo:(ByteWhiteBoardBackgroundInfo*)info;
修改白板页背景
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| info | ByteWhiteBoardBackgroundInfo* | 修改参数 |
返回值
调用结果
0: 成功
- (int)changeWholeBoardBackgroundWhitBkInfo:(ByteWhiteBoardBackgroundInfo*)info;
修改整个board的所有页的背景
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| info | ByteWhiteBoardBackgroundInfo* | 修改参数 |
返回值
调用结果
0: 成功
- (ByteWhiteBoardPageInfo*)getCurrentPageInfo;
获取当前页面信息
返回值 白板页信息,详见 ByteWhiteBoardPageInfo
- (NSArray<ByteWhiteBoardPageInfo*>*)GetAllPageInfo;
获取所有页面信息
返回值 白板页信息,详见 ByteWhiteBoardPageInfo
- (NSInteger)getCurrentPageIndex;
获取当前页面索引
返回值 索引
- (NSInteger)GetAllPagesCount;
获取白板总页数
返回值 总数
- (NSInteger)GetPageIndexWhitPageId:(NSString*)pageID;
获取白板页所在索引号
返回值 索引
- (ByteWhiteBoardPageInfo*)getPageInfoWhitIndex:(NSInteger)index;
通过索引号获取白板页信息
返回值 白板信息
- (int)removePage:(NSArray<NSString*>*)pageIDs;
删除白板页
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| pageIDs | NSArray |
待删除的id |
返回值
调用结果
0: 成功
- (int)bindToWindow:(UIView *)view;
把画板UI绑定到某个view上
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| view | UIView* | 视图 |
返回值
调用结果
0: 成功
- (int)bindToWindowWithConfig:(ByteWhiteBoardWindowConfig*)config;
把画板UI绑定到某个view上
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| config | ByteWhiteBoardWindowConfig* | 详见 ByteWhiteBoardWindowConfig |
返回值
调用结果
0: 成功
- (int)unbindFromWindow;
取消画板UI绑定
返回值
调用结果
0: 成功
- (int)SetMediaSyncTimestamp:(int64_t)timestamp;
设置同步时间戳
返回值
调用结果
0: 成功
@interface ByteWhiteBoardRoom : NSObject
ByteWhiteBoardRoom 接口
| 返回 | 名称 |
|---|---|
| void | updateByteWhiteBoardRoomDelegate: |
| NSString* | getRoomID |
| void | joinRoom |
| void | leaveRoom |
| int | destroyWhiteBoard: |
| ByteWhiteBoard* | getWhiteBoardByID: |
| void | closeAllWhiteBoard |
| void | startPlaybackWhiteBoard |
| void | pausePlaybackWhiteBoard |
| void | stopPlaybackWhiteBoard |
| int | setPlaybackWhiteBoardProgress: |
- (void)updateByteWhiteBoardRoomDelegate:(id<ByteWhiteBoardRoomDelegate>)delegate;
更新回调手柄
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| delegate | id |
回调手柄 |
- (NSString *)getRoomID;
获得当前WhiteBoardRoom的房间ID
返回值 房间ID
- (void)joinRoom;
进房
调用后,本端触发 byteWhiteBoardRoom:onJoinRoomResult:userID:errCode:isRejoin: 回调调用结果。
房间内首个用户进房成功后自动创建白板 并触发 byteWhiteBoardRoom:onWhiteBoardCreated:elapsed: 回调。
进房成功后,远端触发 byteWhiteBoardRoom:onUserCountChanged: 房间内人数回调。
- (void)leaveRoom;
退房
调用后,本端触发 byteWhiteBoardRoom:onLeaveRoomResult:reason: 回调调用结果。
退房成功后,远端触发 byteWhiteBoardRoom:onUserCountChanged: 房间内人数回调。
- (int)destroyWhiteBoard:(ByteWhiteBoard *)board;
销毁白板 WhiteBoard
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| board | ByteWhiteBoard* | 待销毁白板。详见 ByteWhiteBoard |
- (ByteWhiteBoard *)getWhiteBoardByID:(NSInteger)boardID;
通过白板ID获取白板对象
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| boardID | NSInteger | 白板ID |
返回值 白板对象 (可能为nil)
- (void)closeAllWhiteBoard;
关闭所有白板,重进房间后无法进行写画 白板创建后自动录制。调用本接口关闭白板以后可以开始播放录像。 录像回放路径 ./AppData/Library/Caches
- (void)startPlaybackWhiteBoard;
开始播放白板录像
成功调用后,触发 byteWhiteBoardRoom:onPlaybackWhiteBoardStateChanged:errCode: 播放状态回调。
- (void)pausePlaybackWhiteBoard;
暂停播放白板录像
成功调用后,触发 byteWhiteBoardRoom:onPlaybackWhiteBoardStateChanged:errCode: 播放状态回调。
- (void)stopPlaybackWhiteBoard;
停止播放白板录像
成功调用后,触发 byteWhiteBoardRoom:onPlaybackWhiteBoardStateChanged:errCode: 播放状态回调。
- (int)setPlaybackWhiteBoardProgress:(NSInteger)progress;
设置白板回放进度
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| progress | NSInteger | 白板录像播放进度,单位 s |
返回值
调用结果
0: 成功
@interface ByteWhiteBoardRoomManager : NSObject
白板房间管理接口
| 返回 | 名称 |
|---|---|
| instancetype | sharedEngineWithAppId:delegate: |
| void | destroy |
| void | setDeviceID: |
| void | setLogLocation: |
| void | setCacheLocation: |
| void | setAid: |
| 返回 | 名称 |
|---|---|
| void | updateByteWhiteBoardRoomManagerDelegate: |
| ByteWhiteBoardRoom* | createWhiteBoardRoom:userID:token:delegate: |
| void | destroyWhiteBoardRoom: |
| ByteWhiteBoardRoom* | getWhiteBoardRoom: |
| void | enableMediaTimeSync: |
+ (instancetype)sharedEngineWithAppId:(NSString *)appId delegate:(id<ByteWhiteBoardRoomManagerDelegate>)delegate;
创建白板 ByteWhiteBoardRoomManager 单例对象
+ (void)destroy;
销毁白板 ByteWhiteBoardRoomManager 单例对象
+ (void)setDeviceID:(NSString*)deviceID;
设置设备id
+ (void)setLogLocation:(NSString*)path;
设置本地日志缓存路径
注意 不主动设置,默认为APP目录 Library/Caches
+ (void)setCacheLocation:(NSString*)path;
设置数据缓存路径
注意 不主动设置,默认为APP目录 Library/Caches
+ (void)setAid:(NSString*)aid;
设置App ID
注意 用于标识APP,例如 slardar对应的aid
- (void)updateByteWhiteBoardRoomManagerDelegate:(id<ByteWhiteBoardRoomManagerDelegate>)delegate;
更新 ByteWhiteBoardRoomManager 的delegate
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| delegate | id |
- (ByteWhiteBoardRoom *)createWhiteBoardRoom:(NSString *)roomID userID:(NSString*)userID token:(NSString*)token delegate:(id<ByteWhiteBoardRoomDelegate>)delegate;
创建白板 WhiteBoardRoom
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| userID | NSString* | 用户ID |
| roomID | NSString* | 房间ID |
| token | NSString* | |
| delegate | id |
白板房间事件回调 |
返回值 白板房间对象。参数校验失败时返回空的实例
- (void)destroyWhiteBoardRoom:(ByteWhiteBoardRoom *)boardRoom;
销毁白板房间 WhiteBoardRoom
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| boardRoom | ByteWhiteBoardRoom* | 待销毁白板。详见 ByteWhiteBoardRoom |
- (ByteWhiteBoardRoom *)getWhiteBoardRoom:(NSString *)roomID;
通过房间 ID 获取白板房间对象
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| roomID | NSString* | 白板ID |
返回值 白板房间对象 (可能为nil)
- (void)enableMediaTimeSync:(BOOL)enable;
开启媒体同步功能
传入参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| enable | BOOL | 功能开关 |
注意 只有作为参考的主动同步对象才需要调用该接口,调用后 会通过 byteWhiteBoardRoomManager:onMediaSyncTimestamp: 回调时间戳,回调的时间戳需要传递给被动同步的对象