添加监测到远端最活跃用户回调
This commit is contained in:
parent
1a98b6e7d4
commit
32acac493d
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue