get-browser-rtc
Version:
get webrtc browser methods unprefixed
16 lines (14 loc) • 620 B
JavaScript
// originally pulled out of simple-peer
module.exports = 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
}