Toggles enabled state of a user's media (webcam)
SignalingDelegate method to handle socket message of type NegotiationMessage meaning an answer to the Presenter's offer has been received. Responds to the message sent to the caller once the callee has decided to accept the request to talk.
SignalingDelegate method to handle socket event of type 'disconnect'.
SignalingDelegate method to handle socket message of type ICECandidateMessage meaning a new ICE candidate has been received from the other peer.
SignalingDelegate method to handle socket event 'other' (other user joined)
SignalingDelegate method to handle socket message of type NegotiationMessage Accept an offer to video chat. We configure our local settings, create our RTCPeerConnection, get and attach our local camera stream, then create and send an answer to the caller.
Sends JoinMessage message to the websocket. Returns a promise that resolves on the socket connection and rejects on the socket error
Example:
const room = '123';
const isStreamer = true;
rtc.join(room, isStreamer);
Toggles muted state of a user's audio
SignalingDelegate method to handle socket event of type 'me' (this user joined)
Sets the Presenter's stream source from either webcam or display and related HTMLVideoElement. It returns a Promise that resolves to a MediaStream object. If the user denies permission, or matching media is not available, then the promise is rejected with NotAllowedError or NotFoundError respectively.
Example:
const mediaType = 'userMedia';
const userMedia = document.getElementById("userMedia");
rtc.setupMedia('userMedia', userMedia);
optional parameter. Defaults to { audio: true, video: true }
for user media (webcam)
and is NOT configurable for screen sharing as audio is not supported https://blog.mozilla.org/webrtc/getdisplaymedia-now-available-in-adapter-js/
Stops streams and disconnects from the socket server
Generated using TypeDoc
Creates WebRTC client instance example:
const WS_SERVER_URL = window.location.origin; const RTC_CONFIG = { 'iceServers': [ { "urls": [ "stun:64.233.165.127:19302" ] }]}; const rtc = new RTC(WS_SERVER_URL, RTC_CONFIG);