How to use the wrtc.RTCIceCandidate function in wrtc

To help you get started, we’ve selected a few wrtc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github udevbe / westfield / server / node / example.livestream / compositor-server.js View on Github external
if (signal.sdp) {

        streamSource.implementation.peerConnection.setRemoteDescription(new webrtc.RTCSessionDescription(signal.sdp)).then(() => {
            return streamSource.implementation.peerConnection.createAnswer();
        }).then((desc) => {
            return streamSource.implementation.peerConnection.setLocalDescription(desc);
        }).then(() => {
            streamSource.server_stream_description(JSON.stringify({"sdp": streamSource.implementation.peerConnection.localDescription}));
        }).catch((error) => {
            console.error(error);
            streamSource.client.close();
        });

    } else if (signal.candidate) {
        streamSource.implementation.peerConnection.addIceCandidate(new webrtc.RTCIceCandidate(signal.candidate)).catch((error) => {
            console.error("Error: Failure during addIceCandidate()", error);
            streamSource.client.close();
        });
    }
}
github noia-network / webrtc-direct / server / src / webrtc-direct.ts View on Github external
iceCandidates.forEach((iceCandidate: wrtc.IceCandidate) => {
            logger.verbose(`${LOG_PREFIX} ${chalk.cyanBright(`${channelId} pc1: adding ice candidate from browser`)}`, iceCandidate);
            if (channel == null) {
                throw new Error("Channel is null.");
            }
            iceCandidate = this.mapPortsFromBrowser(req, channel, iceCandidate);
            if (channel.localAddress == null || channel.remoteAddress == null) {
                throw new Error("Channel localAddress or remoteAddress is null.");
            }
            this.udpProxy.setMap(channel.localAddress, channel.remoteAddress);
            channel.pc.addIceCandidate(new wrtc.RTCIceCandidate(iceCandidate));
        });
    }

wrtc

Standards-compliant WebRTC implementation for Node

BSD-2-Clause
Latest version published 4 years ago

Package Health Score

53 / 100
Full package analysis