文档 & 白板
VHCDocuments是微吼课堂SDK文档&白板管理类,该类提供了文档和白板的添加、切换等功能。使用此模块功能时,请先确保当前已进入课堂!
初始化
VHCDocumentsType | 说明 |
---|---|
VHCDocumentsType_Live | 直播 |
VHCDocumentsType_VOD | 点播 |
VHCDocEventType | 说明 |
---|---|
VHCDocEventType_Flip | ppt翻页 |
VHCDocEventType_Paint_Doc | ppt画笔 |
VHCDocEventType_Paint_Board | 白板画笔 |
VHCDocEventType_Over | 关闭文档 |
1、文档事件回调协议
@protocol VHCDocumentsDelegate <NSObject>
@optional
//文档事件回调
- (void)documents:(VHCDocuments *)doc docEventType:(VHCDocEventType)type;
@end
2、文档数据获取回调协议
直播时需传入播放器缓存时间进行文档和画面同步
@protocol VHCDocumentsDataSource <NSObject>
/**
直播时使用文档需要实现该数据源,传入直播播放器的实际延迟时间,作用是文档和视频同步。
注意单位:秒
*/
- (float)documentsForLiveRealBufferTime:(VHCDocuments *)doc;
@end
3、初始化、销毁及代理设置
- (instancetype)initWithType:(VHCDocumentsType)type delegate:(id <VHCDocumentsDelegate>)delegate dataSource:(id <VHCDocumentsDataSource>)dataSource;
- (void)destoryDocments;
@property (nonatomic, weak) id <VHCDocumentsDataSource> dataSource;
@property (nonatomic, weak) id <VHCDocumentsDelegate> delegate;
文档&白板 View
/**
@brief 文档&白板父视图view。
*/
@property (nonatomic, strong, readonly) UIView *documentDrawView;
文档&白板 frame 设置
/**
更新view的 frame
*/
- (void)docFrame:(CGRect)docFrame;
按时间查询回放文档绘制信息
/**
@brief 回放 按时间查询绘制信息
time 查询时间
isSeek 是否seek time 之前全部信息 否则返回 time之前一秒的信息
*/
- (void)queryTime:(CGFloat)time seek:(BOOL)isSeek;
是否可以绘制 收到授权画笔信息时设置
#pragma mark - 画笔
/*
* 是否可以编辑 作为发起端 默认NO 不可编辑
*/
@property (nonatomic, assign) BOOL editEnable;
绘制命令类型
VHCDrawAction | 说明 |
---|---|
VHCDrawAction_Add | 添加画板元素 设置 VHDrawType 时会自动设置为此选项 |
VHCDrawAction_Modify | 选择后修改 画板元素 |
VHCDrawAction_Delete | 删除画板元素 |
/*
* 绘制命令类型
*/
- (void)setDrawAction:(int)drawAction;
绘制类型
VHCDrawType | 说明 |
---|---|
VHCDrawType_Pen | 画笔 |
VHCDrawType_Highlighter | 荧光笔 |
VHCDrawType_Rectangle | 矩形 |
VHCDrawType_Circle | 圆 |
VHCDrawType_Arrow | 箭头 此版本暂不支持 |
VHCDrawType_Text | 文字 此版本暂不支持 |
VHCDrawType_Image | 图片 此版本暂不支持 |
VHCDrawType_Isosceles_Triangle | 等腰三角形 |
VHCDrawType_right_Triangle | 直角三角形 |
VHCDrawType_Single_Arrow | 单箭头 |
VHCDrawType_Double_Arrow | 双箭头 |
/*
* 绘制类型
* 注意:设置此参数时 editType 自动设置为 VHEditType_Add 模式
*/
- (void)setDrawType:(int)drawType;
设置绘制图形颜色
/*
* 设置绘制图形颜色
*/
- (void)setDrawColor:(UIColor*)color;
设置绘制图形线宽
/*
* 设置绘制图形线宽
*/
- (void)setDrawLineWidth:(NSInteger)size;
文档和白板的使用比较简单,如果用户需要添加自定义视图,可以添加view的方式来实现文档更多功能,比如文档缩放、全屏等。详细见demo都已实现。