mirror of
https://github.com/kuaifan/dootask.git
synced 2026-02-20 07:20:37 +00:00
no message
This commit is contained in:
parent
35e55b8677
commit
e2cec420fa
@ -374,22 +374,25 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 会议事件
|
// 会议事件
|
||||||
window.__onMeetingEvent = ({act, uuid, meetingid, status}) => {
|
window.__onMeetingEvent = (event) => {
|
||||||
switch (act) {
|
if (!$A.isJson(event)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (event.act) {
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
case "getInfo":
|
case "getInfo":
|
||||||
const isTourist = (uuid + '').indexOf('88888') !== -1;
|
const isTourist = (event.uuid + '').indexOf('88888') !== -1;
|
||||||
this.$store.dispatch("call", {
|
this.$store.dispatch("call", {
|
||||||
url: isTourist ? 'users/meeting/tourist' : 'users/basic',
|
url: isTourist ? 'users/meeting/tourist' : 'users/basic',
|
||||||
data: {
|
data: {
|
||||||
userid: isTourist ? uuid : (uuid + '').substring(6),
|
userid: isTourist ? event.uuid : (event.uuid + '').substring(6),
|
||||||
tourist_id: uuid,
|
tourist_id: event.uuid,
|
||||||
}
|
}
|
||||||
}).then(({data}) => {
|
}).then(({data}) => {
|
||||||
$A.eeuiAppSendMessage({
|
$A.eeuiAppSendMessage({
|
||||||
action: 'updateMeetingInfo',
|
action: 'updateMeetingInfo',
|
||||||
infos: {
|
infos: {
|
||||||
uuid: uuid,
|
uuid: event.uuid,
|
||||||
avatar: isTourist ? data?.userimg : data[0]?.userimg,
|
avatar: isTourist ? data?.userimg : data[0]?.userimg,
|
||||||
username: isTourist ? data?.nickname : data[0]?.nickname,
|
username: isTourist ? data?.nickname : data[0]?.nickname,
|
||||||
}
|
}
|
||||||
@ -406,7 +409,7 @@ export default {
|
|||||||
case "invent":
|
case "invent":
|
||||||
this.$store.dispatch("showMeetingWindow", {
|
this.$store.dispatch("showMeetingWindow", {
|
||||||
type: "invitation",
|
type: "invitation",
|
||||||
meetingid: meetingid
|
meetingid: event.meetingid
|
||||||
})
|
})
|
||||||
break;
|
break;
|
||||||
// 结束会议
|
// 结束会议
|
||||||
@ -418,18 +421,24 @@ export default {
|
|||||||
break;
|
break;
|
||||||
// 状态
|
// 状态
|
||||||
case "status":
|
case "status":
|
||||||
this.$store.state.appMeetingShow = status
|
this.$store.state.appMeetingShow = event.status
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 键盘状态
|
// 键盘状态
|
||||||
window.__onKeyboardStatus = (data) => {
|
window.__onKeyboardStatus = (event) => {
|
||||||
const message = $A.jsonParse(decodeURIComponent(data));
|
if (!$A.isJson(event)) {
|
||||||
this.$store.state.keyboardType = message.keyboardType;
|
// 兼容旧版本
|
||||||
this.$store.state.keyboardHeight = message.keyboardHeight;
|
event = $A.jsonParse(decodeURIComponent(event));
|
||||||
this.$store.state.safeAreaBottom = message.safeAreaBottom;
|
}
|
||||||
|
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) => {
|
window.__onNotificationPermissionStatus = (ret) => {
|
||||||
|
|||||||
@ -205,14 +205,12 @@ export default {
|
|||||||
// 创建会议
|
// 创建会议
|
||||||
case 'add':
|
case 'add':
|
||||||
this.addShow = data.show;
|
this.addShow = data.show;
|
||||||
this.loadIng = 0;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// 加入会议(直接加入)
|
// 加入会议(直接加入)
|
||||||
case 'join':
|
case 'join':
|
||||||
case 'direct':
|
case 'direct':
|
||||||
this.addShow = data.show;
|
this.addShow = data.show;
|
||||||
this.loadIng = 0;
|
|
||||||
this.addData.type = 'join';
|
this.addData.type = 'join';
|
||||||
if (data.meetingNickname) {
|
if (data.meetingNickname) {
|
||||||
this.addData.username = data.meetingNickname;
|
this.addData.username = data.meetingNickname;
|
||||||
@ -246,7 +244,6 @@ export default {
|
|||||||
// 加入失败
|
// 加入失败
|
||||||
case 'error':
|
case 'error':
|
||||||
this.addShow = data.show;
|
this.addShow = data.show;
|
||||||
this.loadIng = 0;
|
|
||||||
this.invitationShow = data.show;
|
this.invitationShow = data.show;
|
||||||
this.invitationLoad = false;
|
this.invitationLoad = false;
|
||||||
$A.modalError('加入会议失败');
|
$A.modalError('加入会议失败');
|
||||||
@ -352,6 +349,8 @@ export default {
|
|||||||
delete data.msgs;
|
delete data.msgs;
|
||||||
// App 直接使用新窗口打开会议
|
// App 直接使用新窗口打开会议
|
||||||
if ($A.isEEUiApp) {
|
if ($A.isEEUiApp) {
|
||||||
|
loader(true);
|
||||||
|
setTimeout(_ => loader(false), 1200)
|
||||||
$A.eeuiAppSendMessage({
|
$A.eeuiAppSendMessage({
|
||||||
action: 'startMeeting',
|
action: 'startMeeting',
|
||||||
meetingParams: {
|
meetingParams: {
|
||||||
@ -524,83 +523,86 @@ export default {
|
|||||||
|
|
||||||
async join(options) {
|
async join(options) {
|
||||||
this.loadIng++;
|
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 {
|
try {
|
||||||
this.localUser.uid = await this.agoraClient.join(options.appid, options.channel, options.token, options.uid)
|
// 音频采集设备状态变化回调
|
||||||
if (this.addData.tracks.includes("audio")) {
|
AgoraRTC.onMicrophoneChanged = async (changedDevice) => {
|
||||||
localTracks.push(this.localUser.audioTrack = await AgoraRTC.createMicrophoneAudioTrack())
|
// 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) {
|
AgoraRTC.onAutoplayFailed = () => {
|
||||||
await this.agoraClient.publish(localTracks);
|
$A.messageWarning("点击屏幕开始会议");
|
||||||
}
|
}
|
||||||
//
|
// 设置日志级别
|
||||||
this.meetingShow = true;
|
AgoraRTC.setLogLevel(window.systemInfo.debug === "yes" ? 0 : 3);
|
||||||
} catch (error) {
|
|
||||||
console.error(error)
|
// 创建客户端
|
||||||
$A.modalError("会议组件加载失败!");
|
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.addShow = false;
|
||||||
this.loadIng--;
|
this.loadIng--;
|
||||||
},
|
},
|
||||||
|
|
||||||
async leave() {
|
async leave() {
|
||||||
this.loadIng++;
|
this.loadIng++;
|
||||||
// 删除本地用户和播放器视图。
|
try {
|
||||||
['audioTrack', 'videoTrack'].some(trackName => {
|
// 删除本地用户和播放器视图。
|
||||||
this.localUser[trackName]?.stop();
|
['audioTrack', 'videoTrack'].some(trackName => {
|
||||||
this.localUser[trackName]?.close();
|
this.localUser[trackName]?.stop();
|
||||||
})
|
this.localUser[trackName]?.close();
|
||||||
this.localUser = {
|
})
|
||||||
uid: null,
|
this.localUser = {
|
||||||
audioTrack: null,
|
uid: null,
|
||||||
videoTrack: null,
|
audioTrack: null,
|
||||||
}
|
videoTrack: null,
|
||||||
// 删除远程用户和播放器视图。
|
}
|
||||||
this.remoteUsers = [];
|
// 删除远程用户和播放器视图。
|
||||||
// 离开频道
|
this.remoteUsers = [];
|
||||||
await this.agoraClient.leave();
|
// 离开频道
|
||||||
//
|
await this.agoraClient.leave();
|
||||||
|
} catch (e) { }
|
||||||
this.meetingShow = false;
|
this.meetingShow = false;
|
||||||
this.loadIng--;
|
this.loadIng--;
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
Subproject commit 5e3467b177f757e93d3b9ed9067d79a05ae31ff3
|
Subproject commit aa9a81ddbf6dc2a1a35b244e63da6a284299c65a
|
||||||
Loading…
x
Reference in New Issue
Block a user