js代码
const TUICallKit = uni.requireNativePlugin("TencentCloud-TUICallKit");
// #endif
import openTool from './openTool.vue'
export default {
emits: ['tryagin','longpressItem'],
name: 'chat-item',
components:{
openTool
},
props: {
item: {
type: Object,
default: {}
},
talkTo: {
type: Object,
default: {}
},
itemKey: {
type: Number
},
longTapItemKey: {
type: [Number,String],
default:''
}
},
watch:{
longTapItemKey(v){
if(this.itemKey==v){
this.$refs['toolx'+v].showTab();
}
}
},
data() {
return {
innerAudioContext:'',
paused:false,
showTrs:false,
};
},
methods: {
sendVoiceCall(){
//发起语音
uni.showLoading({
title:'发起语音通话'
})
var formdata={
userId: this.talkTo.userId,
msgType: "TRTC_VOICE_START",
content: "TRTC_VOICE_START"
}
this.$http.request({
url: '/chat/sendMsg',
method: 'POST',
data: JSON.stringify(formdata),
success: (res) => {
if(res.data.code=='200'){
if(res.data.data.status!=='0'){
uni.showToast({
title:res.data.data.statusLabel,
icon:'none'
})
return
}
var userInfo=res.data.data.userInfo
var data={
userId:userInfo.userId,
trtcId:userInfo.trtcId,
nickName:userInfo.nickName,
portrait:userInfo.portrait,
startTime:new Date().getTime(),
type:'audio'
}
uni.setStorage({
key: 'call',
data: JSON.stringify(data),
success: function () {
console.log('success');
TUICallKit.call({
userID: userInfo.trtcId,
type: 1
})
}
});
}
}
});
},
}
插件用的是hbr插件市场最新版的TencentCloud-TUICallKit;
点击发起通话后一直提示报错
09:44:25.832 TypeError: Cannot read property 'call' of undefined;
没搞明白TUICallKit.call 调用call发起通话为什么会报错,
请问这个是哪里的问题呢?
相似问题