SightCall Developer Center

Account Login Support

Make a one-to-one call

The SightCall platform is primarily designed to perform one-to-one calls, from any type of client to any type of client (plugin to webrtc, plugin to mobile, webrtc to mobile, etc.). Once connected and authenticated, SightCall clients can call another connected and authenticated client based on the uid he/she is connected with. The callee SDK is notified of an incoming call and can pick up the call (audio video, audio only) or decline it.
During the call, any peer can also start a screen share to share his/her desktop or any window (desktop clients: plugin or WebRTC) or any view (mobile clients: android or iOS).

Mr. Spock

Create a call

Calling someone else is done using a createCall method of the Rtcc object (JS,Android,iOS). This method can take several parameters but the most important ones are:

rtcc.createCall("AliceUid", "internal", "Calling...");
[[Rtcc instance] createCall:@"AliceUid"];
  Rtcc.instance().createCall("AliceUid")
Rtcc.instance().createCall("AliceUid");

In any case, a call object is created and reference can be stored.

var call;

function callListener(callObject){
  call = callObject;
  console.log('An ' + call.getDirection() + ' call has been created.');
  ...
}

rtcc.on('call.create', callListener);
RtccCall *callObject;

- (void) rtccCallCreated:(RtccCall *)call  
{
  callObject = call;  
}

//the current callObject is also always available through
callObject = [[Rtcc instance] activeCall];
var callObject: RtccCall!

override func rtccCallCreated(call: AnyObject!)  {
  callObject = call
}

//the current callObject is also always available through
Rtcc.instance().activeCall()
Call currentCall;

@RtccEventListener
public void onCallStatusEvent(StatusEvent event) {
    switch (event.getStatus()) {
        case CREATED:
            currentCall = event.getCall();
            break;
    }
}

//the current callObject is also always available through
public void updateCurrentCall() {
    currentCall = Rtcc.instance().getCurrentCall();
}

Receive a Call

In javascript, picking up the call does not require any code as it can be done directly from the provided user interface, however, the application can also handle all actions on the call via the rtccCall Object. Incoming calls also trigger the event call.create.
For mobile devices, as only one call can be done at a time, actions are done on the current active call.

//getting the call reference
var call;

function callListener(callObject){
  call = callObject;
  console.log('An ' + call.getDirection() + ' call has been created.');
  ...
}

rtcc.on('call.create', callListener);

// And then answering

call.accept() //Accepts the incoming call
call.videoStop() //do not send the video stream anymore
call.hangup() // hangs up the call or decline it if was not accepted yet
UIView *viewIn;
[[[Rtcc instance] activeCall] setViewVideoIn:viewIn];

// If you want to generate a camera source, see the `RtccVideoSource` protocol
// A default generic videosource is offered. see the `RtccDefaultVideoSource` class
RtccDefaultVideoSource *myVideoSource = [[RtccDefaultVideoSource alloc] init];
[[[[Rtcc instance] activeCall] videoOut] setSource: myVideoSource];

[[[Rtcc instance] activeCall] resume];
var viewIn: UIView
Rtcc.instance().activeCall.viewVideoIn = viewIn

// If you want to generate a camera source, see the `RtccVideoSource` protocol
// A default generic videosource is offered. see the `RtccDefaultVideoSource` class
var myVideoSource = RtccDefaultVideoSource();

Rtcc.instance().activeCall.videoOut.source = myVideoSource
Rtcc.instance().activeCall.resume()
@RtccEventListener
public void onCallStatusEvent(StatusEvent event) {
    Call call = event.getCall();
    switch (event.getStatus()) {
        case RINGING:
            call.resume();
            // call.hangup();
            break;
        case ACTIVE:
            call.setVideoOut((VideoOutPreviewFrame) findViewById(R.id.video_out));
            call.setVideoIn((VideoInFrame) findViewById(R.id.video_in), Contact.DEFAULT_CONTACT_ID);
          break;
    }
}

Subscribe to Events of the call object

Although no implementation other than the create call is necessary to make or receive calls, the application may want to add additional behaviors. Several events occur during the call that the application may want to subscribe to, including:

To subscribe to these events use the on() method of the RtccCall object. As the call object is created for each call and as the application needs to listen to events as early as possible, a good practice is to subscribe to those events directly at call object creation, i.e. in the call.create callback. Above example would then be something like:

var call;

function onLocalVideoStarted()  {console.log('You have turned your camera on')};
function onLocalVideoStopped()  {console.log('You have turned your camera off')};
function onRemoteVideoStart()   {console.log('The other one has turned his camera on')};
function onRemoteVideoStopped() {console.log('The other one has turned his camera off')};
function onCallTerminated()     {console.log('Call has ended')};

function callListener(callObject) {
  call = callObject;
  console.log('An' + call.getDirection() + ' call has been created.');
  call.on('video.local.start', onLocalVideoStarted);
  call.on('video.local.stop', onLocalVideoStopped);
  call.on('video.remote.start', onRemoteVideoStart);
  call.on('video.remote.stop', onRemoteVideoStopped);
  call.on('terminate', onCallTerminated);
}

rtcc.on('call.create', callListener);
id<RtccCallDelegate> myCallDelegate;

[[[Rtcc instance] activeCall] setDelegate:myCallDelegate];
var myCallDelegate: RtccCallDelegateImplementation

Rtcc.instance().activeCall.delegate = myCallDelegate
@RtccEventListener
public void onCallStatusEvent(StatusEvent event) {
    // call status events
}

@RtccEventListener
public void onVideoOutEvent(VideoOutEvent event) {
    // video out events
}

@RtccEventListener
public void onScreenShareInEvent(ScreenShareInEvent event) {
    // screenshare in events
}

Hang up a call

Hanging up a call is done using the hangUp methods of the SDKs on the call object.

currentCall.hangup();
[[[Rtcc instance] activeCall] hangup];
  Rtcc.instance().activeCall.hangup()
Rtcc.instance().getCurrentCall().hangup();

Optional - Desktop - WebRTC: Highlight user action required by the browser

In webRTC on Chrome, the browser requires authorization from the user to access the camera and the microphone. The application can highlight the request from the browser and take action if the user refuses to give access to the camera.

This can be used, for example, to show an arrow indicating where to click to enable the video (webrtc.mediarequest), and to remove the arrow when the user accepts (webrtc.mediarequest.success). It is also possible to display an explanation to follow if the user denies access to the camera.

Optional - Desktop - WebRTC Chrome Screenshare Out

Although nothing is required to receive screenshare in plugin or webRTC, Chrome requires to have an extension installed to support outgoing screenshare. The event chrome.screenshare.missing is triggered if the extension is not installed. The callback is invoked with a string containing the url on the Chrome Store to download the extension.

For exemple, to propose the install of the extension if it is missing, the following code can be added:

var call;

function downloadExtension(url) {
  var answer = confirm('Click OK to install screenshare.');
  if (answer == true) {
    window.open(url);
  }
};

function callListener(callObject) {
  call = callObject;
  ...
  call.on('chrome.screenshare.missing', downloadExtension);
  ...
}

rtcc.on('call.create', callListener);