连云港陪玩陪聊
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

630 lines
16 KiB

2 months ago
//
// zego-whiteboard-oc.h
//
// Copyright © Shenzhen Zego Technology Company Limited
//
#import <Foundation/Foundation.h>
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#elif TARGET_OS_OSX
#import <AppKit/AppKit.h>
#endif
//#import "../zego-api-whiteboard-constant.h"
#import "zego-api-whiteboard-canvas-oc.h"
#pragma mark - whiteboard callback block
/**
@param seq create: public: apsectRatio:
@param errorCode 0 0
*/
typedef void(^ZegoWhiteboardInitBlock)(unsigned int seq, int errorCode);
/**
@param seq getList:
@param errorCode 0
@param whiteboardsJson
[
{
"whiteboardId": 99975923, //白板ID
"mode": 1, //白板模式
"name": 1, //白板名称
"width": 1028, //白板宽
"height": 576, //白板高
""
"horizontalScrollPercent": 0, //横向滚动比
"verticalScrollPercent": 0, //纵向滚动比
},
]
*/
typedef void(^ZegoWhiteboardGetListBlock)(unsigned int seq, int errorCode, NSArray *whiteboardsJson);
/**
@param seq create: public: apsectRatio:
@param errorCode 0 0
@param whiteboardJson
{
"whiteboardId": 99975923, //白板ID
"mode": 1, //白板模式
"name": 1, //白板名称
"horizontalScrollPercent": 0, //横向滚动比
"verticalScrollPercent": 0, //纵向滚动比
}
*/
typedef void(^ZegoWhiteboardCreateBlock)(unsigned int seq, int errorCode, NSDictionary *whiteboardJson);
/**
@param seq destroy:
@param errorCode 0
@param whiteboardId id
*/
typedef void(^ZegoWhiteboardDestroyBlock)(unsigned int seq, int errorCode, unsigned long long whiteboardId);
/**
@param seq setAspectRatio:
@param error_code 0
@param whiteboard_id id
@param width\height
@param user_context
*/
typedef void(^ZegoWhiteboardSetAspectRatioBlock)(unsigned int seq, int errorCode, unsigned long long whiteboardId, CGSize aspectRatio);
/**
(ZOrder)
@param seq switchModel返回的调用序号
@param error_code 0
@param whiteboard_id id
@param zorder
*/
typedef void(^ZegoWhiteboardSetZOrderBlock)(unsigned int seq, int error_code, unsigned long long whiteboard_id, unsigned long long zorder);
/**
@param seq setContent:
@param errorCode 0 0
@param whiteboard_id id
*/
typedef void(^ZegoWhiteboardSetContentBlock)(unsigned int seq, int errorCode, unsigned long long whiteboardId);
/**
@param seq setExtra:
@param errorCode 0 0
@param whiteboard_id id
*/
typedef void(^ZegoWhiteboardSetExtraBlock)(unsigned int seq, int errorCode, unsigned long long whiteboardId);
/**
H5扩展信息的结果回调
@param seq appendH5Extra:
@param errorCode 0 0
@param whiteboard_id id
*/
typedef void(^ZegoWhiteboardAppendH5ExtraBlock)(unsigned int seq, int errorCode, unsigned long long whiteboardId);
/**
H5扩展信息的结果回调
@param seq appendH5Extra:
@param errorCode 0 0
@param whiteboard_id id
@param h5Extra
*/
typedef void(^ZegoWhiteboardAppendH5Extra2Block)(unsigned int seq, int errorCode, unsigned long long whiteboardId, NSString* h5Extra);
/**
@param seq scrollCanvas:
@param errorCode 0
@param whiteboardId id
@param horizontalPercent
@param verticalPercent
@param pptStep ppt步骤
*/
typedef void(^ZegoWhiteboardScrollCanvasBlock)(unsigned int seq, int error_code, unsigned long long whiteboard_id, float horizontalPercent, float verticalPercent, unsigned int pptStep);
/**
@param seq scrollCanvas:
@param errorCode 0
@param whiteboardId id
@param xoffsetPercent
@param yoffsetPercent
@param scaleFactor
*/
typedef void(^ZegoWhiteboardScaleCanvasBlock)(unsigned int seq, int error_code, unsigned long long whiteboard_id, float xoffsetPercent, float yoffsetPercent, float scaleFactor);
/**
@param seq seq
@param error
@param bFinsh
@param rate
@param file_id id
@param url url
@param hash hash
*/
typedef void(^ZegoWhiteboardUploadFileBlock)(unsigned int seq, int error, bool bFinsh, float rate, NSString * file_id, NSString * url, NSString * hash);
/**
@param seq seq
@param error
@param bFinsh
@param rate
@param address
*/
typedef void(^ZegoWhiteboardDownloadFileBlock)(unsigned int seq, int error, bool bFinsh, float rate, NSString* address);
#pragma mark - whiteboard notify delegate
@protocol ZegoWhiteboardDelegate <NSObject>
@optional
/**
@param whiteboardJson
*/
- (void)onAdded:(NSDictionary *)whiteboardJson;
/**
@param whiteboardId ID
*/
- (void)onRemoved:(unsigned long long)whiteboardId;
/**
@param aspectRatio
@param whiteboardId ID
*/
- (void)onAspectRatioChanged:(CGSize)aspectRatio
whiteboardId:(unsigned long long)whiteboardId;
/**
(zorder)
@param zOrder
@param whiteboardId ID
*/
- (void)onWhiteBoardZOrderChanged:(unsigned long long)zOrder
whiteboardId:(unsigned long long)whiteboardId;
/**
@param content
@param whiteboardId ID
*/
- (void)onContentChanged:(NSString *)content
whiteboardId:(unsigned long long)whiteboardId;
/**
@param extra
@param whiteboardId ID
*/
- (void)onExtraChanged:(NSString *)extra
whiteboardId:(unsigned long long)whiteboardId;
/**
H5扩展信息追加的通知
@param h5Extra
@param whiteboardId ID
*/
- (void)onH5ExtraAppended:(NSString *)h5Extra
whiteboardId:(unsigned long long)whiteboardId;
/**
@param horPercent Handle在滚动条Bar中的百分比
@param verPercent
@param whiteboardId id
@param pptStep ppt步骤
@note scroll值真正发生变化
*/
- (void)onCanvasHorizontalScrolled:(float)horPercent
verticalScrolled:(float)verPercent
pptStep:(unsigned int)pptStep
whiteboardId:(unsigned long long)whiteboardId;
/**
@param xoffsetPercent
@param yoffsetPercent
@param whiteboardId id
@param scaleFactor
@note scroll值真正发生变化
*/
- (void)onCanvasScaled:(float)xoffsetPercent
verticalScrolled:(float)yoffsetPercent
scaleFactor:(float)scaleFactor
whiteboardId:(unsigned long long)whiteboardId;
/**
@param whiteboardJson json
{
"sacle": 0, // 0:false 1:true
"scroll": 0, //0:false 1:true
}
*/
-(void)onWhiteboardAuthChange: (NSDictionary *)whiteboardJson;
/**
@param graphicJson json
{
"clear":1,
"create":1,
"delete":1,
"move":1,
"update":1
}
*/
-(void)onWhiteboardGraphicAuthChange:(NSDictionary *)graphicJson;
/**
@param roomId id
@param roomStatu (RoomOffline = 0, RoomOnline = 1,RoomTempBroken = 2)
*/
-(void)onRoomStatusChanged: (NSString *)roomId
roomStatu : (int)roomStatu;
@end
#pragma mark - whiteboard interface
@interface ZegoWhiteboard : NSObject
+ (id)sharedInstance;
/** 设置白板通知 delegate */
- (void)setDelegate:(id<ZegoWhiteboardDelegate>)delegate;
/**
*/
- (ZegoWhiteboardCanvas *)sharedCanvasManager;
/**
@note LIVEROOM::InitSDK之后调用
@return 00
*/
- (unsigned int)initWhiteboardWithCompletionBlock:(ZegoWhiteboardInitBlock)block;
/**
@note LIVEROOM::UnInitSDK之前调用
*/
- (void)unInitWhiteboard;
/**
@return 00
*/
- (unsigned int)getListWithCompletionBlock:(ZegoWhiteboardGetListBlock)block;
/**
@param whiteboardJson
{
"mode": 1, // 白板模式
"name": 1, // 白板名称
"width": 1028, // 白板宽
"height": 576, // 白板高
}
@return 00
*/
- (unsigned int)create:(NSDictionary *)whiteboardJson
completionBlock:(ZegoWhiteboardCreateBlock)block;
/**
@param whiteboardId ID
@return 00
*/
- (unsigned int)destroy:(unsigned long long)whiteboardId
completionBlock:(ZegoWhiteboardDestroyBlock)block;
/**
view的当前实际内容尺寸
@param size
@param whiteboardId ID
*/
- (void)resize:(CGSize)size whiteboardId:(unsigned long long)whiteboardId;
/**
view的可视区域尺寸
@param size
@param whiteboard_id id
*/
- (void)setViewportSize:(CGSize)size whiteboardId:(unsigned long long)whiteboardId;
/**
@param whiteboardId ID
@return 00
*/
- (unsigned int)switchModel:(unsigned long long)whiteboardId
completionBlock: (ZegoWhiteboardSetZOrderBlock)block;
/**
@param content
@param whiteboardId ID
@return 00
*/
- (unsigned int)setContent: (NSString *)content
whiteboardId: (unsigned long long)whiteboardId
completionBlock: (ZegoWhiteboardSetContentBlock)block;
/**
@param extra
@param whiteboardId ID
@return 00
*/
- (unsigned int)setExtra: (NSString *)extra
whiteboardId: (unsigned long long)whiteboardId
completionBlock: (ZegoWhiteboardSetExtraBlock)block;
/**
H5的扩展信息
@param h5Extra
{
"H5_target":
{
"s": 1,
"p": 2,
"e":
[
{ "id": 7}
]
}
}
@param whiteboardId ID
@return 00
*/
- (unsigned int)appendH5Extra: (NSString *)h5Extra
whiteboardId: (unsigned long long)whiteboardId
completionBlock: (ZegoWhiteboardAppendH5ExtraBlock)block;
/**
H5的扩展信息
@param h5Extra
{
"H5_target":
{
"s": 1,
"p": 2,
"e":
[
{ "id": 7}
]
}
}
@param whiteboardId ID
@return 00
*/
- (unsigned int)appendH5Extra2: (NSString *)h5Extra
whiteboardId: (unsigned long long)whiteboardId
completionBlock: (ZegoWhiteboardAppendH5Extra2Block)block;
- (NSString *)getH5Extra:(unsigned long long)whiteboardId;
/**
@param horizontalPercent
@param verticalPercent
@param whiteboardId ID
@param pptStep ppt步骤
@return 00
*/
- (unsigned int)scrollToHorizontalPercent:(CGFloat)horizontalPercent
verticalPercent:(CGFloat)verticalPercent
pptStep:(unsigned int)pptStep
whiteboardId:(unsigned long long)whiteboardId
completionBlock:(ZegoWhiteboardScrollCanvasBlock)block;
/**
@param horizontalPercent
@param verticalPercent
@param whiteboardId id
@return 00
*/
- (void)loadGraphicsWithHorizontalPercent:(CGFloat)horizontalPercent
verticalPercent:(CGFloat)verticalPercent
whiteboardId:(unsigned long long)whiteboardId;
/**
@param xoffsetPercent
@param yoffsetPercent
@param whiteboardId ID
@param scaleFactor
@return 00
*/
- (unsigned int)scaleCanvas:(CGFloat)xoffsetPercent
yoffsetPercent:(CGFloat)yoffsetPercent
scaleFactor:(CGFloat)scaleFactor
whiteboardId:(unsigned long long)whiteboardId
completionBlock:(ZegoWhiteboardScaleCanvasBlock)block;
/**
//
@param xoffsetPercent
@param yoffsetPercent
@param whiteboardId ID
@param scaleFactor
*/
-(NSMutableDictionary<NSNumber *, NSObject *>*)getScaleFactor:(unsigned long long)whiteboardId;
/**
view版本号 ()
@param version view版本号
*/
-(void)setWhiteboardViewVersion: (NSString *)version;
/**
view版本号是否匹配
@param version view版本号
*/
-(int)checkWhiteboardViewVersion: (NSString *)version;
/**
native
@return
*/
-(NSString *)getWhiteboardVersion;
/**
@param directory
@return
*/
-(unsigned int)setCacheDirectory: (NSString *)directory;
/**
@return
*/
-(NSString *)getCacheDirectory;
/**
*/
-(void)clearCache;
/**
@param address
@param type -2 0/1
*/
-(unsigned int)uploadFile:(NSString *)address
imagetype: (int) type
completionBlock : (ZegoWhiteboardUploadFileBlock)block;
/**
@param seq
*/
-(void)cancelUploadFile:(unsigned int)seq;
/**
@param url url
@param hash
*/
-(unsigned int)downloadFile:(NSString *)url
filehash:(NSString *)hash
imagetype:(int) type
completionBlock : (ZegoWhiteboardDownloadFileBlock)block;
/**
@param seq
*/
-(void)cancelDownloadFile:(unsigned int)seq;
/**
@param operateType
@param whiteboardId id
@param graphic_id_list ("123456;456787;45454545") id, ";"(())
@return
*/
-(bool)canOperateGraphic: (int)operateType
whiteboardId : (unsigned long long)whiteboardId
onGraphicIdList : (NSString *)graphic_id_list;
/**
@param WhiteboardOperateType )
@return
*/
-(bool)canOperateWhiteboard: (int)whiteboardOperateType;
@end