本文介绍群组通话功能的使用,如发起群组通话、加入群组通话。
预期效果
TUICallKit 支持群组通话,预期效果见下图。
发起群组通话 | 收到群组通话邀请 | 接受群组通话邀请 |
![]() | ![]() | ![]() |
发起多人通话
调用 calls API 发起群通话。
const TUICallKit = uni.requireNativePlugin('TencentCloud-TUICallKit');const options = {userIDList: ['mike', 'tom'],callMediaType: 1, // voice call(callMediaType = 1)、video call(callMediaType = 2)};TUICallKit.calls(options, (res) => {if (res.code === 0) {console.log('call success');} else {console.log(`call failed, error message = ${res.msg}`);}});
加入通话
调用 join API 主动加入群组中已有的音视频通话。
const TUICallKit = uni.requireNativePlugin('TencentCloud-TUICallKit');const options = {callId: 'xxx',};TUICallKit.join(options, (res) => {if (res.code === 0) {console.log('join success');} else {console.log(`join failed, error message = ${res.msg}`);}});