Platform

Platform

  • Getting Started
  • API

›Android 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

Rtc555 Android SDK supports Video calls between its users. It supports on-call features such as video mute/unmute, audio mute/unmute, etc.

Before initiating or accepting a Video call, make sure you have logged in to 555 platform.

SDK initialization

Below API initializes and sets the context for the SDK. It is advisable to call this API at the launch of the application. Pass application context to the API.

Rtc555Sdk.initializeLibrary(getApplication());
Parameters
appContextApplication context

Adding SDK configuration

To make Video related API call, SDK should have below mentioned mandatory configuration data to establish a connection with the 555 platform backend.

      Rtc555Config config = Rtc555Sdk.getInstance().getConfig();
      config.routingId = "<uuid@domain>"  // Unique id for the user logged in 555 platform. 
      config.url = "<EVM_URL>" // Event manager URL
      config.token = "<555 JWT token>" // JWT token for accessing the 555 SDK/backend APIs. Token can be access from the 555 login response. 
      config.notificationManagerUrl = "<NTM_URL>" // (Optional) For mobile notifications from 555 Platform

      Rtc555Sdk.setConfig(config);

Create Stream

To make video call first you need to create stream which will provide you the local stream id that is used in video call APIs. We need to pass Rtc555VideoObserver as parameter.

On calling createStream API, user will get local stream id on onLocalStream callback.

 Rtc555Video.createStream(Rtc555VideoObserver observer);
Parameters
observerRtc555VideoObserver

Initiate an Outgoing Video Call

To make outgoing video calls, pass callee email address, notification data and stream id to call API. Notification payload contains two fields called data and notification. The client can make use of data to send any custom key/value pair to remote (callee) end as part of the push notification payload. The below code shows some example to send caller Id (cid) & caller name (cname). The notification key contains the notification type and topic as mentioned in below code snippet.

The API also needs an instance of RTC555Result observer which provides onSuccess and onError callbacks.

call API returns a single value response. Success case of response will return call-Id (Unique identifier for the call). On failure it returns Rtc555Exception object.

 


Rtc555Video.call("testuser@comcast.com", notificationData(), streamId,observer, new Rtc555Result() {
                @Override
                public void onSuccess(String callId) {
                    Log.d(TAG, callId);
                }

                @Override
                public void onError(Rtc555Exception e) {
                    Log.d(TAG, e.getMessage());
                    e.printStackTrace();
                }
            });

private HashMap notificationData() {

        HashMap<String,HashMap> userdata = new HashMap<>();

        HashMap<String,String> notification = new HashMap<>();
        HashMap<String,Object> data = new HashMap<>();
        try {

            data.put("cname", "username");
            data.put("cid", "testuser@comcast.com");
            data.put("isVideoOnly", true);

            notification.put("type", "video");
            notification.put("topic", String.format("%s/%s", your_app_domain , "video"));

            userdata.put("data", data);
            userdata.put("notification", notification);

        } catch (Exception e) {
            e.printStackTrace();
        }

        return userdata;

    }

ParametersDescription
targetEmailAddressTarget(callee) Email.
notificationPayloadNotification payload data.
streamIdLocal Stream Id
observerRtc555VideoObserver
Rtc555ResultInstance of observer which gives success or failue callback

Below is the Notification payload need to be build for outgoing notificationData:

PropertyTypeDescription
dataHashMape.g.
  • cname
  • cid
  • isVideoOnly
notificationHashMap
  • type:"video"
  • topic :"your_app_domain/video"

Note: Please make sure client has microphone and camera permission before accessing the call/accept APIs from the SDK.

Accept Incoming Video Call

To accept the incoming Video call request, invoke accept API and pass the data received from incoming push notification. The API also needs an instance of RTC555Result observer which provides onSuccess and onError callbacks.

accept API returns call-Id (Unique identifier for the call). On failure it returns Rtc555Exception object.



   Rtc555Video.accept(notificationData(incomingPushInvite), streamId, observer, 
       new Rtc555Result() {
           @Override
           public void onSuccess(String callId) {
               Log.d(TAG,"CallId: "+callId);            
           }

           @Override
           public void onError(Rtc555Exception e) {
               Log.d(TAG,e.getMessage());
               Log.d(TAG,e.getCode());
           }
        });

   private HashMap notificationData(Map<String, String> incomingPushInvite) {

       HashMap<String, String> notificationdata = new HashMap<String, String>();
       try {

           notificationdata.put("trace_id", incomingPushInvite.get("trace_id"));
           notificationdata.put("rtc_server", incomingPushInvite.get("rtc_server"));
           notificationdata.put("room_id", incomingPushInvite.get("room_id"));
           notificationdata.put("to_routing_id", incomingPushInvite.get("routing_id"));
           notificationdata.put("room_token", incomingPushInvite.get("room_token"));
           notificationdata.put("room_token_expiry_time", 
               String.valueOf(incomingPushInvite.get("room_token_expiry_time")));

       } catch (Exception e) {
           e.printStackTrace();
       }

       return notificationdata;

   }
        
        
