From 8749562c96c08c3907e1ab19dfeff2507ff47915 Mon Sep 17 00:00:00 2001 From: Alex X Date: Fri, 10 May 2024 21:55:47 +0300 Subject: [PATCH] Fix detection webrtc without audio #1106 --- www/video-rtc.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/www/video-rtc.js b/www/video-rtc.js index 56893aa98..52fb5dda1 100644 --- a/www/video-rtc.js +++ b/www/video-rtc.js @@ -492,7 +492,9 @@ export class VideoRTC extends HTMLElement { pc.addEventListener('connectionstatechange', () => { if (pc.connectionState === 'connected') { - const tracks = pc.getReceivers().map(receiver => receiver.track); + const tracks = pc.getTransceivers() + .filter(tr => tr.currentDirection === 'recvonly') // skip inactive + .map(tr => tr.receiver.track); /** @type {HTMLVideoElement} */ const video2 = document.createElement('video'); video2.addEventListener('loadeddata', () => this.onpcvideo(video2), {once: true});