收藏
回答

voip-room黑屏问题?

组件:voip-room

API:wx.joinVoIPChat

微信版本号:android(7.0.22),ios(7.0.20)

基础库:2.14.1

问题:

1、A加入视频会议,A视频画面显示正常

2、B加入视频会议,B小程序中A、B视频画面显示正常;A小程序中B画面是黑屏

3、C加入视频会议,C小程序中,B视频画面黑屏,A,C显示正常;B小程序中,C画面黑屏,A,B显示正常;A小程序中,C画面黑屏,A,B显示正常。

请问一下这个是什么原因,我看代码中订阅和加入退出事件处理都已添加并生效的。一直没有找到相关原因,请大家指教一下。

wxml 代码

  <block wx:for="{{openIdList}}wx:key="item">

    <block wx:if="{{selfOpenId === item }}">

      <voip-room openid="{{item}}"

        class="room{{fullScreenOpenId==item ? ' full-screen' : ''}}{{(fullScreenOpenId!='' && fullScreenOpenId!=item) ? 'hide' : ''}}"

        data-openId="{{item}}mode="{{selfOpenId === item ? 'camera' : 'video'}}binderror="roomError"

        device-position="{{cameraDirection ? 'front' : 'back'}}catchtap="onClickVideo"></voip-room>

    </block>

    <block wx:else>

      <voip-room openid="{{item}}"

        class="room{{fullScreenOpenId==item ? ' full-screen' : ''}}{{(fullScreenOpenId!='' && fullScreenOpenId!=item) ? 'hide' : ''}}"

        data-openId="{{item}}mode="{{selfOpenId === item ? 'camera' : 'video'}}binderror="roomError"

        catchtap="onClickVideo"></voip-room>

    </block>

  </block>

js代码

wx.joinVoIPChat({

                  roomType: "video",

                  signature: res.data.result.data.signature,

                  nonceStr: res.data.result.data.nonceStr,

                  timeStamp: res.data.result.data.timestamp,

                  groupId: res.data.result.data.groupId,

                  success: function (e) {

                    console.log("调用微信加入会议接口成功");

                    console.log(e);

                    that.setData({

                      openIdList: e.openIdList

                    });

                    //订阅视频画面成员。对于视频房间,当成员超过两人时需进行订阅,否则只能看到最先加入房间的两人画面。

                    wx.subscribeVoIPVideoMembers({

                      openIdList: e.openIdList,

                      success(res) {

                        console.log('subscribeVoIPVideoMembers success')

                      }

                    })


                    //监听实时语音通话成员在线状态变化事件。有成员加入/退出通话时触发回调

                    wx.onVoIPChatMembersChanged(function (res) {

                      console.log('onVoIPChatMembersChanged success')

                      that.setData({

                        openIdList: res.openIdList

                      })

                      //订阅视频画面成员。对于视频房间,当成员超过两人时需进行订阅,否则只能看到最先加入房间的两人画面。

                      wx.subscribeVoIPVideoMembers({

                        openIdList: res.openIdList,

                        success(res) {

                          console.log('subscribeVoIPVideoMembers success_b')

                        }

                      })

                    })

                  },

                  fail: function (e) {

                    console.log("调用微信加入会议接口失败");

                  },

                  complete: function (e) {

                    console.log("调用微信加入会议接口完成");

                    wx.hideLoading({

                      success: (res) => {},

                    })

                  }

                });


回答关注问题邀请回答
收藏

2 个回答

  • 江成
    江成
    2021-01-08

    代码补充

    wxml code

     <block wx:for="{{openIdList}}" wx:key="item">

        <block wx:if="{{selfOpenId === item }}">

          <voip-room openid="{{item}}"

            class="room{{fullScreenOpenId==item ? ' full-screen' : ''}}{{(fullScreenOpenId!='' && fullScreenOpenId!=item) ? 'hide' : ''}}"

            data-openId="{{item}}" mode="{{selfOpenId === item ? 'camera' : 'video'}}" binderror="roomError"

            device-position="{{cameraDirection ? 'front' : 'back'}}" catchtap="onClickVideo"></voip-room>

        </block>

        <block wx:else>

          <voip-room openid="{{item}}"

            class="room{{fullScreenOpenId==item ? ' full-screen' : ''}}{{(fullScreenOpenId!='' && fullScreenOpenId!=item) ? 'hide' : ''}}"

            data-openId="{{item}}" mode="{{selfOpenId === item ? 'camera' : 'video'}}" binderror="roomError"

            catchtap="onClickVideo"></voip-room>

        </block>

      </block>



    JS CODE

    wx.joinVoIPChat({

                      roomType: "video",

                      signature: res.data.result.data.signature,

                      nonceStr: res.data.result.data.nonceStr,

                      timeStamp: res.data.result.data.timestamp,

                      groupId: res.data.result.data.groupId,

                      success: function (e) {

                        console.log("调用微信加入会议接口成功");

                        console.log(e);

                        that.setData({

                          openIdList: e.openIdList

                        });

                        //订阅视频画面成员。对于视频房间,当成员超过两人时需进行订阅,否则只能看到最先加入房间的两人画面。

                        wx.subscribeVoIPVideoMembers({

                          openIdList: e.openIdList,

                          success(res) {

                            console.log('subscribeVoIPVideoMembers success')

                          }

                        })


                        //监听实时语音通话成员在线状态变化事件。有成员加入/退出通话时触发回调

                        wx.onVoIPChatMembersChanged(function (res) {

                          console.log('onVoIPChatMembersChanged success')

                          that.setData({

                            openIdList: res.openIdList

                          })

                          //订阅视频画面成员。对于视频房间,当成员超过两人时需进行订阅,否则只能看到最先加入房间的两人画面。

                          wx.subscribeVoIPVideoMembers({

                            openIdList: res.openIdList,

                            success(res) {

                              console.log('subscribeVoIPVideoMembers success_b')

                            }

                          })

                        })

                      },

                      fail: function (e) {

                        console.log("调用微信加入会议接口失败");

                      },

                      complete: function (e) {

                        console.log("调用微信加入会议接口完成");

                        wx.hideLoading({

                          success: (res) => {},

                        })

                      }

                    });

    2021-01-08
    有用
    回复
  • Mr.Zhang
    Mr.Zhang
    2021-01-08

    这代码一行黑一行白的,看着眼都花了~~

    2021-01-08
    有用
    回复 1
    • 江成
      江成
      2021-01-08
      不好意思,复制出来就这样,我重新发一下。
      2021-01-08
      回复
登录 后发表内容
问题标签