ReLet's start by initializing the client.
const CoreClient = require("rtcfly").client;
const core = new CoreClient();
call
Use this method to call another user.
core.call({
id:"targetID", //Unique identifier for the target user
localElement:HTMLMediaElement, //the video element for the caller
remoteElement:HTMLMediaElement, //the video element for the callee
audio:true, //request audio stream
video:true //request video stream
});
This will get the users media streams, ie video, audio, screen share.
After the RTCFly core is initialized, the callInitialized
event will be triggered with all of the above parameters.
answerCall
Like "call", this method will take a load of parameters to intialize the session
core.answerCall({
localElement:HTMLMediaElement, //the video element for the callee
remoteElement:HTMLMediaElement, //the video element for the caller
audio:true, //request audio stream
video:true //request video stream
});
rejectCall
core.rejectCall();
This will simply trigger a callRejected
event on the caller's side and cancel the session.
endCall
core.endCall();
This will trigger a callTerminated
event on both clients.