that.setData({
selfOpenId :res.data.data.openid
})
wx.joinVoIPChat({
'roomType':'video',
'signature':res.data.data.signature,
'nonceStr':res.data.data.nonceStr,
'timeStamp':res.data.data.timeStamp,
'groupId':res.data.data.groupId,
'muteConfig':{
'muteMicrophone':false,
'muteEarphone':false,
},
success(res){
var openIdList = res.openIdList || []
that.setData({
openIdList :openIdList
})
},
fail(res){
console.log(res)
}
});
wx.onVoIPVideoMembersChanged(function(res){
console.log(res);
})
//监听实时语音通话成员在线状态变化事件。有成员加入/退出通话时触发回调
wx.onVoIPChatMembersChanged(function(res){
that.setData({
openIdList: res.openIdList,
})
})
setTimeout(() => {
if(that.data.openIdList.length>2)
{
//订阅视频画面成员。对于视频房间,当成员超过两人时需进行订阅,否则只能看到最先加入房间的两人画面。
wx.subscribeVoIPVideoMembers({
openIdList: that.data.openIdList,
success(res){
console.log('subscribeVoIPVideoMembers success_b')
}
})
}
}, 5000);
第三人开始需用这个接口先订阅