小游戏实时语音,房间有概率无法关闭,很容易重现
发布于 5 年前 作者 phe 2574 次浏览 来自 官方Issues

如题,创建了一个实时语音房间后,有概率无法关掉这个房间,导致无法再次创建新的房间

几乎所有版本都会出现这个问题,目前没发现哪个版本是好的

3 回复

麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

更新 7.0.7 试试看

IPHONE 7   系统版本IOS 12.4    微信版本7.0.5

wx.joinVoIPChat({
            signature: data.signature,//签名,用于验证小游戏的身份
            nonceStr: data.nonceStr.toString(),    //验证所需的随机字符串
            timeStamp: data.timeStamp,  //验证所需的时间戳
            groupId: data.groupId.toString(),  //小游戏内此房间/群聊的 ID。同一时刻传入相同 groupId 的用户会进入到同个实时语音房间。
            roomType: “audio”,
            muteConfig: {
                muteMicrophone: this.voiceClose,//是否静音麦克风
                muteEarphone: this.listenClose//是否静音耳机
            },
            success: res => {
                console.log(“加入语音房间成功”, res);
                this.onVoIPChatSpeakersChanged();
                this.isIn = true;
                this.voiceClose = false;
                this.listenClose = false;
                EventManager.inst.emit(NotificationNames.JOIN_TEAM_CHAT_ROOM);

            },
            fail: res => {
                var str = “”;
                if (res.errCode == -1) {
                    str = “当前已在房间内”
                } else if (res.errCode == -2) {
                    str = “录音设备被占用,可能是当前正在使用微信内语音通话或系统通话”
                }
                else if (res.errCode == -3) {
                    str = “加入会话期间退出(可能是用户主动退出,或者退后台、来电等原因),因此加入失败”
                }
                else if (res.errCode == -3) {
                    str = “系统错误”
                }
                console.log(“加入语音房间失败”, str);

            }
        })
    }

    public exitVoIPChat() {
        if (!this.checkSDKVersion() || !this.isIn) {
            return;
        }
        let isWX = typeof wx !== ‘undefined’;
        if (!isWX) {
            return
        }
        wx.exitVoIPChat({
            success: res => {
                console.log(“退出语音房间”);
                this.isIn = false;
                this.inData = null;
                this.voiceClose = false;
                this.listenClose = false;
                EventManager.inst.emit(NotificationNames.EXIT_TEAM_CHAT_ROOM);

            },
            fail: res => {
                console.log(“退出语音房间失败”);
            }
        })
    }

退出以后,再加房间,就一直在报errCode == -2

回到顶部