文档

初始化

更新时间:

本文介绍初始化白板的API。白板正常初始化是所有其它操作的基础,其它对白板API的调用,都需要保证在此操作收到成功回调之后进行。

说明

本接口回调中会获取到使用白板的一些敏感数据,例如docKey(又称WhiteBoardInstanceId)、accessToken(各端略有差异)。此类数据在白板SDK内部有针对性处理,如无特殊要求无需关注。

API使用示例

iOS:

// 需要在主线程调用初始化逻辑
AIRBWhiteBoardConfig* config = [[AIRBWhiteBoardConfig alloc] init];
config.whiteboardContentWidth = ; //这里传入要加载白板的UIView宽度
config.whiteboardContentHeight = config.whiteboardContentWidth * 9.0 / 16.0; //高度需要跟宽度保持9比16的比例
// 打开白板
id<AIRBRoomChannelProtocol> room = [[AIRBRoomEngine sharedInstance] getRoomChannelWithRoomID:@"xxx"];
[room.whiteboard openWithConfig:config];

//白板打开成功,需要实现AIRBWhiteBoardProtocol的以下方法并监听AIRBWhiteBoardEventOpened事件
- (void) onAIRBWhiteBoardEvent:(AIRBWhiteBoardEvent)event info:(NSDictionary*)info {
    switch (event) {
        case AIRBWhiteBoardEventOpened:{
           dispatch_async(dispatch_get_main_queue(), ^{
              //打开成功后,需要在主线程处理,room.whiteboard.whiteboardView就是白板的view,需要配置它的frame
              room.whiteboard.whiteboardView.frame = CGRectMake(x,y,width,height);
              [someOfYourView addSubview:room.whiteboard.whiteboardView];
           });
           break;
        }
    }
}

Android:

whiteboardService.openWhiteboardService(instanceId, new Callback<OpenWhiteboardRsp>() {
    @Override
    public void onSuccess(OpenWhiteboardRsp data) {
        Logger.i(TAG, "openWhiteboardService onSuccess: " + data);
    }

    @Override
    public void onError(String errorMsg) {
        Logger.e(TAG, "openWhiteboardService onError: " + errorMsg);
    }
});

Web:

Web端需要直接通过白板SDK接入白板,详细信息,请参见白板Web端集成与使用

Windows:

auto room_ptr =
 alibaba::meta_space::MetaSpace::GetInstance()->GetRoomInstance(
room_id);

std::shared_ptr<IWhiteBoard> wb_plugin =
 std::dynamic_pointer_cast<IWhiteBoard>(
room_ptr->GetPlugin(PluginWhiteBoard));
wb_plugin->OpenWhiteBoardService([](const ::alibaba::wb::OpenWhiteboardRsp& rsp) {
  },[](const ::alibaba::dps::DPSError & error_msg){
  });
  • 本页导读 (1)
文档反馈