KASM-4146 check browser support for webrtc

This commit is contained in:
mattmcclaskey 2023-03-20 15:25:32 -04:00
parent 866c2772f0
commit d1419f9430
No known key found for this signature in database
2 changed files with 7 additions and 2 deletions

View File

@ -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 {

View File

@ -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);
}