音视频通话

房间外点对点消息

功能介绍

实现点对点的透明消息发送功能, 根据发送内容可选择:发送命令数据, 发送内存数据二种类型。

1.发送命令数据

此接口发送的数据不能被 cancelSend,一次性发送,也不会有进度通知。

  • 调用接口:
// 回调监听
RtcSDK.transpChannelManager.setListener(TranspChannelListener(
	onSendProgress: (String taskId, int sendedLen, int totalLen, String? cookie) {}, // 发送数据时,通知发送进度
	onNotifyCmdData: (String sourceUserId, String data) {},// 通知收到小块数据
	onNotifyBufferData: (String sourceUserId, String data) {}, // 通知收到大块数据
	onNotifyFileData: (String sourceUserId, String tmpFile, String orgFileName) {}, // 通知收到文件数据
	onNotifyCancelSend: (String taskId) {}, // 通知取消发送
));

// 发送小块数据,sendId为分配的任务ID
SendResult result = await RtcSDK.transpChannelManager.sendCmd(targetUserId, "发送小块数据");

相关 API 请参考:

相关结构定义请参考:

2.发送内存数据

分块发送,进度通知事件onSendProgress, 调用cancelSend取消发送。

  • 调用接口:
//发送内存数据,sendId为分配的任务ID
SendResult result = await RtcSDK.transpChannelManager.sendBuffer(targetUserId, "发送大块数据");

相关 API 请参考:

3.发送文件

分块发送,进度通知事件onSendProgress, 调用cancelSend取消发送。

  • 调用接口:
SendResult result = await RtcSDK.transpChannelManager.sendFile(targetUserId, locPathFileName);

相关 API 请参考:

4.取消发送

  • 调用接口:
//取消发送数据,sendId为要取消的任务ID
RtcSDK.transpChannelManager.cancelSend(sendId)

相关 API 请参考: