This commit is contained in:
parent
dddd1e16f5
commit
61c37c4b59
|
|
@ -25,6 +25,9 @@ Page({
|
|||
key: 'isConnected',
|
||||
success(res: any) {
|
||||
if (res.data) {
|
||||
that.setData({
|
||||
isJoin: false
|
||||
})
|
||||
that.setData({
|
||||
netWorkErrorDialog: true,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -214,16 +214,7 @@ Page({
|
|||
this.changeAgoraDevice()
|
||||
}
|
||||
}).catch(() => {
|
||||
wx.setStorage({
|
||||
key: "isConnected",
|
||||
data: true
|
||||
})
|
||||
wx.disableAlertBeforeUnload({
|
||||
complete: () => {
|
||||
onStop()
|
||||
wx.navigateBack()
|
||||
}
|
||||
})
|
||||
this.setIsConnectedBack()
|
||||
})
|
||||
}, 1000 * 30)
|
||||
}
|
||||
|
|
@ -379,6 +370,18 @@ Page({
|
|||
isAutoApplySpeakTime = ''
|
||||
}
|
||||
},
|
||||
setIsConnectedBack() {
|
||||
wx.setStorage({
|
||||
key: "isConnected",
|
||||
data: true
|
||||
})
|
||||
wx.disableAlertBeforeUnload({
|
||||
complete: () => {
|
||||
onStop()
|
||||
wx.navigateBack()
|
||||
}
|
||||
})
|
||||
},
|
||||
showInputPopup() {
|
||||
this.setData({
|
||||
inputPopupVisible: true,
|
||||
|
|
@ -706,7 +709,21 @@ Page({
|
|||
agora.renewToken(res.data)
|
||||
}
|
||||
})
|
||||
},
|
||||
updateUrl: (e) => {
|
||||
const roomUserListTemp = [...this.data.roomUserList]
|
||||
const item = roomUserListTemp.find(row => row.uid == e.uid || row.screenShareId == e.uid)
|
||||
if (item) {
|
||||
if (String(e.uid).length === 9) {
|
||||
item.shareSrc = e.url;
|
||||
} else {
|
||||
item.src = e.url;
|
||||
}
|
||||
}
|
||||
},
|
||||
error: (e) => {
|
||||
this.setIsConnectedBack()
|
||||
},
|
||||
})
|
||||
},
|
||||
async getRoomUser(): Promise<void> {
|
||||
|
|
@ -1166,16 +1183,7 @@ Page({
|
|||
if (res.isConnected && (res.networkType !== 'none' || res.networkType !== 'unknown')) {
|
||||
|
||||
} else {
|
||||
wx.setStorage({
|
||||
key: "isConnected",
|
||||
data: true
|
||||
})
|
||||
wx.disableAlertBeforeUnload({
|
||||
complete: () => {
|
||||
onStop()
|
||||
wx.navigateBack()
|
||||
}
|
||||
})
|
||||
this.setIsConnectedBack()
|
||||
}
|
||||
},
|
||||
closeRoom() {
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ export const agora = {
|
|||
client.renewToken(token)
|
||||
},
|
||||
// 监听
|
||||
clientEvent: ({ streamAdded, streamRemoved, tokenRef }) => {
|
||||
clientEvent: ({ streamAdded, streamRemoved, tokenRef, updateUrl, error }: any) => {
|
||||
client.on("stream-added", async e => {
|
||||
await agora.subscribe(e.uid, (url: string, uid: number | string) => {
|
||||
streamAdded(url, uid)
|
||||
|
|
@ -76,6 +76,12 @@ export const agora = {
|
|||
client.on("token-privilege-will-expire", async e => {
|
||||
tokenRef()
|
||||
});
|
||||
client.on("error", async e => {
|
||||
error()
|
||||
});
|
||||
client.on("update-url", async e => {
|
||||
updateUrl(e)
|
||||
});
|
||||
},
|
||||
// 订阅远端音视频流
|
||||
subscribe: async (uid: number | string, callBack: Function) => {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
// const apiBase = "http://192.168.2.9:5192"
|
||||
const apiBase = "https://meeting-api.23544.com/pc"
|
||||
// const apiBase = "https://meeting-api.23544.com/test29"
|
||||
import { Message } from 'tdesign-miniprogram';
|
||||
export const Request = (params) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
wx.getStorage({
|
||||
|
|
@ -47,21 +46,12 @@ function requestMethods(obj, callback) {
|
|||
callback('success', res)
|
||||
},
|
||||
fail: res => {
|
||||
if (res.errMsg === 'request:fail timeout') {
|
||||
Message.error({
|
||||
context: this,
|
||||
offset: [20, 32],
|
||||
duration: 2000,
|
||||
content: '网络连接超时,请检查网络状态',
|
||||
});
|
||||
}
|
||||
if (res.errMsg === 'request:fail ') {
|
||||
Message.error({
|
||||
context: this,
|
||||
offset: [20, 32],
|
||||
duration: 2000,
|
||||
content: '网络已断开,请检查网络状态',
|
||||
});
|
||||
if (res.errno === 5) {
|
||||
wx.showToast({
|
||||
icon: 'error',
|
||||
title: '网络连接超时,请检查网络状态',
|
||||
mask: true
|
||||
})
|
||||
}
|
||||
callback('fail', res)
|
||||
},
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ export const onSignalr = (callBack: Function) => {
|
|||
}
|
||||
}
|
||||
export const onStop = async () => {
|
||||
agora.destroy();
|
||||
await agora.destroy();
|
||||
if (connection) {
|
||||
connection.stop()
|
||||
connection = '';
|
||||
|
|
|
|||
Loading…
Reference in New Issue