From 58d6e8f9651574674b1ececfb741f61b28a5bee1 Mon Sep 17 00:00:00 2001 From: tharvik Date: Fri, 16 Feb 2024 16:05:06 +0100 Subject: [PATCH] fixup! discojs-core: use isomorphic-wrtc --- isomorphic-wrtc/browser.js | 22 +++++++++++++++++++++- isomorphic-wrtc/package.json | 3 --- package-lock.json | 3 --- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/isomorphic-wrtc/browser.js b/isomorphic-wrtc/browser.js index 3b6582a02..67ab4ada6 100644 --- a/isomorphic-wrtc/browser.js +++ b/isomorphic-wrtc/browser.js @@ -1,4 +1,24 @@ "use strict"; -const getBrowserRTC = require("get-browser-rtc"); +// from get-browser-rtc +// TODO move to ES import +function getBrowserRTC() { + if (typeof globalThis === "undefined") return null; + var wrtc = { + RTCPeerConnection: + globalThis.RTCPeerConnection || + globalThis.mozRTCPeerConnection || + globalThis.webkitRTCPeerConnection, + RTCSessionDescription: + globalThis.RTCSessionDescription || + globalThis.mozRTCSessionDescription || + globalThis.webkitRTCSessionDescription, + RTCIceCandidate: + globalThis.RTCIceCandidate || + globalThis.mozRTCIceCandidate || + globalThis.webkitRTCIceCandidate, + }; + if (!wrtc.RTCPeerConnection) return null; + return wrtc; +} module.exports = getBrowserRTC(); diff --git a/isomorphic-wrtc/package.json b/isomorphic-wrtc/package.json index 7ceac143f..4e3f56d70 100644 --- a/isomorphic-wrtc/package.json +++ b/isomorphic-wrtc/package.json @@ -9,8 +9,5 @@ "license": "MIT", "peerDependencies": { "wrtc": "*" - }, - "dependencies": { - "get-browser-rtc": "1" } } diff --git a/package-lock.json b/package-lock.json index c635693d9..1c27a1949 100644 --- a/package-lock.json +++ b/package-lock.json @@ -93,9 +93,6 @@ "isomorphic-wrtc": { "version": "1.0.0", "license": "MIT", - "dependencies": { - "get-browser-rtc": "1" - }, "peerDependencies": { "wrtc": "*" }