feat: Dont collect stats without a video track

This commit is contained in:
Adam Shiervani 2025-08-28 12:35:23 +02:00
parent 6b37cf8e3f
commit 379a794bd7
1 changed files with 4 additions and 0 deletions

View File

@ -29,6 +29,10 @@ export default function ConnectionStatsSidebar() {
useInterval(function collectWebRTCStats() { useInterval(function collectWebRTCStats() {
(async () => { (async () => {
if (!mediaStream) return; if (!mediaStream) return;
const videoTrack = mediaStream.getVideoTracks()[0];
if (!videoTrack) return;
const stats = await peerConnection?.getStats(); const stats = await peerConnection?.getStats();
let successfulLocalCandidateId: string | null = null; let successfulLocalCandidateId: string | null = null;
let successfulRemoteCandidateId: string | null = null; let successfulRemoteCandidateId: string | null = null;