From d1419f9430dcfc0876a55319d093fb07b2537b59 Mon Sep 17 00:00:00 2001 From: mattmcclaskey Date: Mon, 20 Mar 2023 15:25:32 -0400 Subject: [PATCH] KASM-4146 check browser support for webrtc --- app/ui.js | 5 +++++ core/rfb.js | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/ui.js b/app/ui.js index 4c4e3ef1..c51a0e66 100644 --- a/app/ui.js +++ b/app/ui.js @@ -2175,6 +2175,11 @@ const UI = { toggleWebRTC() { if (UI.rfb) { + if (typeof RTCPeerConnection === 'undefined') { + UI.showStatus('This browser does not support WebRTC UDP Data Channels.', 'warn', 5000, true); + return; + } + if (UI.getSetting('enable_webrtc')) { UI.rfb.enableWebRTC = true; } else { diff --git a/core/rfb.js b/core/rfb.js index 58557019..4f17fcef 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -1074,7 +1074,7 @@ export default class RFB extends EventTargetMixin { this._resendClipboardNextUserDrivenEvent = true; // WebRTC UDP datachannel inits - { + if (typeof RTCPeerConnection !== 'undefined') { this._udpBuffer = new Map(); this._udpPeer = new RTCPeerConnection({ @@ -1179,7 +1179,7 @@ export default class RFB extends EventTargetMixin { } } - if (this._useUdp) { + if (this._useUdp && typeof RTCPeerConnection !== 'undefined') { setTimeout(function() { this._sendUdpUpgrade() }.bind(this), 3000); }