According to the Agora documentation, the ICEConnectionState indicates the state of the peer-to-peer connection between the local client and the remote client. The possible values are:
- new: The ICE agent is gathering addresses or waiting for remote candidates.
- checking: The ICE agent has remote candidates and is checking pairs of local and remote candidates against one another to try to find a compatible match, but has not yet found a pair which will allow the peer connection to be made. It's possible that gathering of candidates is also still underway.
- connected: A usable pairing of local and remote candidates has been found for all components of the connection, and the connection has been established. It's possible that gathering is still underway, and it's also possible that the ICE agent is still checking candidates against one another looking for a better connection to use.
- completed: The ICE agent has finished gathering candidates and checking them against one another. A connection has been established for all components of the connection, and the best possible connection has been found and selected.
- disconnected: The ICE agent has determined that the connection is no longer viable. This can happen, for example, if a laptop is closed and then later re-opened.
- failed: The ICE agent has checked all candidates pairs against one another and has failed to find compatible matches for all components of the connection. It has given up looking for a usable connection.
- closed: The ICE agent has shut down and is no longer handling requests.
In your case, it seems that the ICE agent has detected a temporary loss of connectivity between the web panel and the mobile app, and has switched to the disconnected state. However, it has not given up on the connection and has resumed checking for a compatible match, and has eventually found one and switched back to the connected state.
The reason for this intermittent disconnection could be due to various factors, such as network congestion, firewall settings, bandwidth limitations, or device performance. To troubleshoot this issue, you can try the following steps:
- Check the network quality of both the web panel and the mobile app using the getNetworkQuality method of the Agora SDK. This method returns a score from 0 to 6, where 0 means unknown, 1 means excellent, 2 means good, 3 means poor, 4 means bad, 5 means very bad, and 6 means down. If the score is lower than 3, you may need to improve the network conditions or switch to a different network.
- Check the firewall settings of both the web panel and the mobile app and make sure they allow the UDP and TCP ports used by Agora. You can find the list of ports here: https://docs.agora.io/en/Agora%20Platform/firewall?platform=All%20Platforms
- Check the bandwidth usage of both the web panel and the mobile app and make sure they have enough bandwidth to support the video stream. You can use the setVideoEncoderConfiguration method of the Agora SDK to adjust the video bitrate, resolution, frame rate, and orientation according to the network conditions and device capabilities. You can find the recommended settings here: https://docs.agora.io/en/Video/API%20Reference/web/interfaces/agorartc.videoencoderconfiguration.html
- Check the device performance of both the web panel and the mobile app and make sure they have enough CPU and memory resources to handle the video stream. You can use the getSystemStats method of the Agora SDK to monitor the CPU and memory usage of the web panel, and the getDeviceStats method to monitor the battery level, CPU usage, and memory usage of the mobile app. You can find the documentation here: https://docs.agora.io/en/Video/API%20Reference/web/interfaces/agorartc.client.html#getsytemstats and https://docs.agora.io/en/Video/API%20Reference/web/interfaces/agorartc.client.html#getdevicestats