更新时间:2019-12-10
描述
会议中,主讲人和与会者可以进行屏幕共享或程序共享。
前提条件:
业务流程
主讲人共享屏幕
SDK并未对接口tsdk_app_share_set_owner的调用者进行与角色限制,但实际应用场景中,UI应该仅对主讲人才提供主动“共享屏幕”入口。
//c code TSDK_RESULT ret; ret = tsdk_app_share_set_owner(confHandle, attendee, action); if (TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("share set owner failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; |
应用程序在拥有主讲人身份时,收到此通知消息,UI应自动进行后继开始“共享屏幕”的处理流程,而不需要用户确认。
//c code case TSDK_E_CONF_EVT_AS_OWNER_CHANGE: { CHECK_POINTER(data); CDemoDataMeetingDlg* pDataMettingDlg = maindlg->GetDemoDataMeetingDlg(); CHECK_POINTER(pDataMettingDlg); ::PostMessage(pDataMettingDlg->GetSafeHwnd(), WM_DATACONF_MODULE_SHARING_SESSION, (WPARAM)param2, (LPARAM)data); break; } |
//c code TSDK_UINT32 confHandle = get_data_conf_handle(); TSDK_RESULT ret; ret = tsdk_app_share_start(confHandle, shareType); if (TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("share start failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; |
//c code case TSDK_E_CONF_EVT_AS_STATE_CHANGE: { CHECK_POINTER(data); TSDK_S_CONF_AS_STATE_INFO* pResult = (TSDK_S_CONF_AS_STATE_INFO*)data; TSDK_S_CONF_AS_STATE_INFO* notifyInfo = new TSDK_S_CONF_AS_STATE_INFO; memset(notifyInfo, 0, sizeof(TSDK_S_CONF_AS_STATE_INFO)); memcpy_s(notifyInfo, sizeof(TSDK_S_CONF_AS_STATE_INFO), pResult, sizeof(TSDK_S_CONF_AS_STATE_INFO)); CDemoDataMeetingDlg* pDataMettingDlg = maindlg->GetDemoDataMeetingDlg(); CHECK_POINTER(pDataMettingDlg); ::PostMessage(pDataMettingDlg->GetSafeHwnd(), WM_DATACONF_MODULE_SHARING_STATE, (WPARAM)notifyInfo, (LPARAM)param2); break; } |
//c code case TSDK_E_CONF_EVT_AS_SCREEN_DATA_UPDATE: { CDemoDataMeetingDlg* pDataMettingDlg = maindlg->GetDemoDataMeetingDlg(); CHECK_POINTER(pDataMettingDlg); ::PostMessage(pDataMettingDlg->GetSafeHwnd(), WM_DATACONF_MODULE_SCREEN_DATA, NULL, NULL); break; } |
//c code TSDK_RESULT ret; ret = tsdk_app_share_get_screen_data(confHandle, screenData); if (TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("share get screen data failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; |
主讲人邀请其他与会者共享屏幕
SDK并未对接口tup_conf_as_set_owner的调用者进行与角色限制,但实际应用场景中,UI应该仅对主讲人才提供“邀请其他与会者共享”入口;成功调用该接口后,原来拥有共享权限的用户的共享权限会自动取消,正在进行的共享会停止。
//c code TSDK_RESULT ret; ret = tsdk_app_share_set_owner(confHandle, attendee, action); if (TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("share set owner failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; |
应用程序在非主讲人时收到此通知消息,并且共享者ID为自己,UI应提示用户收到共享邀请,并提供“共享屏幕”和“拒绝共享”入口,若应用程序支持“程序共享”,还应该提供“程序共享”的选择入口。
//c code case TSDK_E_CONF_EVT_AS_OWNER_CHANGE: { CHECK_POINTER(data); CDemoDataMeetingDlg* pDataMettingDlg = maindlg->GetDemoDataMeetingDlg(); CHECK_POINTER(pDataMettingDlg); ::PostMessage(pDataMettingDlg->GetSafeHwnd(), WM_DATACONF_MODULE_SHARING_SESSION, (WPARAM)param2, (LPARAM)data); break; } |
//c code TSDK_UINT32 confHandle = get_data_conf_handle(); TSDK_RESULT ret; ret = tsdk_app_share_start(confHandle, shareType); if (TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("share start failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; |
共享者主动结束共享
//c code TSDK_RESULT ret; ret = tsdk_app_share_stop(confHandle); if (TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("share stop failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; |
//c code case TSDK_E_CONF_EVT_AS_STATE_CHANGE: { CHECK_POINTER(data); TSDK_S_CONF_AS_STATE_INFO* pResult = (TSDK_S_CONF_AS_STATE_INFO*)data; TSDK_S_CONF_AS_STATE_INFO* notifyInfo = new TSDK_S_CONF_AS_STATE_INFO; memset(notifyInfo, 0, sizeof(TSDK_S_CONF_AS_STATE_INFO)); memcpy_s(notifyInfo, sizeof(TSDK_S_CONF_AS_STATE_INFO), pResult, sizeof(TSDK_S_CONF_AS_STATE_INFO)); CDemoDataMeetingDlg* pDataMettingDlg = maindlg->GetDemoDataMeetingDlg(); CHECK_POINTER(pDataMettingDlg); ::PostMessage(pDataMettingDlg->GetSafeHwnd(), WM_DATACONF_MODULE_SHARING_STATE, (WPARAM)notifyInfo, (LPARAM)param2); break; } |
主讲人结束共享者共享
//c code TSDK_RESULT ret; ret = tsdk_app_share_set_owner(confHandle, attendee, action); if (TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("share set owner failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; |
//c code case TSDK_E_CONF_EVT_AS_OWNER_CHANGE: { CHECK_POINTER(data); CDemoDataMeetingDlg* pDataMettingDlg = maindlg->GetDemoDataMeetingDlg(); CHECK_POINTER(pDataMettingDlg); ::PostMessage(pDataMettingDlg->GetSafeHwnd(), WM_DATACONF_MODULE_SHARING_SESSION, (WPARAM)param2, (LPARAM)data); break; } |
注意事项
无。
描述
会议过程中,与会者可以打开一个文档进行共享,以及关闭一个已经共享的文档或者取消打开一个已经打开但未打开完成的文档。
前提条件:
业务流程
打开共享文档
SDK并未对接口tsdk_doc_share_open_document()的调用者进行角色限制,实际应用场景中,建议应用程序UI仅对主讲人或桌面共享权限所有者提供“共享文档”入口,以减少不必要的交互。
//c code CString docmentPath; CFileDialog filedlg(TRUE); if (filedlg.DoModal()) { docmentPath = filedlg.GetPathName(); } unsigned int newdocid = 0; service_data_conf_ds_share_open_document(CTools::UNICODE2UTF(docmentPath).c_str(),&newdocid); int service_data_conf_ds_share_open_document(const char* file_path,unsigned int* doc_id) { TSDK_RESULT ret; ret = tsdk_doc_share_open_document(confHandle,file_path,TSDK_E_DOC_SHARE_SIZE,doc_id); if (TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("share open document failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; } |
//c code case TSDK_E_CONF_EVT_DS_DOC_LOAD_START: { CHECK_POINTER(data); TSDK_S_DOC_BASE_INFO* pResult = (TSDK_S_DOC_BASE_INFO*)data; TSDK_S_DOC_BASE_INFO* notifyInfo = new TSDK_S_DOC_BASE_INFO; service_memset_s(notifyInfo, sizeof(TSDK_S_DOC_BASE_INFO), 0, sizeof(TSDK_S_DOC_BASE_INFO)); memcpy_s(notifyInfo, sizeof(TSDK_S_DOC_BASE_INFO), pResult, sizeof(TSDK_S_DOC_BASE_INFO)); CDemoDocumentsShareDlg* pDocumentShareDlg = maindlg->GetDocumentDlg(); CHECK_POINTER(pDocumentShareDlg); ::PostMessage(pDocumentShareDlg->GetSafeHwnd(),WM_DATACONF_MODULE_DS_NEW,(WPARAM)notifyInfo,(LPARAM)param2); break; } |
//c code case TSDK_E_CONF_EVT_DS_DOC_NEW: { LOG_D_CALL_INFO("doc share new"); break; } |
//c code case TSDK_E_CONF_EVT_DS_DOC_PAGE_LOADED: { CHECK_POINTER(data); TSDK_S_DOC_PAGE_BASE_INFO* pResult = (TSDK_S_DOC_PAGE_BASE_INFO*)data; TSDK_S_DOC_PAGE_BASE_INFO* notifyInfo = new TSDK_S_DOC_PAGE_BASE_INFO; service_memset_s(notifyInfo, sizeof(TSDK_S_DOC_PAGE_BASE_INFO), 0, sizeof(TSDK_S_DOC_PAGE_BASE_INFO)); memcpy_s(notifyInfo, sizeof(TSDK_S_DOC_PAGE_BASE_INFO), pResult, sizeof(TSDK_S_DOC_PAGE_BASE_INFO)); CDemoDocumentsShareDlg* pDocumentShareDlg = maindlg->GetDocumentDlg(); CHECK_POINTER(pDocumentShareDlg); ::PostMessage(pDocumentShareDlg->GetSafeHwnd(), WM_DATACONF_MODULE_DS_PAGE_LOADED, (WPARAM)notifyInfo, NULL); break; } |
//c code case TSDK_E_CONF_EVT_DS_DOC_PAGE_NEW: { LOG_D_CALL_INFO("doc share page new"); break; } |
收到此消息通知表示文档加载并上传服务器成功,可以进行后继操作,在此之前的步骤2至步骤5均为中间过程,UI可仅记录状态信息,不进行界面刷新处理。
//c code case TSDK_E_CONF_EVT_DS_DOC_LOAD_FINISH: { CHECK_POINTER(data); TSDK_S_DOC_BASE_INFO* pResult = (TSDK_S_DOC_BASE_INFO*)data; TSDK_S_DOC_BASE_INFO* notifyInfo = new TSDK_S_DOC_BASE_INFO; service_memset_s(notifyInfo, sizeof(TSDK_S_DOC_BASE_INFO), 0, sizeof(TSDK_S_DOC_BASE_INFO)); memcpy_s(notifyInfo, sizeof(TSDK_S_DOC_BASE_INFO), pResult, sizeof(TSDK_S_DOC_BASE_INFO)); CDemoDocumentsShareDlg* pDocumentShareDlg = maindlg->GetDocumentDlg(); CHECK_POINTER(pDocumentShareDlg); ::PostMessage(pDocumentShareDlg->GetSafeHwnd(),WM_DATACONF_MODULE_DS_DOCLOADED, (WPARAM)notifyInfo, (LPARAM)param2); break; } |
调用该接口后,当前显示的页面将被切换到指定的文档页。如果指定的文档ID为有效值而页面ID为0,则切换到该文档上次显示的页面。该函数有同步设置和非同步两种,同步设置时,其他所有与会者都会收到切换消息并显示切换的页面;非同步时,只有本地发生变化,共享侧应该设置为同步。
//c code TSDK_RESULT ret; TSDK_S_DOC_PAGE_BASE_INFO page_info; page_info.component_id = TSDK_E_COMPONENT_DS; page_info.document_id = docId; page_info.page_index = pageIndex; ret = tsdk_doc_share_set_current_page(confHandle,&page_info,isSyn); if (TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("set current page failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; |
代码示例:
//c code case TSDK_E_CONF_EVT_DS_DOC_CURRENT_PAGE: { LOG_D_CALL_INFO("doc share current page"); break; } case TSDK_E_CONF_EVT_DS_DOC_CURRENT_PAGE_IND: { CHECK_POINTER(data); TSDK_S_DOC_PAGE_BASE_INFO* pResult = (TSDK_S_DOC_PAGE_BASE_INFO*)data; TSDK_S_DOC_PAGE_BASE_INFO* notifyInfo = new TSDK_S_DOC_PAGE_BASE_INFO; service_memset_s(notifyInfo, sizeof(TSDK_S_DOC_PAGE_BASE_INFO), 0, sizeof(TSDK_S_DOC_PAGE_BASE_INFO)); memcpy_s(notifyInfo, sizeof(TSDK_S_DOC_PAGE_BASE_INFO), pResult, sizeof(TSDK_S_DOC_PAGE_BASE_INFO)); CDemoDocumentsShareDlg* pDocumentShareDlg = maindlg->GetDocumentDlg(); CHECK_POINTER(pDocumentShareDlg); ::PostMessage(pDocumentShareDlg->GetSafeHwnd(),WM_DATACONF_MODULE_DS_PAGE_IND,(WPARAM)notifyInfo,NULL); break; } |
关闭共享文档
//c code TSDK_RESULT ret; ret = tsdk_doc_share_close_document(confHandle,docId); if (TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("close document failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; |
//c code case TSDK_E_CONF_EVT_DS_DOC_PAGE_DEL: { LOG_D_CALL_INFO("doc share page delete"); break; } |
//c code case TSDK_E_CONF_EVT_DS_DOC_DEL: { CDemoDocumentsShareDlg* pDocumentShareDlg = maindlg->GetDocumentDlg(); CHECK_POINTER(pDocumentShareDlg); CHECK_POINTER(data); TSDK_S_DOC_SHARE_DEL_DOC_INFO* pResult = (TSDK_S_DOC_SHARE_DEL_DOC_INFO*)data; TSDK_S_DOC_SHARE_DEL_DOC_INFO* notifyInfo = new TSDK_S_DOC_SHARE_DEL_DOC_INFO; service_memset_s(notifyInfo, sizeof(TSDK_S_DOC_SHARE_DEL_DOC_INFO), 0, sizeof(TSDK_S_DOC_SHARE_DEL_DOC_INFO)); memcpy_s(notifyInfo, sizeof(TSDK_S_DOC_SHARE_DEL_DOC_INFO), pResult, sizeof(TSDK_S_DOC_SHARE_DEL_DOC_INFO)); ::PostMessage(pDocumentShareDlg->GetSafeHwnd(),WM_DATACONF_MODULE_DS_DELETE,(WPARAM)notifyInfo,(LPARAM)param2); break; } |
注意事项
无。
描述
会议过程中,与会者在不同的文档和不同的页面之间切换,以观看不同的内容。
前提条件:
业务流程
同步翻页或切换文档
//c code TSDK_RESULT ret; TSDK_S_DOC_PAGE_BASE_INFO page_info; page_info.component_id = TSDK_E_COMPONENT_DS; page_info.document_id = docId; page_info.page_index = pageIndex; ret = tsdk_doc_share_set_current_page(confHandle,&page_info,isSyn); if (TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("set current page failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; |
//c code TSDK_RESULT ret; TSDK_S_DOC_PAGE_BASE_INFO page_info; page_info.component_id = TSDK_E_COMPONENT_DS; page_info.document_id = docId; page_info.page_index = pageIndex; ret = tsdk_doc_share_set_current_page(confHandle,&page_info,isSyn); if (TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("set current page failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; |
//c code case TSDK_E_CONF_EVT_DS_DOC_DRAW_DATA_NOTIFY: { CDemoDocumentsShareDlg* pDocumentShareDlg = maindlg->GetDocumentDlg(); CHECK_POINTER(pDocumentShareDlg); ::PostMessage(pDocumentShareDlg->GetSafeHwnd(),WM_DATACONF_MODULE_DS_DRAW_DATA,NULL,NULL); break; } |
此通知消息在共享过程中页面发生变更时就会上报。
//c code unsigned int bmpWidth; unsigned int bmpHeight; void* data = NULL; data = tsdk_doc_share_get_surface_bmp(confHandle,TSDK_E_COMPONENT_DS,&bmpWidth,&bmpHeight); if (NULL == data) { LOG_D_CALL_ERROR("get surface bmp failed."); return NULL; } return data; |
本地翻页或切换文档(本地浏览)
同步服务器页面
通过此接口获取当前共享页面信息,并通过后继步骤2至步骤5保证观看端页面的立即更新。
//c code TSDK_S_DOC_PAGE_DETAIL_INFO info; service_data_conf_ds_share_get_syn_document_info(&info); m_docId = info.doc_page_info.document_id; m_pageNum = info.doc_page_info.page_index; int service_data_conf_ds_share_get_syn_document_info(TSDK_S_DOC_PAGE_DETAIL_INFO* sync_info) { TSDK_RESULT ret; ret = tsdk_doc_share_get_syn_document_info(confHandle,TSDK_E_COMPONENT_DS,sync_info); if (TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("get syn document info failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; } |
//c code TSDK_RESULT ret; TSDK_S_DOC_PAGE_BASE_INFO page_info; page_info.component_id = TSDK_E_COMPONENT_DS; page_info.document_id = docId; page_info.page_index = pageIndex; ret = tsdk_doc_share_set_current_page(confHandle,&page_info,isSyn); if (TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("set current page failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; |
注意事项
无。
描述
会议过程中,与会者通过白板与其他与会者进行交流。
使用白板必然需要使用标注功能,因标注功能相对较独立,且可以在多个业务场景下使用,所以本章节仅描述对白板文档和页面的管理操作,标注相关操作参见“标注”章节描述。
业务流程
新建白板
SDK并未对接口tsdk_whiteboard_new_document()的调用者进行与角色限制,实际应用场景中,建议应用程序UI仅对主讲人或桌面共享权限所有者提供“共享白板”入口,以减少不必要的交互。
//c code TSDK_RESULT result = 0; unsigned int conf_handle = get_data_conf_handle(); unsigned int* doc_id; /*Step 1:[Must]Create a new empty whiteboard document */ result = tsdk_whiteboard_new_document(conf_handle,doc_id); if(TSDK_SUCCESS != result) { LOG_D_DATA_CONF_ERROR("Create a new empty whiteboard document failed. result=%#x", result); return SERVICE_E_WHITE_BOARD_SHARE_CREATE_NEW_FAILED; } |
//c code case TSDK_E_CONF_EVT_WB_DOC_NEW: { /*Create a new whiteboard document, all attendees can receive this message*/ service_handle_data_conf_whiteboard_doc_new_evt(conf_handle, type, value1, value2, data, size); break; } /** * @brief Create a new whiteboard document, all attendees can receive this message * * @param [in] unsigned int conf_handle data conference handle * @param [in] int type callback message type * @param [in] unsigned int value1 document ID * @param [in] unsigned int value2 Document new ID * @param [in] void* data NULL * @param [in] int size NULL * @retval void * * @attention: NA **/ void service_handle_data_conf_whiteboard_doc_new_evt(unsigned int conf_handle, int type, unsigned int value1, unsigned int value2, void *data, int size) { LOG_D_DATA_CONF_INFO("service_handle_data_conf_whiteboard_doc_new_evt"); (void)service_data_conf_notify_to_ui_proc(conf_handle, SERVICE_E_DATA_CONF_EVT_WB_DOC_NEW, value1, value2, NULL, NULL); return; } |
//c code TSDK_RESULT result = 0; unsigned int conf_handle = get_data_conf_handle(); TSDK_S_DOC_PAGE_BASE_INFO page_info; page_info.component_id = TSDK_E_COMPONENT_WB; page_info.document_id = current_document_id ; page_info.page_index = current_page_index ; /*Switch document or whiteboard page*/ result = tsdk_doc_share_set_current_page(conf_handle, &page_info, true); if(TSDK_SUCCESS != result) { LOG_D_DATA_CONF_ERROR("Switch document or whiteboard page failed. result=%#x", result); return SERVICE_E_DOCUMENT_SHARE_SWITCH_FAILED; } |
//c code case TSDK_E_CONF_EVT_WB_DOC_CURRENT_PAGE: { /*Notify UI*/ }break; case TSDK_E_CONF_EVT_WB_DOC_CURRENT_PAGE_IND: { /*Notify UI*/ }break; |
共享侧UI在完成空白白板创建后,应该自动新建第一个白板页面,以减少不必要的用户交互,提升用户体验。后继处理过程参见“新建白板页”描述。
新建白板页
//c code TSDK_RESULT result = 0; unsigned int conf_handle = get_data_conf_handle(); /*Step 1:[Must]Create a new page*/ result = tsdk_whiteboard_new_page(conf_handle, doc_id, page_width, page_height, page_id); if(TSDK_SUCCESS != result) { LOG_D_DATA_CONF_ERROR("Create a new page in specified whiteboard document failed. result=%#x", result); return SERVICE_E_WHITE_BOARD_SHARE_CREATE_NEW_PAGE_FAILED; } |
//c code case TSDK_E_CONF_EVT_WB_PAGE_NEW: { /*Create a new whiteboard document, all attendees can receive this message*/ service_handle_data_conf_whiteboard_doc_new_evt(conf_handle, type, value1, value2, data, size); break; } /** * @brief Create a new whiteboard document, all attendees can receive this message * * @param [in] unsigned int conf_handle data conference handle * @param [in] int type callback message type * @param [in] unsigned int value1 document ID * @param [in] unsigned int value2 Document new ID * @param [in] void* data NULL * @param [in] int size NULL * @retval void * * @attention: NA **/ void service_handle_data_conf_whiteboard_doc_new_evt(unsigned int conf_handle, int type, unsigned int value1, unsigned int value2, void *data, int size) { LOG_D_DATA_CONF_INFO("service_handle_data_conf_whiteboard_doc_new_evt"); (void)service_data_conf_notify_to_ui_proc(conf_handle, SERVICE_E_DATA_CONF_EVT_WB_DOC_NEW, value1, value2, NULL, NULL); return; } |
//c code TSDK_RESULT result = 0; unsigned int conf_handle = get_data_conf_handle(); TSDK_S_DOC_PAGE_BASE_INFO page_info; page_info.component_id = TSDK_E_COMPONENT_WB; page_info.document_id = current_document_id ; page_info.page_index = current_page_index ; /*Switch document or whiteboard page*/ result = tsdk_doc_share_set_current_page(conf_handle, &page_info, true); if(TSDK_SUCCESS != result) { LOG_D_DATA_CONF_ERROR("Switch document or whiteboard page failed. result=%#x", result); return SERVICE_E_DOCUMENT_SHARE_SWITCH_FAILED; } |
//c code case TSDK_E_CONF_EVT_WB_DOC_CURRENT_PAGE: { /*Notify UI*/ }break case TSDK_E_CONF_EVT_WB_DOC_CURRENT_PAGE_IND: { /*Notify UI*/ }break |
//c code case TSDK_E_CONF_EVT_WB_DOC_CURRENT_PAGE: { /*Current page is turned, all attendees can receive this message*/ service_handle_data_conf_whiteboard_turn_page_evt(conf_handle, type, value1, value2, data, size); break; } /** * @brief Current page is turned, all attendees can receive this message * * @param [in] unsigned int conf_handle data conference handle * @param [in] int type callback message type * @param [in] unsigned int value1 document ID * @param [in] unsigned int value2 page ID * @param [in] void* data NULL * @param [in] int size NULL * @retval void * * @attention: NA **/ void service_handle_data_conf_whiteboard_turn_page_evt(unsigned int conf_handle, int type, unsigned int value1, unsigned int value2, void *data, int size) { LOG_D_DATA_CONF_INFO("service_handle_data_conf_whiteboard_turn_page_evt"); (void)service_data_conf_notify_to_ui_proc(conf_handle, SERVICE_E_DATA_CONF_EVT_WB_CURRENT_PAGE, value1, value2, NULL, NULL); return; } |
此通知消息在共享过程中白板页面发生变更时就会上报。
//c code case TSDK_E_CONF_EVT_WB_DOC_DRAW_DATA_NOTIFY: { /*UI update notification, all attendees can receive this message*/ service_handle_data_conf_whiteboard_on_draw_data(conf_handle, type, value1, value2, data, size); break; } /** * @brief UI update notification, all attendees can receive this message * * @param [in] unsigned int conf_handle data conference handle * @param [in] int type callback message type * @param [in] unsigned int value1 document ID * @param [in] unsigned int value2 page ID * @param [in] void* data NULL * @param [in] int size NULL * @retval void * * @attention: NA **/ void service_handle_data_conf_whiteboard_on_draw_data(unsigned int conf_handle, int type, unsigned int value1, unsigned int value2, void *data, int size) { LOG_D_DATA_CONF_INFO("service_handle_data_conf_whiteboard_on_draw_data"); (void)service_data_conf_notify_to_ui_proc(conf_handle, SERVICE_E_DATA_CONF_EVT_WB_DRAW_DATA_NOTIFY, value1, value2, NULL, NULL); return; } |
//c code void* data = NULL; unsigned int conf_handle = get_data_conf_handle(); unsigned int* width; unsigned int* height; /*Step 1:[Must]Get document and whiteboard page image data*/ data = tsdk_doc_share_get_surface_bmp(conf_handle, TSDK_E_COMPONENT_WB, width, height); if(NULL == data) { LOG_D_DATA_CONF_ERROR("Get document and whiteboard page image data failed"); return NULL; } |
结束共享白板
case TSDK_E_CONF_EVT_WB_DOC_DEL: { /*Delete a whiteboard document, all attendees can receive this message*/ service_handle_data_conf_whiteboard_doc_del_evt(conf_handle, type, value1, value2, data, size); break; } /** * @brief Delete a whiteboard document, all attendees can receive this message * * @param [in] unsigned int conf_handle data conference handle * @param [in] int type callback message type * @param [in] unsigned int value1 document ID * @param [in] unsigned int value2 0 * @param [in] void* data NULL * @param [in] int size NULL * @retval void * * @attention: NA **/ void service_handle_data_conf_whiteboard_doc_del_evt(unsigned int conf_handle, int type, unsigned int value1, unsigned int value2, void *data, int size) { LOG_D_DATA_CONF_INFO("service_handle_data_conf_whiteboard_doc_del_evt"); (void)service_data_conf_notify_to_ui_proc(conf_handle, SERVICE_E_DATA_CONF_EVT_WB_DOC_DEL, value1, value2, NULL, NULL); return; } |
注意事项
无。
描述
在文档共享或白板共享中,与会者间可以通过标注功能在共享界面进行远程交流。
业务流程
设置画笔和画刷
//c code TSDK_RESULT result = 0; unsigned int conf_handle = get_data_conf_handle(); TSDK_S_ANNOTATION_PEN_INFO new_pen_info = {0}; TSDK_S_ANNOTATION_PEN_INFO old_pen_info = {0}; TSDK_E_ANNOTATION_PEN_TYPE pen_type = TSDK_E_ANNOTATION_PEN_NORMAL; /*tup_pen_info comes from UI*/ new_pen_info.style = TSDK_E_ANNOTATION_PEN_STYLE_SOLID; new_pen_info.color = 0xFFFFFFAA; //0xRRGGBBAA new_pen_info.width = 1; /*Set pen information*/ result = tsdk_annotation_set_pen(conf_handle, TSDK_E_COMPONENT_WB, pen_type, &new_pen_info, &old_pen_info ); if(TSDK_SUCCESS != result) { LOG_D_DATA_CONF_ERROR("Set pen information failed. result=%#x", result); return SERVICE_E_SHARE_ANNOTATION_SET_PEN_FAILED; } |
//c code TSDK_RESULT result = 0; unsigned int conf_handle = get_data_conf_handle(); TSDK_S_ANNOTATION_BRUSH_INFO new_brush_info = {0}; TSDK_S_ANNOTATION_BRUSH_INFO old_brush_info = {0}; /*the information of brush comes from UI*/ new_brush_info.style = TSDK_E_ANNOTATION_BRUSH_SOLID; new_brush_info.color = 0xFFFFFFAA; //0xRRGGBBAA /*Set paint brush information*/ result = tup_conf_annotation_set_brush(conf_handle, TSDK_E_COMPONENT_WB, &new_brush_info, &old_brush_info); if(TSDK_SUCCESS != result) { LOG_D_DATA_CONF_ERROR("Set paint brush information failed. result=%#x", result); return SERVICE_E_SHARE_ANNOTATION_SET_BRUSH_FAILED; } |
创建几何标注
//c code TSDK_RESULT result = 0; unsigned int conf_handle = get_data_conf_handle(); TC_POINT tup_start_point = {0}; /*Start to create annotation*/ result = tsdk_annotation_create_start(conf_handle, TSDK_E_ANNOTATION_DRAWING, document_id, page_id, type, DS_ANNOTDRAWING_TYPE_FREEHAND, tup_start_point); if(TSDK_SUCCESS != result) { LOG_D_DATA_CONF_ERROR("Start to create annotation failed. result=%#x", result); return SERVICE_E_SHARE_ANNOTATION_START_CREATE_FAILED; } |
应用程序界面应在创建标注过程中启动周期定时器,在检查到鼠标位置变化时调用此接口更新数据,以呈现更优的交互体验。
//c code TSDK_RESULT result = 0; unsigned int conf_handle = get_data_conf_handle(); CreateDrawingData data = {0}; /*Upodate annotation data*/ result = tsdk_annotation_create_update(conf_handle, TSDK_E_ANNOTATION_DRAWING, (void*)&data); if(TSDK_SUCCESS != result) { LOG_D_DATA_CONF_ERROR("Upodate annotation data failed. result=%#x", result); return SERVICE_E_SHARE_ANNOTATION_UPDATE_FAILED; } |
若完成标注创建,则此接口的第三个参数应设置为0,否则设置为1。
//c code TSDK_RESULT result = 0; unsigned int conf_handle = get_data_conf_handle(); /*Finish creating annotation*/ result = tsdk_annotation_create_done(conf_handle, TSDK_E_COMPONENT_WB, false, NULL); if(TSDK_SUCCESS!= result) { LOG_D_DATA_CONF_ERROR("Finish creating annotation failed. result=%#x", result); return SERVICE_E_SHARE_ANNOTATION_CREATE_FINISH_FAILED; } |
实际上,在标注创建过程中,每次数据更新之后都会收到相应的数据更新通知,当前因流程图限制,仅呈现在标注创建完成后收到数据更新通知消息。
创建文字标注
“文字标注”与“几何标注”体验不同,其他与会者只有在“文字标注”创建者完成标注创建后才会显示标注内容,即看不到文字的输入过程。
//c code TSDK_RESULT result = 0; unsigned int conf_handle = get_data_conf_handle(); TSDK_S_DOC_PAGE_BASE_INFO page_info; tsdk_memset_s(&page_info, sizeof(TSDK_S_DOC_PAGE_BASE_INFO), 0, sizeof(TSDK_S_DOC_PAGE_BASE_INFO)); TSDK_S_ANNOTATION_TEXT_INFO text_info; tsdk_memset_s(&text_info, sizeof(TSDK_S_ANNOTATION_TEXT_INFO), 0, sizeof(TSDK_S_ANNOTATION_TEXT_INFO)); TSDK_UINT32 annotation_id = 0; /*Create text annotation*/ result = tsdk_annotation_text_create(conf_handle, &page_info, &text_info, page_id, &tup_anno_text_info, &annotation_id ); if(TSDK_SUCCESS!= result) { LOG_D_DATA_CONF_ERROR("Create text annotation failed. result=%#x", result); return SERVICE_E_SHARE_ANNOTATION_TEXT_CREATE_FAILED; } |
实际上,在标注创建过程中,每次数据更新之后都会收到相应的数据更新通知,当前因流程图限制,仅呈现在标注创建完成后收到数据更新通知消息。
编辑文字标注
与会者在文字标注创建完成后,可以进行编辑操作。
//c code TSDK_RESULT result = 0; unsigned int conf_handle = get_data_conf_handle(); TSDK_S_DOC_PAGE_BASE_INFO page_info; tsdk_memset_s(&page_info, sizeof(TSDK_S_DOC_PAGE_BASE_INFO), 0, sizeof(TSDK_S_DOC_PAGE_BASE_INFO)); TSDK_S_ANNOTATION_TEXT_INFO text_info; tsdk_memset_s(&text_info, sizeof(TSDK_S_ANNOTATION_TEXT_INFO), 0, sizeof(TSDK_S_ANNOTATION_TEXT_INFO)); TSDK_UINT32 annotation_id = 0; /*Get text information of the specified annotation*/ result = tsdk_annotation_text_get_info(conf_handle, &page_info, annotation_id, &text_info); if(TSDK_SUCCESS!= result) { LOG_D_DATA_CONF_ERROR("Get text information of the specified annotation failed. result=%#x", result); return SERVICE_E_SHARE_ANNOTATION_GET_TEXT_INFO_FAILED; } |
//c code TSDK_RESULT result = 0; unsigned int conf_handle = get_data_conf_handle(); TSDK_S_DOC_PAGE_BASE_INFO page_info; tsdk_memset_s(&page_info, sizeof(TSDK_S_DOC_PAGE_BASE_INFO), 0, sizeof(TSDK_S_DOC_PAGE_BASE_INFO)); TSDK_S_ANNOTATION_TEXT_INFO text_info; tsdk_memset_s(&text_info, sizeof(TSDK_S_ANNOTATION_TEXT_INFO), 0, sizeof(TSDK_S_ANNOTATION_TEXT_INFO)); TSDK_UINT32 annotation_id = 0; TSDK_BOOL is_redraw = 0; /*Create text annotation*/ result = tsdk_annotation_text_update(conf_handle, &page_info, annotation_id , &text_info, is_redraw); if(TSDK_SUCCESS!= result) { LOG_D_DATA_CONF_ERROR("Update text annotation failed. result=%#x", result); return SERVICE_E_SHARE_ANNOTATION_UPDATE_TEXT_INFO_FAILED; } |
注意事项
无。
描述
在屏幕共享、文档共享或白板共享中,与会者可以对共享过程中创建的标注进行选中、编辑或删除操作。
前提条件:
业务流程
选中标注
//c code TSDK_RESULT result = 0; unsigned int conf_handle = get_data_conf_handle(); TSDK_S_ANNOTATION_HIT_TEST_POINT_INFO hit_test_point_info; tsdk_memset_s(&hit_test_point_info, sizeof(TSDK_S_ANNOTATION_HIT_TEST_POINT_INFO), 0, sizeof(TSDK_S_ANNOTATION_HIT_TEST_POINT_INFO)); TSDK_UINT32 select_annotation_id = 0; TSDK_E_ANNOTATION_HIT_TEST_CODE hit_test_code = TSDK_E_ANNOTATION_HIT_TEST_BUTT; TSDK_UINT32 annotation_type = 0; /*Test whether a point falls on the annotation*/ result = tsdk_annotation_hit_test_point(conf_handle, &hit_test_point_info, select_annotation_id, hit_test_code , annotation_type ); if(TSDK_SUCCESS != result) { LOG_D_DATA_CONF_ERROR("Test whether a point falls on the annotation failed. result=%#x", result); return SERVICE_E_SHARE_ANNOTATION_TEST_POINT_FAILED; } TSDK_UINT32 count = 0; TSDK_UINT32* annotation_id_list = 0; /*Test annotation in a rect*/ result = tsdk_annotation_hit_test_rect(conf_handle, &hit_test_point_info, &annotation_id_list , &count ); if(TSDK_SUCCESS != result) { LOG_D_DATA_CONF_ERROR("Test annotation in a rect failed. result=%#x", result); return SERVICE_E_SHARE_ANNOTATION_TEST_IN_RECT_FAILED; } |
设置选中状态,可以设置为选中状态或非选中状态,可以设置立刻刷新界面或不刷新界面。设置为立即刷新时,若为选中状态,界面会收到数据更新的通知,被选中的标注边框上会多出8个选中框;若为非选中状态后,边框消失。该接口只会对自己的界面产生影响,不会影响其他与会者。
//c code TSDK_RESULT result = 0; unsigned int conf_handle = get_data_conf_handle() TSDK_S_ANNOTATION_SELECT_INFO select_info; tsdk_memset_s(&select_info, sizeof(TSDK_S_ANNOTATION_SELECT_INFO), 0, sizeof(TSDK_S_ANNOTATION_SELECT_INFO)); /*Test annotation in a rect*/ result = tsdk_annotation_set_select(conf_handle, &select_info, is_redraw); if(TSDK_SUCCESS != result) { LOG_D_DATA_CONF_ERROR("Set annotation status failed. result=%#x", result); return SERVICE_E_SHARE_ANNOTATION_SET_STATUS_FAILED; } |
编辑标注
标注被选中后,与会者可以进行拖动或拉伸,以改变标注的位置或形状。
此接口可以对选中的多个标注同时开始编辑,编辑过程中,被选中的标注会一同被移动或被拉伸。
//c code TUP_RESULT result = TUP_FAIL; unsigned int conf_handle = get_data_conf_handle(); TSDK_S_DOC_PAGE_BASE_INFO page_info; tsdk_memset_s(&page_info, sizeof(TSDK_S_DOC_PAGE_BASE_INFO), 0, sizeof(TSDK_S_DOC_PAGE_BASE_INFO)); TC_POINT tup_point_info = {0}; /*Start to edit the annotation*/ result = tsdk_annotation_edit_start(conf_handle, IID_COMPONENT_WB, document_id, page_id, annotation_id, count, current_anno_id, (DS_HITTEST_CODE)edit_type, tup_point_info); if(TC_OK != result) { LOG_D_DATA_CONF_ERROR("Start to edit the annotation failed. result=%#x", result); return SERVICE_E_SHARE_ANNOTATION_EDIT_START_FAILED; } |
应用程序界面应在编辑标注过程中启动周期定时器,在检查到鼠标位置变化时调用此接口更新数据,以呈现更优的交互体验。
//c code TSDK_RESULT result = TUP_FAIL; unsigned int conf_handle = get_data_conf_handle(); TSDK_S_POINT current_point; tsdk_memset_s(¤t_point, sizeof(TSDK_S_POINT), 0, sizeof(TSDK_S_POINT)); TSDK_E_COMPONENT_ID component_id; /*Update the annotation*/ result = tsdk_annotation_edit_update(conf_handle, component_id, ¤t_point); if(TC_OK != result) { LOG_D_DATA_CONF_ERROR("Update the annotation failed. result=%#x", result); return SERVICE_E_SHARE_ANNOTATION_EDIT_UPDATE_FAILED; } |
若完成标注编辑,则此接口的第三个参数应设置为0,否则设置为1。
//c code TSDK_RESULT result = TUP_FAIL; unsigned int conf_handle = get_data_conf_handle(); /*Finish creating annotation*/ result = tsdk_annotation_edit_done(conf_handle, TSDK_E_COMPONENT_WB, is_cancel); if(TC_OK != result) { LOG_D_DATA_CONF_ERROR("Finish creating annotation failed. result=%#x", result); return SERVICE_E_SHARE_ANNOTATION_CREATE_FINISH_FAILED; } |
实际上,在标注编辑过程中,每次数据更新之后都会收到相应的数据更新通知,当前因流程图限制,仅呈现在标注编辑完成后收到数据更新通知消息。
删除标注
此接口可以对选中的多个标注同时开始删除,应用程序也可以实现对标注ID的记录管理,给用户提供删除“自己创建的标注”、“其他人创建的标注”和“所有标注”功能入口。
//c code TSDK_RESULT result; unsigned int conf_handle = get_data_conf_handle(); TSDK_S_ANNOTATION_DELETE_INFO delete_info; tsdk_memset_s(&delete_info, sizeof(TSDK_S_ANNOTATION_DELETE_INFO), 0, sizeof(TSDK_S_ANNOTATION_DELETE_INFO)); /*Delete the annotation*/ result = tsdk_annotation_delete_annotation(conf_handle, &delete_info); if(TSDK_SUCCESS != result) { LOG_D_DATA_CONF_ERROR("Delete the annotation failed. result=%#x", result); return SERVICE_E_SHARE_ANNOTATION_DELETE_FAILED; } |
注意事项
无。
描述
会议过程中,与会者进行激光点的开启、移动和停止操作。
前提条件:
业务流程
开启激光的接口中用到的坐标都是相对于页面左上角的TWIPS单位坐标,向右向下为正。
//c code TSDK_RESULT result; unsigned int conf_handle = get_data_conf_handle(); TSDK_S_ANNOTATION_LASER_POINTER_INFO laser_pointer_info; tsdk_memset_s(&laser_pointer_info,sizeof(TSDK_S_ANNOTATION_LASER_POINTER_INFO),0,sizeof(TSDK_S_ANNOTATION_LASER_POINTER_INFO)); /*Start to use laser point in annotation.*/ result = tsdk_annotation_laser_pointer_start(conf_handle, TSDK_E_COMPONENT_WB,&laser_pointer_info ); if(TSDK_SUCCESS != result) { LOG_D_DATA_CONF_ERROR("Start to use laser pointer in annotation failed. result=%#x", result); return SERVICE_E_SHARE_ANNOTATION_START_LASER_POINTER_FAILED; } |
应用程序界面应在移动激光点过程中启动周期定时器,在检查到鼠标位置变化时调用此接口更新数据,以呈现更优的交互体验。
//c code TSDK_RESULT result; unsigned int conf_handle = get_data_conf_handle(); TSDK_S_POINT point; tsdk_memset_s(&point, sizeof(TSDK_S_POINT), 0, sizeof(TSDK_S_POINT)); /*Move the laser pointer to the destination.*/ result = tsdk_annotation_laser_pointer_moveto(conf_handle, TSDK_E_COMPONENT_WB, &point); if(TSDK_SUCCESS != result) { LOG_D_DATA_CONF_ERROR("Move the laser pointer failed. result=%#x", result); return SERVICE_E_SHARE_ANNOTATION_MOVE_LASER_POINTER_FAILED; } |
//c code TSDK_RESULT result; unsigned int conf_handle = get_data_conf_handle(); /*Stop the laser pointer.*/ result = tsdk_annotation_laser_pointer_stop(conf_handle, TSDK_E_COMPONENT_WB); if(TSDK_SUCCESS != result) { LOG_D_DATA_CONF_ERROR("Stop the laser pointer failed. result=%#x", result); return SERVICE_E_SHARE_ANNOTATION_STOP_LASER_POINTER_FAILED; } |
实际上,在激光点移动过程中,每次数据更新之后都会收到相应的数据更新通知,当前因流程图限制,仅呈现在激光点结束后收到数据更新通知消息。
注意事项
无。
描述
会议过程中,某一与会者可以发送即时消息给其他所有与会者。
业务流程
//c code TSDK_RESULT ret; ret = tsdk_send_chat_msg_in_conference(confHandle, chatMsgInfo); if (TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("send chat msg failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; |
//c code case TSDK_E_CONF_EVT_RECV_CHAT_MSG: { /*Notify UI*/ } |
注意事项
当前仅提供公共消息的开放能力。