Platform

Platform

  • Getting Started
  • API

›WebRTC JS SDK

Getting Started

  • Create Your App

Quick Starts

  • 555 Samples

Mobile SDK (v1.0)

  • Overview
  • IOS SDK

    • Getting started
    • Installation Guide
    • How to do user authentication
    • How to subscribe for notifications
    • How to initiate or accept PSTN call
    • How to initiate or accept video call
    • How to set log level for SDK
    • Release Notes

    Android SDK

    • Getting started
    • Installation Guide
    • How to do user authentication
    • How to subscribe for notifications
    • How to initiate or accept PSTN call
    • How to initiate or accept video call
    • How to set log level for SDK
    • Release Notes

Mobile SDK (v2.0)

  • Overview
  • IOS SDK

    • Getting started
    • Installation Guide
    • How to do user authentication
    • How to subscribe for notifications
    • How to initiate or accept PSTN call
    • How to initiate or accept VIDEO call
    • How to initiate or join ANONYMOUS VIDEO call
    • Release Notes
    • Reference code - How to initiate or accept PSTN Call
    • Reference code - How to initiate or accept Video Call
    • Reference code - How to initiate or join Anonymous Video Call

    Android SDK

    • Getting started
    • Installation Guide
    • How to do user authentication
    • How to subscribe for notifications
    • How to initiate or accept PSTN call
    • How to intiate or accept Video Call
    • How to intiate or accept ANONYMOUS VIDEO Call
    • Release Notes
    • Reference code - How to initiate or accept PSTN Call
    • Reference code - How to initiate or accept Video Call
    • Reference code - How to initiate or join Anonymous Video Call

    React Native SDK

    • Getting started
    • Installation Guide
    • How to do user authentication
    • How to subscribe for notifications
    • How to initiate or accept PSTN call
    • Release Notes

WebRTC JS SDK

  • Overview
  • Getting Started
  • How to do user authentication
  • How to subscribe for notifications
  • How to initialize SDK
  • How to initiate or accept PSTN call
  • How to initiate or accept video call
  • How to create a screen share session
  • Release Notes

Video Call

555 JS SDK supports video call between its users. Make sure that the app is logged in and connected to RTC server before initiating a call. If RTC connection got disconnected due to inactivity, the user should again request for connection to make a successful call.

Different APIs are used to create and join a video session. It also supports features like mute and unmute of local stream. Session related API requests have their respective callbacks to notify the user about the status of the request. List of callbacks specific to video session, in addition to the generic callbacks for any session type (audio, video or chat).

Create Local Media Stream

The IrisRtcStream class manages the audio and video streams that can be created using Iris stream APIs. It will create stream with both audio and video with video quality as HD and make use of back camera.

var irisRtcStream = new IrisRtcStream();

var constraints = {
    video : { mandatory: {}, optional: [] },
    audio : { mandatory: {}, optional: [] }
}

var streamConfig = {
    "streamType": "video",
    "resolution": "hd",
    "constraints": constraints
}

irisRtcStream.createStream(streamConfig);

// Stream can also be received with a callback
irisRtcStream.onLocalStream = (stream) => {
    // Video stream is received
}

irisRtcStream.onStreamError = (errorCode, errorMessage) => {
    // Throws error if failed to create stream
}

// API to stop media stream once call is ended.
irisRtcStream.stopMediaStream(mediaStream);


Initiate an Outgoing Call

Once the RTC connection is made, dial a valid user id to make an outgoing call. An 555 session is then created with the local stream and other necessary values using IrisRtcSession class.

createSession API is invoked to create a video session, which involves creating and starting a video session using the room id for the room which has been already allocated for the involved participants. This API takes three params, userConfig a json object with attributes explained below, IrisRtcConnection object from rtc connetion and IrisRtcStream object from local stream

var irisRtcSession = new IrisRtcSession();

var userConfig = {
    type : "video",
    domain : "<app domain>",
    sessionType : "create",
    useBridge : true,
    useAnonymousLogin : false,
    irisToken : "<555 JWT Token>",
    routingId: "<Routing Id of the caller"
}

irisRtcSession.createSession(userConfig, irisRtcConn, irisRtcStream);

Parameters passed to createSession API are :

