yangjie #33

Merged
yangqiang merged 22 commits from yangjie into master 2024-11-04 13:57:51 +08:00
3 changed files with 27 additions and 17 deletions
Showing only changes of commit 2469248833 - Show all commits

View File

@ -719,7 +719,7 @@ const startSignalr = async (user) => {
accessTokenFactory: () => user.token
})
.build();
onStart()
connection.start();
mainWindow.webContents.send('changeLocalStorage', {
isSignalr: true,
reconnect: true,
@ -739,9 +739,10 @@ const startSignalr = async (user) => {
const onStart = async () => {
if (connection) {
if (connection.state !== signalR.HubConnectionState.Connected) {
if (connection.state === signalR.HubConnectionState.Disconnected) {
connection.start();
} else {
}
if (connection.state !== signalR.HubConnectionState.Connected) {
setTimeout(onStart, 3000);
}
}

View File

@ -1036,21 +1036,26 @@ const Meeting: React.FC = () => {
onRtcStats: async (stats: RtcStats) => {
setNetworkOther(stats)
},
onConnectionStateChanged: async (_connection: RtcConnection, stateNumber: ConnectionStateType, reason: ConnectionChangedReasonType) => {
onConnectionStateChanged: async (_connection: RtcConnection, state: ConnectionStateType, reason: ConnectionChangedReasonType) => {
const reconnectingCode = [2, 16, 11, 13, 14, 12]
if (stateNumber === 4 && reconnectingCode.indexOf(reason) >= 0) {
meetingDisconnectedRef.current.changeModal(true)
setIsScreenCapture(bool => {
if (bool) {
setIsNetworkDisconnected(true)
stopScreenCapture()
}
return bool
})
} else if (stateNumber === 3) {
meetingDisconnectedRef.current.changeModal(false)
if (state === 4 && reconnectingCode.indexOf(reason) >= 0) {
} else if (state === 3) {
if (storage.getItem('reconnect') === 'true') {
meetingDisconnectedRef.current.changeModal(false)
}
}
},
onConnectionLost: () => {
meetingDisconnectedRef.current.changeModal(true)
setIsScreenCapture(bool => {
if (bool) {
setIsNetworkDisconnected(true)
stopScreenCapture()
}
return bool
})
},
onLocalVideoStateChanged: async (_source: VideoSourceType, _state: LocalVideoStreamState, reason: LocalVideoStreamReason) => {
if (reason === 12) {
setIsScreenCapture(bool => {
@ -2925,7 +2930,7 @@ const networkIcon = (network: number) => {
switch (network) {
case 0:
return <svg width="16" height="16" viewBox="0 0 33 33" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_5499_5160)">
<g clipPath="url(#clip0_5499_5160)">
<path d="M2.01914 32.4824C0.969141 32.4824 0.119141 31.6324 0.119141 30.5824V22.9824C0.119141 21.9324 0.969141 21.0824 2.01914 21.0824C3.06914 21.0824 3.91914 21.9324 3.91914 22.9824V30.5824C3.91914 31.6324 3.06914 32.4824 2.01914 32.4824ZM11.4191 32.4824C10.3691 32.4824 9.51914 31.6324 9.51914 30.5824V15.7824C9.51914 14.7324 10.3691 13.8824 11.4191 13.8824C12.4691 13.8824 13.3191 14.7324 13.3191 15.7824V30.5824C13.3191 31.6324 12.4691 32.4824 11.4191 32.4824ZM20.8191 32.4824C19.7691 32.4824 18.9191 31.6324 18.9191 30.5824V9.38242C18.9191 8.33242 19.7691 7.48242 20.8191 7.48242C21.8691 7.48242 22.7191 8.33242 22.7191 9.38242V30.5824C22.7191 31.6324 21.8691 32.4824 20.8191 32.4824ZM30.2191 32.4824C29.1691 32.4824 28.3191 31.6324 28.3191 30.5824V2.38242C28.3191 1.33242 29.1691 0.482422 30.2191 0.482422C31.2691 0.482422 32.1191 1.33242 32.1191 2.38242V30.5824C32.1191 31.6324 31.2691 32.4824 30.2191 32.4824Z" fill="#7C8280" />
<path d="M8.98179 2.67253L6.22791 5.42641L3.47403 2.67253C3.11639 2.31489 2.52627 2.31489 2.16863 2.67253C1.81098 3.03018 1.81098 3.62029 2.16863 3.97794L4.9225 6.73182L2.16863 9.48569C1.81098 9.84334 1.81098 10.4335 2.16863 10.7911C2.52627 11.1488 3.11639 11.1488 3.47403 10.7911L6.22791 8.03723L8.98179 10.7911C9.33943 11.1488 9.92955 11.1488 10.2872 10.7911C10.6448 10.4335 10.6448 9.84334 10.2872 9.48569L7.53332 6.73182L10.2872 3.97794C10.6448 3.62029 10.6448 3.03018 10.2872 2.67253C9.92955 2.31489 9.33943 2.31489 8.98179 2.67253Z" fill="#F90000" />
</g>

View File

@ -150,7 +150,7 @@ export const agora = {
}, 1000);
},
// 事件回调
registerEventHandler: ({ onJoinChannelSuccess, onUserJoined, onUserOffline, onAudioVolumeIndication, onNetworkQuality, onRtcStats, onConnectionStateChanged, onLocalVideoStateChanged }: any) => {
registerEventHandler: ({ onJoinChannelSuccess, onUserJoined, onUserOffline, onAudioVolumeIndication, onNetworkQuality, onRtcStats, onConnectionStateChanged, onLocalVideoStateChanged, onConnectionLost }: any) => {
rtcEngine.registerEventHandler({
// 监听本地用户加入频道事件
onJoinChannelSuccess: async (connection: RtcConnection, elapsed: number) => {
@ -196,6 +196,10 @@ export const agora = {
onLocalVideoStateChanged: async (source: VideoSourceType, state: LocalVideoStreamState, reason: LocalVideoStreamReason) => {
await onLocalVideoStateChanged?.(source, state, reason)
},
// 网络连接中断,且 SDK 无法在 10 秒内连接服务器回调。
onConnectionLost: (_connection: RtcConnection) => {
onConnectionLost?.()
}
});
},
// 获取视图模式