diff --git a/src/page/Meeting/index.tsx b/src/page/Meeting/index.tsx index 351382a..638de24 100644 --- a/src/page/Meeting/index.tsx +++ b/src/page/Meeting/index.tsx @@ -1448,6 +1448,17 @@ const Meeting: React.FC = () => { onAudioPublishStateChanged: (_channel: string, _oldState: StreamPublishState, newState: StreamPublishState, _elapseSinceLastState: number) => { setAudioStatus(newState) }, + onActiveSpeaker: (_connection: RtcConnection, uid: number) => { + GetSharedScreen(state.channelId).then(req => { + if (req.code === 200) { + if (req.data) { + setIsShare(req.data) + } else { + renderVideo(String(uid)) + } + } + }) + } }) if (state.enableCamera) { await agora.startCameraCapture() @@ -1767,8 +1778,8 @@ const Meeting: React.FC = () => { if (res) { GetSharedScreen(state.channelId).then(req => { if (req.code === 200) { - if (res.data) { - setIsShare(res.data) + if (req.data) { + setIsShare(req.data) } getDesktopCapturerVideo() setIsSharedScreenModal(true) diff --git a/src/utils/package/agora.ts b/src/utils/package/agora.ts index fbc1ba6..2ade1f3 100644 --- a/src/utils/package/agora.ts +++ b/src/utils/package/agora.ts @@ -152,7 +152,7 @@ export const agora = { }, 1000); }, // 事件回调 - registerEventHandler: ({ onJoinChannelSuccess, onUserJoined, onUserOffline, onAudioVolumeIndication, onRtcStats, onConnectionStateChanged, onLocalVideoStateChanged, onConnectionLost, onTokenPrivilegeWillExpire, onVideoPublishStateChanged, onAudioPublishStateChanged }: any) => { + registerEventHandler: ({ onJoinChannelSuccess, onUserJoined, onUserOffline, onAudioVolumeIndication, onRtcStats, onConnectionStateChanged, onLocalVideoStateChanged, onConnectionLost, onTokenPrivilegeWillExpire, onActiveSpeaker, onVideoPublishStateChanged, onAudioPublishStateChanged }: any) => { rtcEngine.registerEventHandler({ // 监听本地用户加入频道事件 onJoinChannelSuccess: async (connection: RtcConnection, elapsed: number) => { @@ -197,6 +197,10 @@ export const agora = { // Token 即将在 30s 内过期回调。 onTokenPrivilegeWillExpire: (connection: RtcConnection, token: string) => { onTokenPrivilegeWillExpire?.(connection, token) + }, + // 监测到远端最活跃用户回调。 + onActiveSpeaker: (connection: RtcConnection, uid: number) => { + onActiveSpeaker?.(connection, uid) } }); },