Parameters
userConfigJSON object for setting session configuration parameters
irisRtcConnIrisRtcConnection object after rtc is connetion is successfully established
irisRtcStreamIrisRtcStream object after local stream is successfully created

userConfig JSON contains below parameters :

Parameters
typeCall type must be video
irisToken555 JWT token
routingIdRouting id of the caller
useAnonymousLoginfalse for non-anonymous Calls
useBridgetrue for PSTN Call
traceIdUnique time based UUID to identify call uniquely
sessionTypeSession type 'create'
publicIdPublic id of the caller

Accept Incoming Video Call

Notification for the incoming calls are received via callback onNotification of Connection, Use this info to join call.

A local stream should be created and passed along with other parameters received in the incoming call notification to joinSession API to join a video call session.

var irisRtcSession = new IrisRtcSession();

var userConfig = {
    type : "video",
    domain : "<app domain>",
    sessionType : "join",
    useBridge : true,
    useAnonymousLogin : false,
    irisToken : "<JWT Token>",
    routingId : "<Routing Id>"
}

irisRtcSession.joinSession(userConfig, irisRtcConn, irisRtcStream, notificationPayload);
Parameters
userConfigJSON object for setting session configuration parameters
irisRtcStreamIrisRtcStream object
irisRtcConnIrisRtcConnection object
notificationPayloadNotification payload received by onNotification callback from irisRtcConn

End an Active Call

On end call, all data and objects associated with that particular call must be cleared for efficiency and to avoid memory leak . While closing a video call session following things must be kept in mind.

  • Close 555 Rtc session
    By invoking endSession() API in IrisRtcSession, 555 session will get closed by releasing all objects associated with it.
  • Close stream
    The close operation of stream class is synchronous and can take time while closing the stream. Closing the stream during a session can cause an error in video or audio sessions. Hence it is advisable to use stopMediaStream() API once the session is closed.
var irisRtcSession = new IrisRtcSession();
irisRtcSession.endSession(roomId);


var irisRtcStream = new IrisRtcStream();
irisRtcStream.stopMediaStream(stream);

On-call Features

Mute Local Audio

An user can mute his end to stop sharing audio from their end, but at the same time they can receive audio from other end. JS SDK provides audioMuteToggle() API in IrisRtcSession class for the same.

If an user is on mute he can unmute the call and resume conversation by calling the same API again audioMuteToggle(). RoomId Should be passed as a parameter

var irisRtcSession = new IrisRtcSession();
irisRtcSession.audioMuteToggle(roomId);

Mute Local Video

An user can mute his end to stop sharing audio from their end, but at the same time they can receive audio from other end. JS SDK provides videoMuteToggle() API in IrisRtcSession class for the same.

If an user is on mute he can unmute the call and resume conversation by calling the same API again videoMuteToggle(). RoomId Should be passed as a parameter

var irisRtcSession = new IrisRtcSession();
irisRtcSession.videoMuteToggle(roomId);

Video Call Related Callbacks

onRemoteStream

This callback gets invoked when the remote stream is added to peerconnection (the mechanism in WebRTC that provides all the communication capabilities of WebRTC).

var irisRtcSession = new IrisRtcSession();
irisRtcSession.onRemoteStream = (roomId, remoteStream) => {
    // Remote stream is received from participant
};
Parameters
roomIdRoom id received from Iris backend
remoteStreamMedia stream of the participant

onRemoveRemoteStream

This callback gets invoked when the remote stream is removed from the peerconnection.

var irisRtcSession = new IrisRtcSession();
irisRtcSession.onRemoteStreamRemove = (roomId, participantId) => {
    // Other participant has removed his media stream from session
};
Parameters
participantIdRouting id of the participant
roomIdRoom id received from Iris backend
← How to initiate or accept PSTN callHow to create a screen share session →
  • Create Local Media Stream
  • Initiate an Outgoing Call
  • Accept Incoming Video Call
  • End an Active Call
  • On-call Features
    • Mute Local Audio
    • Mute Local Video
  • Video Call Related Callbacks
    • onRemoteStream
    • onRemoveRemoteStream
Docs
Getting StartedGuidesAPI Reference
More
BlogGitHub
555 Platform
Copyright © 2024 555 Platform ™
555docs-v0.0.94