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

Reference code snippet - How to initiate or join Anonymous Video Call

Sample Video call implementation.

Create an application class to initialize the SDK

public class MyApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        Rtc555Sdk.initializeLibrary(this);
    }
}

Link the application class in AndroidManifest.xml

<manifest 
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.rtcandroiddemo">

    <application
        android:name=".MyApplication"
        ...
        >

        ...
    </application>

</manifest>

Set SDK configuration after successful login

//After successful login
class VideoCallActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_video_call);
        init();
    }

    private void init(){
        Rtc555Sdk.setConfig(configObject(getApplication()));
    }

    private Rtc555Config configObject() {

        Rtc555Config configObject = Rtc555Sdk.getInstance().getConfig();
        
        configObject.routingId = "a2685b26-5ef0-11ea-83a9-fa163e547f24@uciris12.comcast.net";  // Random uuid @ appdomain;
        configObject.token = <555_JWT_TOKEN> // Token from the 555 anonymous login response. 
        configObject.url = <EVM_URL>; // Event manager URL
        configObject.domain = <DOMAIN> // Unique domain name 
        return configObject;
    }
}

Implement SDK Video callbacks


public class VideoCallActivity extends AppCompatActivity implements Rtc555Video.Rtc555VideoObserver {

    ...    

    private Boolean hasActiveCall = false;
    private Rtc555Renderer dominantRenderer,remoteRenderer;
    private FrameLayout dominantLayout;
    private LinkedHashMap<String, String> streamMap;
    private String streamId;

    private void init(){
        ...
        Rtc555Video.createStream(this);
    }

    @Override
    public void onRemoteStream(String streamId) {
        
    }

    @Override
    public void onLocalStream(String streamId) {
        this.streamId = streamId;
        dominantRenderer = new Rtc555Renderer(dominantLayout.getWidth(), dominantLayout.getHeight());
        dominantRenderer.addStream(streamId, VideoCallActivity.this);
        dominantLayout.addView(dominantRenderer.rootView);

        // start anonymous video call
        initiateVideoCall()
    }

    @Override
    public void onParticipantJoined(String streamId, String id) {
        FrameLayout remoteLayout = new FrameLayout(this);
        /*
         * Add height and width and margins of the 
         * remoteLayout as layout params
         */
        remoteRenderer = new Rtc555Renderer(remoteLayout.getWidth(), remoteLayout.getHeight());
        remoteRenderer.addStream(streamId, VideoCallActivity.this);
        remoteLayout.addView(remoteRenderer.rootView);

        //use this remoteLayout as a child to add in a list or a grid to show all the joined participants
    }

    @Override
    public void onParticipantLeft(String id) {
        streamMap.remove(id);
        //Update the remote children layout UI
    }

    @Override
    public void onDominantSpeakerChanged(String id) {
        
        //Update the dominant layout UI 
        String dominantStreamId = streamMap.get(id);
        dominantRenderer.addStream(streamId, VideoCallActivity.this);
        
    }


    @Override
    public void onStatus(CallStatus callStatus, String callId) {
        switch (callStatus) {
            case initializing:
                Log.d(TAG, "Initializing..");
                break;
            case connecting:
                Log.d(TAG, "Connecting..");
                break;
            case reconnecting:
                Log.d(TAG, "Reconnecting..");
                break;
            case connected:
                Log.d(TAG, "Active Call..");
                hasActiveCall = true;
                break;
            case disconnected:
                Log.d(TAG, "Disconnected..");
                hasActiveCall = false;
                break;
            case hold:
                Log.d(TAG, "Hold..");
                break;    
        }
    }

    @Override
    public void onError(Rtc555Exception errorInfo, String callId) {
        Log.d(TAG,"Error: "+e.getMessage()+ "for callId: "+callId);
    }
}

Initial Anonymous Video call

private void initiateVideoCall(){
    
        Rtc555Video.anonymousCall("room_name",streamId, this, 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();
            }
        });
    }

Video on call features


@Override
    protected void onCreate(Bundle savedInstanceState) {

        ...

        // User tapped on mute audio button
        findViewById(R.id.your_mute_audio_button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Rtc555Video.audioMuteToggle(callId);
            }
        });

        // User tapped on mute video button
        findViewById(R.id.your_mute_video_button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Rtc555Video.videoMuteToggle(callId);
            }
        });

        // User tapped on flip camera button
        findViewById(R.id.your_flip_camera_button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                 Rtc555Video.flipCamera();
            }
        });

        // User tapped on end call button
        findViewById(R.id.your_hangup_button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Rtc555Video.hangup(callId);
            }
        });

    }

@Override
    protected void onStop() {
        super.onStop();
        ////No active video call then
        if(!hasActiveCall)
            Rtc555Sdk.cleanup();
    }

Note: For good performance try to use seperate UI handler threads for the updating the layouts. Don't forget to unsubscribe those handler threads on exiting the current activity.

← Reference code - How to initiate or accept Video CallGetting started →
  • Sample Video call implementation.
Docs
Getting StartedGuidesAPI Reference
More
BlogGitHub
555 Platform
Copyright © 2024 555 Platform ™
555docs-v0.0.94