no message

This commit is contained in:
kuaifan 2024-11-10 13:56:50 +08:00
parent 35e55b8677
commit e2cec420fa
3 changed files with 95 additions and 84 deletions

View File

@ -374,22 +374,25 @@ export default {
})
}
//
window.__onMeetingEvent = ({act, uuid, meetingid, status}) => {
switch (act) {
window.__onMeetingEvent = (event) => {
if (!$A.isJson(event)) {
return;
}
switch (event.act) {
//
case "getInfo":
const isTourist = (uuid + '').indexOf('88888') !== -1;
const isTourist = (event.uuid + '').indexOf('88888') !== -1;
this.$store.dispatch("call", {
url: isTourist ? 'users/meeting/tourist' : 'users/basic',
data: {
userid: isTourist ? uuid : (uuid + '').substring(6),
tourist_id: uuid,
userid: isTourist ? event.uuid : (event.uuid + '').substring(6),
tourist_id: event.uuid,
}
}).then(({data}) => {
$A.eeuiAppSendMessage({
action: 'updateMeetingInfo',
infos: {
uuid: uuid,
uuid: event.uuid,
avatar: isTourist ? data?.userimg : data[0]?.userimg,
username: isTourist ? data?.nickname : data[0]?.nickname,
}
@ -406,7 +409,7 @@ export default {
case "invent":
this.$store.dispatch("showMeetingWindow", {
type: "invitation",
meetingid: meetingid
meetingid: event.meetingid
})
break;
//
@ -418,18 +421,24 @@ export default {
break;
//
case "status":
this.$store.state.appMeetingShow = status
this.$store.state.appMeetingShow = event.status
break;
default:
break;
}
}
//
window.__onKeyboardStatus = (data) => {
const message = $A.jsonParse(decodeURIComponent(data));
this.$store.state.keyboardType = message.keyboardType;
this.$store.state.keyboardHeight = message.keyboardHeight;
this.$store.state.safeAreaBottom = message.safeAreaBottom;
window.__onKeyboardStatus = (event) => {
if (!$A.isJson(event)) {
//
event = $A.jsonParse(decodeURIComponent(event));
}
if (!$A.isJson(event)) {
return;
}
this.$store.state.keyboardType = event.keyboardType;
this.$store.state.keyboardHeight = event.keyboardHeight;
this.$store.state.safeAreaBottom = event.safeAreaBottom;
}
//
window.__onNotificationPermissionStatus = (ret) => {

View File

@ -205,14 +205,12 @@ export default {
//
case 'add':
this.addShow = data.show;
this.loadIng = 0;
break;
//
case 'join':
case 'direct':
this.addShow = data.show;
this.loadIng = 0;
this.addData.type = 'join';
if (data.meetingNickname) {
this.addData.username = data.meetingNickname;
@ -246,7 +244,6 @@ export default {
//
case 'error':
this.addShow = data.show;
this.loadIng = 0;
this.invitationShow = data.show;
this.invitationLoad = false;
$A.modalError('加入会议失败');
@ -352,6 +349,8 @@ export default {
delete data.msgs;
// App 使
if ($A.isEEUiApp) {
loader(true);
setTimeout(_ => loader(false), 1200)
$A.eeuiAppSendMessage({
action: 'startMeeting',
meetingParams: {
@ -524,83 +523,86 @@ export default {
async join(options) {
this.loadIng++;
//
AgoraRTC.onMicrophoneChanged = async (changedDevice) => {
// When plugging in a device, switch to a device that is newly plugged in.
if (changedDevice.state === "ACTIVE") {
this.localUser.audioTrack?.setDevice(changedDevice.device.deviceId);
// Switch to an existing device when the current device is unplugged.
} else if (changedDevice.device.label === this.localUser.audioTrack?.getTrackLabel()) {
const oldMicrophones = await AgoraRTC.getMicrophones();
oldMicrophones[0] && this.localUser.audioTrack?.setDevice(oldMicrophones[0].deviceId);
}
}
//
AgoraRTC.onCameraChanged = async (changedDevice) => {
// When plugging in a device, switch to a device that is newly plugged in.
if (changedDevice.state === "ACTIVE") {
this.localUser.videoTrack?.setDevice(changedDevice.device.deviceId);
// Switch to an existing device when the current device is unplugged.
} else if (changedDevice.device.label === this.localUser.videoTrack?.getTrackLabel()) {
const oldCameras = await AgoraRTC.getCameras();
oldCameras[0] && this.localUser.videoTrack?.setDevice(oldCameras[0].deviceId);
}
}
//
AgoraRTC.onAutoplayFailed = () => {
$A.messageWarning("点击屏幕开始会议");
}
//
AgoraRTC.setLogLevel(window.systemInfo.debug === "yes" ? 0 : 3);
//
this.agoraClient = AgoraRTC.createClient({mode: "rtc", codec: "vp8"});
//
this.agoraClient.on("user-joined", this.handleUserJoined);
this.agoraClient.on("user-left", this.handleUserLeft);
this.agoraClient.on("user-published", this.handleUserPublished);
this.agoraClient.on("user-unpublished", this.handleUserUnpublished);
//
const localTracks = [];
try {
this.localUser.uid = await this.agoraClient.join(options.appid, options.channel, options.token, options.uid)
if (this.addData.tracks.includes("audio")) {
localTracks.push(this.localUser.audioTrack = await AgoraRTC.createMicrophoneAudioTrack())
//
AgoraRTC.onMicrophoneChanged = async (changedDevice) => {
// When plugging in a device, switch to a device that is newly plugged in.
if (changedDevice.state === "ACTIVE") {
this.localUser.audioTrack?.setDevice(changedDevice.device.deviceId);
// Switch to an existing device when the current device is unplugged.
} else if (changedDevice.device.label === this.localUser.audioTrack?.getTrackLabel()) {
const oldMicrophones = await AgoraRTC.getMicrophones();
oldMicrophones[0] && this.localUser.audioTrack?.setDevice(oldMicrophones[0].deviceId);
}
}
if (this.addData.tracks.includes("video")) {
localTracks.push(this.localUser.videoTrack = await AgoraRTC.createCameraVideoTrack())
//
AgoraRTC.onCameraChanged = async (changedDevice) => {
// When plugging in a device, switch to a device that is newly plugged in.
if (changedDevice.state === "ACTIVE") {
this.localUser.videoTrack?.setDevice(changedDevice.device.deviceId);
// Switch to an existing device when the current device is unplugged.
} else if (changedDevice.device.label === this.localUser.videoTrack?.getTrackLabel()) {
const oldCameras = await AgoraRTC.getCameras();
oldCameras[0] && this.localUser.videoTrack?.setDevice(oldCameras[0].deviceId);
}
}
//
if (localTracks.length > 0) {
await this.agoraClient.publish(localTracks);
//
AgoraRTC.onAutoplayFailed = () => {
$A.messageWarning("点击屏幕开始会议");
}
//
this.meetingShow = true;
} catch (error) {
console.error(error)
$A.modalError("会议组件加载失败!");
}
//
AgoraRTC.setLogLevel(window.systemInfo.debug === "yes" ? 0 : 3);
//
this.agoraClient = AgoraRTC.createClient({mode: "rtc", codec: "vp8"});
//
this.agoraClient.on("user-joined", this.handleUserJoined);
this.agoraClient.on("user-left", this.handleUserLeft);
this.agoraClient.on("user-published", this.handleUserPublished);
this.agoraClient.on("user-unpublished", this.handleUserUnpublished);
//
const localTracks = [];
try {
this.localUser.uid = await this.agoraClient.join(options.appid, options.channel, options.token, options.uid)
if (this.addData.tracks.includes("audio")) {
localTracks.push(this.localUser.audioTrack = await AgoraRTC.createMicrophoneAudioTrack())
}
if (this.addData.tracks.includes("video")) {
localTracks.push(this.localUser.videoTrack = await AgoraRTC.createCameraVideoTrack())
}
//
if (localTracks.length > 0) {
await this.agoraClient.publish(localTracks);
}
//
this.meetingShow = true;
} catch (error) {
console.error(error)
$A.modalError("会议组件加载失败!");
}
} catch (e) { }
this.addShow = false;
this.loadIng--;
},
async leave() {
this.loadIng++;
//
['audioTrack', 'videoTrack'].some(trackName => {
this.localUser[trackName]?.stop();
this.localUser[trackName]?.close();
})
this.localUser = {
uid: null,
audioTrack: null,
videoTrack: null,
}
//
this.remoteUsers = [];
//
await this.agoraClient.leave();
//
try {
//
['audioTrack', 'videoTrack'].some(trackName => {
this.localUser[trackName]?.stop();
this.localUser[trackName]?.close();
})
this.localUser = {
uid: null,
audioTrack: null,
videoTrack: null,
}
//
this.remoteUsers = [];
//
await this.agoraClient.leave();
} catch (e) { }
this.meetingShow = false;
this.loadIng--;
},

@ -1 +1 @@
Subproject commit 5e3467b177f757e93d3b9ed9067d79a05ae31ff3
Subproject commit aa9a81ddbf6dc2a1a35b244e63da6a284299c65a