diff --git a/addons/web_editor/static/src/js/wysiwyg/PeerToPeer.js b/addons/web_editor/static/src/js/wysiwyg/PeerToPeer.js index b6f2614623d..535f7abae55 100644 --- a/addons/web_editor/static/src/js/wysiwyg/PeerToPeer.js +++ b/addons/web_editor/static/src/js/wysiwyg/PeerToPeer.js @@ -131,7 +131,16 @@ const baseNotificationMethods = { console.log(`%cisOfferRacing: ${isOfferRacing}`, 'background: red;'); console.log(`%c SETREMOTEDESCRIPTION`, 'background: navy; color:white;'); } - await pc.setRemoteDescription(description); + try { + await pc.setRemoteDescription(description); + } catch (e) { + if (e instanceof DOMException && e.name === 'InvalidStateError') { + console.error(e); + return; + } else { + throw e; + } + } if (clientInfos.iceCandidateBuffer.length) { for (const candidate of clientInfos.iceCandidateBuffer) { await this._addIceCandidate(clientInfos, candidate); @@ -140,7 +149,16 @@ const baseNotificationMethods = { } if (description.type === 'offer') { const answerDescription = await pc.createAnswer(); - await pc.setLocalDescription(answerDescription); + try { + await pc.setLocalDescription(answerDescription); + } catch (e) { + if (e instanceof DOMException && e.name === 'InvalidStateError') { + console.error(e); + return; + } else { + throw e; + } + } this.notifyClient( notification.fromClientId, 'rtc_signal_description',