收藏
回答

使用官方提供一对一音视频通话api发起通话对方无法收到

框架类型 问题类型 操作系统 工具版本
小程序 Bug Windows Stable 1.06.2303220

<template>

<view class="container">

<input placeholder="请输入类型" v-model="inputType" />

<button class="mt20" style="padding: 20rpx 0rpx;" @click="openChat">确定</button>

<button class="mt20 " style="padding: 20rpx 0rpx;" v-if="inputType === '1' || inputType === '2'" @click="toChat('video')">视频会话</button>

<button class="mt20" style="padding: 20rpx 0rpx;" v-if="inputType === '1' || inputType === '2'" @click="toChat('voice')">语音会话</button>

tips:1是患者端发起。2是医生端发起

</view>

</template>

<script>

export default {

data() {

return {

inputType: '',

}

},

methods: {

toChat(type) {

if (this.inputType === '1') {

wx.join1v1Chat({

caller: {

nickname: '高乐',

openid: 'oHowN5o0E5hQofZqwsnV9t_3UiJk'

},

listener: {

nickname: '张6',

openid: 'ohpu74r2z831zNKLq682YoBXAeFg'

},

roomType: type,

success: res1 => {

console.log(res1)

},

fail: e1 => {

console.log(e1)

uni.showToast({

title: '开启会话失败',

icon: 'none'

})

}

})

} else if (this.inputType === '2') {

wx.join1v1Chat({

caller: {

nickname: '张6',

openid: 'ohpu74r2z831zNKLq682YoBXAeFg'

},

listener: {

nickname: '高乐',

openid: 'oHowN5o0E5hQofZqwsnV9t_3UiJk'

},

roomType: type,

success: res1 => {

console.log(res1)

},

fail: e1 => {

console.log(e1)

uni.showToast({

title: '开启会话失败',

icon: 'none'

})

}

})

}

},


openChat() {

if (!this.inputType) {

return uni.showToast({

title: '先输入类型1或者2',

icon: 'none'

})

}

wx.setEnable1v1Chat({

enable: true,

success: res => {

uni.showToast({

title: '支持音视频',

duration: 2000

})

},

fail: e => {

console.log(e)

uni.showToast({

title: `${JSON.stringify(e.errMsg)},错误码:${e.errCode}`,

icon: 'none',

duration: 2500

})

}

})

}

}

}

</script>


最后一次编辑于  2023-05-12
回答关注问题邀请回答
收藏

1 个回答

  • undefined
    undefined
    2023-05-12

    wx.setEnable1v1Chat的enable设置为true了,对方收不到

    appid:wxb80ba3190eeb8909

    2023-05-12
    有用
    回复
登录 后发表内容