From 426c1e06d8b2ac0f9a6ec7201c8135e10ec02206 Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Fri, 19 Jun 2020 11:50:41 +0200 Subject: [PATCH] Remove half-baked compatibility code for old browsers. --- static/sfu.js | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/static/sfu.js b/static/sfu.js index 50b10f8..f4d7e2e 100644 --- a/static/sfu.js +++ b/static/sfu.js @@ -1217,27 +1217,25 @@ async function negotiate(id) { let c = up[id]; if(!c) throw new Error('unknown connection'); + + if(typeof(c.pc.getTransceivers) !== 'function') + throw new Error('Browser too old, please upgrade'); + let offer = await c.pc.createOffer({}); if(!offer) throw(new Error("Didn't create offer")); await c.pc.setLocalDescription(offer); // mids are not known until this point - if(typeof(c.pc.getTransceivers) === 'function') { - c.pc.getTransceivers().forEach(t => { - if(t.sender && t.sender.track) { - let label = c.labels[t.sender.track.id]; - if(label) - c.labelsByMid[t.mid] = label; - else - console.warn("Couldn't find label for track"); - } - }); - } else { - console.warn('getTransceivers undefined'); - displayWarning('getTransceivers undefined, please upgrade your browser'); - // let the server deal with the mess - } + c.pc.getTransceivers().forEach(t => { + if(t.sender && t.sender.track) { + let label = c.labels[t.sender.track.id]; + if(label) + c.labelsByMid[t.mid] = label; + else + console.warn("Couldn't find label for track"); + } + }); send({ type: 'offer',