ParametersDescription
notificationDataReturns key/value pair for the data received from push payload.
streamIdLocal Stream Id
observerRtc555VideoObserver
Rtc555ResultInstance of observer which gives success or failue callback

First parameter i.e notificationdata is the map including the key/value pair for the values received as part of the incoming push payload. Parse the notification payload and populate the notificationdata map for below keys.

ParametersDescriptionMapping in Notification Payload
trace_idTrace ID for the call<trace_id>
room_idRoom ID that needs to be joined<room_id>
room_tokenRoom token<room_token>
room_token_expiry_timeRoom token expiry time<room_token_expiry_time>
to_routing_idCaller's routing Id<routing_id>
rtc_serverRTC server URL<rtc_server>

End an Active Video Call

Users need to invoke hangup API to end the active call.

  Rtc555Video.hangup(String callId);
ParametersDescription
callIdcallId is unique id for this call which was returned from call/accept API

Clean up the session.

Call below API in Rtc555Sdk to release all the resources used by SDK. This call also allows the client to disconnect with the 555 platform backend. The app developer should call this API if the app goes to the background or kill state to release the SDK resource. Client need to call setConfig API again before attempting to initiate/accept the call.

  Rtc555Sdk.cleanup();

Video On-call Features

Features offered by Android SDK for Video call are:

  • Toggle Audio Mute
  • Toggle Video Mute
  • Flip Camera

Toggle Audio Mute

This API call allows users to mute and unmute its audio in the ongoing call.

    Rtc555Video.audioMuteToggle(String callId);
ParametersDescription
callIdcallId is unique id for this call which was returned from call/accept API

Toggle Video Mute

This API call allows users to mute and unmute its video stream in the ongoing call.

    Rtc555Video.videoMuteToggle(String callId);
ParametersDescription
callIdcallId is unique id for this call which was returned from call/accept API

Flip Camera

This API call allows users to flip between front and rear camera of the device.

    Rtc555Video.flipCamera();

Video Call Callbacks

To get local stream, remote stream, call status or error report implement Rtc555VideoObserver interface and initialize the observer and pass in call / accept API

onLocalStream

This callback gets is used to get local stream id which is required to make call and accept call. This stream can be used to render in the device screen using Rtc555Renderer

    public void onLocalStream(String s);
ParametersDescription
streamIdLocal Stream Id

onRemoteStream

This callback gets is used to get stream id of remote participant which is used to render remote video in the current user's screen using Rtc555Renderer

    public void onRemoteStream(String s);
ParametersDescription
streamIdRemote Stream Id

onStatus

This callback gets invoked when we receive the status of an ongoing Video call.

    void onStatus(Rtc555Sdk.CallStatus callStatus, String callId);
ParametersDescription
statusstatus of ongoing call
callIdCall id for the ongoing call

Call Status:

  • connected    -   When the call is connected and media(video stream) started transffering.
  • disconnected  -   When the call is disconnected i.e. when remote side hang up the call.

onError

This callback gets invoked when we receives Rtc555Exception from an ongoing Video call.

    void onError(Rtc555Exception rtc555Exception, String callId);
ParametersDescription
rtc555Exceptionerror object consists of error code and error message
callIdcallId received from backend

Video Call Renderer

The video call renderer referred as Rtc555Renderer provided by the Rtc555Sdk is use to render the video on the UI using stream id from Local Stream and Remote Stream.

To initialize you need to pass the height and width of the View where we need to render the video stream. After that you have to add the rootView variable of Rtc555Renderer in the layout View of the UI (Use FrameLayout for best result). You need to create two instances of Rtc555Renderer, one for Local and one for Remote.

Rtc555Renderer renderer = new Rtc555Renderer(width, height);
yourFrameLayout.addView(renderer.rootView);
ParametersDescription
widthWidth of the rendering View
heightHeight of the rendering View

addStream

This API is used to add the Stream id receive from Local Stream and Remote Stream in the Rtc555Renderer

void addStream(streamId, activity); 
ParametersDescription
streamIdStream Id
activityAndroid Activity
← How to initiate or accept PSTN callHow to intiate or accept ANONYMOUS VIDEO Call →
  • SDK initialization
  • Adding SDK configuration
  • Create Stream
  • Initiate an Outgoing Video Call
  • Accept Incoming Video Call
  • End an Active Video Call
  • Clean up the session.
  • Video On-call Features
    • Toggle Audio Mute
    • Toggle Video Mute
    • Flip Camera
  • Video Call Callbacks
    • onLocalStream
    • onRemoteStream
    • onStatus
    • onError
  • Video Call Renderer
    • addStream
Docs
Getting StartedGuidesAPI Reference
More
BlogGitHub
555 Platform
Copyright © 2024 555 Platform ™
555docs-v0.0.94