nice-napkin-15455
02/16/2025, 2:51 AMgray-monkey-83525
02/16/2025, 2:51 AMcurrentRoundTripTime
property from the IceCandidatePairStatistics
to measure network latency. This property provides the current round-trip time for the connection, which is a key component of total latency.
For a more comprehensive latency measurement, you might also consider using the Analytics API to track session details, including start and end times, which can help in calculating the total time taken for specific operations. Additionally, monitoring metrics like jitter and packet loss can provide insights into network stability and performance.
Would you like more detailed guidance on implementing these measurements?
Sources:
- LiveKit documentation
- Analytics API 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.nice-napkin-15455
02/16/2025, 2:54 AMgray-monkey-83525
02/16/2025, 2:54 AMRoom
object and connecting with the appropriate WebSocket URL and token.
2. Access ICE Candidate Statistics: Use the IceCandidatePairStatistics
to access the currentRoundTripTime
property, which provides the network latency.
3. Monitor Network Changes: Implement listeners to monitor network changes and capture metrics like jitter and packet loss for a comprehensive view of network performance.
Here's a basic example of how you might set this up in Flutter:
import 'package:livekit_client/livekit_client.dart';
void main() async {
final room = Room();
await room.connect('ws://your-livekit-server', 'your-access-token');
// Listen for connection quality updates
room.on<ConnectionQualityUpdatedEvent>((event) {
final stats = event.participant.connectionQuality;
print('Current round trip time: ${stats.currentRoundTripTime}');
});
// Handle network changes
room.on<NetworkChangedEvent>((event) {
print('Network changed: ${event.networkType}');
});
}
This example sets up a connection to a LiveKit room and listens for connection quality updates, which include the round-trip time. It also listens for network changes to help identify spotty or intermittent network conditions.
Would you like more detailed guidance on any specific part of this implementation?
Sources:
- LiveKit Flutter SDK Documentation 👍 1 button 👎 0 button 💡 Hint: Mention @millions-hair-24956 in the thread for followups.nice-napkin-15455
02/16/2025, 9:00 AMgray-monkey-83525
02/16/2025, 9:00 AMConnectionQuality
values in LiveKit are determined based on several network performance metrics, such as packet loss, jitter, and round-trip time. According to the ConnectionQuality enum documentation, the values include unknown
, poor
, good
, and excellent
, which likely represent different levels of connection stability and performance.
The calculation of these values could involve analyzing the real-time data flow between the participant and the server, assessing the quality of the connection based on the aforementioned metrics. This assessment might be used to emit events like ParticipantConnectionQualityUpdatedEvent
, which can be used to notify applications of changes in connection quality.
Would you like more detailed information on how to handle these events or integrate them into your application?
Sources:
- ConnectionQuality enum documentation 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.nice-napkin-15455
02/16/2025, 9:01 AMgray-monkey-83525
02/16/2025, 9:01 AM