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": "*" }