多人音视频对话
用于实现小程序内多人音视频对话的功能。
申请开通
小程序管理后台,「开发」-「接口设置」中自助开通该组件权限。相关接口 wx.joinVoIPChat 和组件 voip-room。
调用流程
开发者仅需提供房间唯一标识,即可加入到指定的房间。传入相同唯一标识的用户,会进到相同的房间。为了保证前端传入的 groupId 可信,wx.joinVoIPChat 接口要求传入签名。详见下文 签名算法。当加入视频房间时,可结合 voip-room 组件显示成员画面。
前端接口
创建/加入房间:wx.joinVoIPChat
离开房间:wx.exitVoIPChat
更新房间麦克风/耳机静音设置:wx.updateVoIPChatMuteConfig
监听房间成员变化:wx.onVoIPChatMembersChanged
监听房间成员通话状态变化:wx.onVoIPChatSpeakersChanged
监听通话中断:wx.onVoIPChatInterrupted
监听实时语音通话成员视频状态变化:wx.onOnVoIPVid