From 06f41b08b2cb5a1a391df55a5511538e574b921b Mon Sep 17 00:00:00 2001 From: Rocka Date: Thu, 24 Oct 2024 23:14:27 +0800 Subject: [PATCH] fix(web): avoid assigning srcObject of debug-player repeatedly fixes playing audio only streams in web debugger --- web/shared/tools/debugger/debugger.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/shared/tools/debugger/debugger.js b/web/shared/tools/debugger/debugger.js index 0c19fcba..ee899a58 100644 --- a/web/shared/tools/debugger/debugger.js +++ b/web/shared/tools/debugger/debugger.js @@ -207,12 +207,13 @@ async function startWhep() { pc.addTransceiver("audio", { "direction": "recvonly" }) const ms = new MediaStream(); + document.getElementById("whep-video-player").srcObject = ms; pc.ontrack = ev => { logWhep(num, `track: ${ev.track.kind}`) ms.addTrack(ev.track); // addtrack removetrack events won't fire when calling addTrack/removeTrack in javascript // https://github.com/w3c/mediacapture-main/issues/517 - document.getElementById("whep-video-player").srcObject = ms; + document.getElementById("whep-video-player").setShowTrackCount(ms); } const whep = new WHEPClient() const url = location.origin + "/whep/" + streamId