From 881dcc2e9cb37ffe1740ee3b395400c5b2327d26 Mon Sep 17 00:00:00 2001 From: rainbow napkin Date: Fri, 9 Oct 2026 20:11:05 -0400 Subject: [PATCH 1/2] Changed webRTC jitterbuffer to 1.5s for clients receiving streams, updated WebRTC text to reflect recent TURN(S) capabilities. --- www/js/channel/webRTCHandler.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/www/js/channel/webRTCHandler.js b/www/js/channel/webRTCHandler.js index ffce29d..be79747 100644 --- a/www/js/channel/webRTCHandler.js +++ b/www/js/channel/webRTCHandler.js @@ -164,6 +164,12 @@ class webRTCHandler{ //Set offer as peerConnections local description await this.currentStream.setLocalDescription(offer); + //For each receiver from the current streamer + for(let receiver of this.currentStream.getReceivers()){ + //Set jitter buffer target to 1.5s, since we care more about consistent video quality than we do latency + receiver.jitterBufferTarget = 1500; + } + //Send RTC connection offer to server to be relayed to streamer's device this.client.socket.emit("relayRTCData", {type:"request",body:offer}); } @@ -289,17 +295,11 @@ class webRTCHandler{ title.innerText = "WebRTC Error"; let text = document.createElement('p'); - text.innerText = "Looks like we're having issues connecting you to your stream. Make sure you're not behind a CGNAT or something."; + text.innerHTML = "Looks like we're having issues connecting you to your stream.

If you can't get it after a refresh, try again later or on another connection/device."; - let link = document.createElement('a'); - link.innerText = "Click here for more info..."; - link.href = "/streamInfo"; - link.target = "_blank"; - let textBlock = document.createElement('div'); textBlock.appendChild(title); textBlock.appendChild(text); - textBlock.appendChild(link); let errorBlock = document.createElement('div'); errorBlock.id = "web-rtc-error-block" From 1dfe3454b4dff4da8ded7fad54417f24eaddaf53 Mon Sep 17 00:00:00 2001 From: rainbow napkin Date: Sat, 10 Oct 2026 02:40:57 -0400 Subject: [PATCH 2/2] Capped bitrates for WebRTC Streams --- www/js/channel/webRTCHandler.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/www/js/channel/webRTCHandler.js b/www/js/channel/webRTCHandler.js index be79747..4210431 100644 --- a/www/js/channel/webRTCHandler.js +++ b/www/js/channel/webRTCHandler.js @@ -359,6 +359,23 @@ class connectedViewer{ peer.addTrack(track, this.broadcastingStream); } + //For each sender for this peer + for(let sender of peer.getSenders()){ + //Set audio tracks to 192kbps and video tracks to 1200kbps + const bitrate = (sender.track.kind == "audio") ? 192 * 1000 : 1200 * 1000; + //gank parms from the sender + const parms = sender.getParameters(); + + //Run through all listed encodings in the current sender paramters + for(let encodingIndex in parms.encodings){ + //Set max bitrate to chosen bitrate + parms.encodings[encodingIndex].maxBitrate = bitrate; + } + + //Set sender parameters to modified parameters + sender.setParameters(parms); + } + //Set peer remote description to connection offer from viewer peer.setRemoteDescription(new RTCSessionDescription(offer));