yangjie #49
|
|
@ -13,7 +13,7 @@ import ImageUrl from '@/utils/package/imageUrl'
|
||||||
import { agora } from '@/utils/package/agora'
|
import { agora } from '@/utils/package/agora'
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import durationPlugin from 'dayjs/plugin/duration';
|
import durationPlugin from 'dayjs/plugin/duration';
|
||||||
import { AudioVolumeInfo, ConnectionChangedReasonType, ConnectionStateType, LocalVideoStreamReason, LocalVideoStreamState, RenderModeType, RtcConnection, RtcStats, UserOfflineReasonType, VideoSourceType, VideoStreamType } from 'agora-electron-sdk';
|
import { AudioVolumeInfo, ConnectionChangedReasonType, ConnectionStateType, LocalVideoStreamReason, LocalVideoStreamState, RenderModeType, RtcConnection, RtcStats, StreamPublishState, UserOfflineReasonType, VideoSourceType, VideoStreamType } from 'agora-electron-sdk';
|
||||||
import Avatar from '@/components/Avatar';
|
import Avatar from '@/components/Avatar';
|
||||||
import SharedFilesModel from '@/components/SharedFilesModel';
|
import SharedFilesModel from '@/components/SharedFilesModel';
|
||||||
import StupWizard from '@/components/StupWizard';
|
import StupWizard from '@/components/StupWizard';
|
||||||
|
|
@ -158,6 +158,8 @@ const Meeting: React.FC = () => {
|
||||||
itemIndex: 0,
|
itemIndex: 0,
|
||||||
rowIndex: 0,
|
rowIndex: 0,
|
||||||
});
|
});
|
||||||
|
const [audioStatus, setAudioStatus] = useState<StreamPublishState>(1);
|
||||||
|
const [videoStatus, setVideoStatus] = useState<StreamPublishState>(1);
|
||||||
const [roomUserList, setRoomUserList] = useState<any>([])
|
const [roomUserList, setRoomUserList] = useState<any>([])
|
||||||
const [_speackUid, setSpeackUid] = useState<any>([])
|
const [_speackUid, setSpeackUid] = useState<any>([])
|
||||||
const [currentSpeakUser, setCurrentSpeakUser] = useState<any>([])
|
const [currentSpeakUser, setCurrentSpeakUser] = useState<any>([])
|
||||||
|
|
@ -1182,6 +1184,56 @@ const Meeting: React.FC = () => {
|
||||||
return () => clearTimeout(timer);
|
return () => clearTimeout(timer);
|
||||||
}, [isClickedMediaSteam]);
|
}, [isClickedMediaSteam]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let timer: NodeJS.Timeout | string = '';
|
||||||
|
if (audioStatus === 1 && videoStatus === 1) {
|
||||||
|
if (timer) {
|
||||||
|
clearTimeout(timer)
|
||||||
|
timer = ''
|
||||||
|
}
|
||||||
|
timer = setTimeout(() => {
|
||||||
|
setRoomUserList((res: any) => {
|
||||||
|
let userItem = res.find((item: any) => item.uid === userInfo.uid)
|
||||||
|
if (!role.ID.includes(userInfo.roleId) && userItem && userItem.isRoomManager) {
|
||||||
|
DeleteRoomManager({
|
||||||
|
roomId: state.roomId,
|
||||||
|
roomNum: state.channelId,
|
||||||
|
userId: userInfo.uid
|
||||||
|
})
|
||||||
|
confirm({
|
||||||
|
title: '提示',
|
||||||
|
icon: <ExclamationCircleFilled />,
|
||||||
|
content: `由于您长时间未发言,已自动取消发言权限,是否重新申请发言?`,
|
||||||
|
centered: true,
|
||||||
|
okText: '确定',
|
||||||
|
cancelText: '取消',
|
||||||
|
async onOk() {
|
||||||
|
GetApplySpeak(state.channelId).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
setIsClicked(true);
|
||||||
|
message.success('申请发言成功')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
clearTimeout(timer)
|
||||||
|
timer = ''
|
||||||
|
return res
|
||||||
|
})
|
||||||
|
}, 1000 * 60 * 5);
|
||||||
|
} else {
|
||||||
|
if (timer) {
|
||||||
|
clearTimeout(timer)
|
||||||
|
timer = ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return () => timer ? clearTimeout(timer) : '';
|
||||||
|
}, [audioStatus, videoStatus]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let timer: NodeJS.Timeout | undefined;
|
let timer: NodeJS.Timeout | undefined;
|
||||||
if (timer) {
|
if (timer) {
|
||||||
|
|
@ -1411,7 +1463,13 @@ const Meeting: React.FC = () => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
|
onVideoPublishStateChanged: (_source: VideoSourceType, _channel: string, _oldState: StreamPublishState, newState: StreamPublishState, _elapseSinceLastState: number) => {
|
||||||
|
setVideoStatus(newState)
|
||||||
|
},
|
||||||
|
onAudioPublishStateChanged: (_channel: string, _oldState: StreamPublishState, newState: StreamPublishState, _elapseSinceLastState: number) => {
|
||||||
|
setAudioStatus(newState)
|
||||||
|
},
|
||||||
})
|
})
|
||||||
if (state.enableCamera) {
|
if (state.enableCamera) {
|
||||||
await agora.startCameraCapture()
|
await agora.startCameraCapture()
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,8 @@ import {
|
||||||
ColorEnhanceOptions,
|
ColorEnhanceOptions,
|
||||||
LowlightEnhanceOptions,
|
LowlightEnhanceOptions,
|
||||||
VirtualBackgroundSource,
|
VirtualBackgroundSource,
|
||||||
AudienceLatencyLevelType
|
AudienceLatencyLevelType,
|
||||||
|
StreamPublishState
|
||||||
} from "agora-electron-sdk";
|
} from "agora-electron-sdk";
|
||||||
import { GetRoomRtcToken, GetAgoraConf } from "@/api/Home/Index";
|
import { GetRoomRtcToken, GetAgoraConf } from "@/api/Home/Index";
|
||||||
import { storage } from '@/utils';
|
import { storage } from '@/utils';
|
||||||
|
|
@ -151,7 +152,7 @@ export const agora = {
|
||||||
}, 1000);
|
}, 1000);
|
||||||
},
|
},
|
||||||
// 事件回调
|
// 事件回调
|
||||||
registerEventHandler: ({ onJoinChannelSuccess, onUserJoined, onUserOffline, onAudioVolumeIndication, onRtcStats, onConnectionStateChanged, onLocalVideoStateChanged, onConnectionLost, onTokenPrivilegeWillExpire }: any) => {
|
registerEventHandler: ({ onJoinChannelSuccess, onUserJoined, onUserOffline, onAudioVolumeIndication, onRtcStats, onConnectionStateChanged, onLocalVideoStateChanged, onConnectionLost, onTokenPrivilegeWillExpire, onVideoPublishStateChanged, onAudioPublishStateChanged }: any) => {
|
||||||
rtcEngine.registerEventHandler({
|
rtcEngine.registerEventHandler({
|
||||||
// 监听本地用户加入频道事件
|
// 监听本地用户加入频道事件
|
||||||
onJoinChannelSuccess: async (connection: RtcConnection, elapsed: number) => {
|
onJoinChannelSuccess: async (connection: RtcConnection, elapsed: number) => {
|
||||||
|
|
@ -166,17 +167,13 @@ export const agora = {
|
||||||
await onUserOffline?.(connection, remoteUid, reason)
|
await onUserOffline?.(connection, remoteUid, reason)
|
||||||
},
|
},
|
||||||
// // 视频发布状态改变回调
|
// // 视频发布状态改变回调
|
||||||
// onVideoPublishStateChanged: (source: any, channel: any, oldState: any, newState: any, elapseSinceLastState: any) => {
|
onVideoPublishStateChanged: (source: VideoSourceType, channel: string, oldState: StreamPublishState, newState: StreamPublishState, elapseSinceLastState: number) => {
|
||||||
// if (newState === 1) {
|
onVideoPublishStateChanged?.(source, channel, oldState, newState, elapseSinceLastState)
|
||||||
|
},
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// // 音频发布状态改变回调
|
// // 音频发布状态改变回调
|
||||||
// onAudioPublishStateChanged: (channel: any, oldState: any, newState: any, elapseSinceLastState: any) => {
|
onAudioPublishStateChanged: (channel: string, oldState: StreamPublishState, newState: StreamPublishState, elapseSinceLastState: number) => {
|
||||||
// if (newState === 1) {
|
onAudioPublishStateChanged?.(channel, oldState, newState, elapseSinceLastState)
|
||||||
|
},
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// // 用户音量提示回调。
|
// // 用户音量提示回调。
|
||||||
onAudioVolumeIndication: async (_connection: RtcConnection, speakers: AudioVolumeInfo[], _speakerNumber: number, _totalVolume: number) => {
|
onAudioVolumeIndication: async (_connection: RtcConnection, speakers: AudioVolumeInfo[], _speakerNumber: number, _totalVolume: number) => {
|
||||||
await onAudioVolumeIndication?.(speakers)
|
await onAudioVolumeIndication?.(speakers)
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,8 @@ export default defineConfig({
|
||||||
ColorEnhanceOptions,
|
ColorEnhanceOptions,
|
||||||
LowlightEnhanceOptions,
|
LowlightEnhanceOptions,
|
||||||
VirtualBackgroundSource,
|
VirtualBackgroundSource,
|
||||||
AudienceLatencyLevelType
|
AudienceLatencyLevelType,
|
||||||
|
StreamPublishState
|
||||||
} = require("agora-electron-sdk")
|
} = require("agora-electron-sdk")
|
||||||
export {
|
export {
|
||||||
createAgoraRtcEngine,
|
createAgoraRtcEngine,
|
||||||
|
|
@ -101,7 +102,8 @@ export default defineConfig({
|
||||||
ColorEnhanceOptions,
|
ColorEnhanceOptions,
|
||||||
LowlightEnhanceOptions,
|
LowlightEnhanceOptions,
|
||||||
VirtualBackgroundSource,
|
VirtualBackgroundSource,
|
||||||
AudienceLatencyLevelType
|
AudienceLatencyLevelType,
|
||||||
|
StreamPublishState
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue