ANONYMOUS VIDEO Call
Rtc555 Android SDK supports ANONYMOUS VIDEO calls between its users. It supports Multi-party video conference feature, where multiple participants can join the same call. Also supports on-call features such as mute/unmute audio/video, and flip camera.
Before initiating or accepting a Anonymous Video call, you have to logged in anonymously 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 | Description |
---|---|
appContext | Application 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 = "<random uuid used for anonymous login>@<appdomain>"
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 anonymous login response.
config.domain = "uciris12.comcast.net"
config.isAnonymous = true // Set it to true for anonymous video call.
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 | Description |
---|---|
observer | Rtc555VideoObserver |
Make Anonymous Video Call
To make an Anonymous call first you need to login anonymously and set SDK configuration. Then you need to pass a target id which can be any room name as given by the user and stream id to anonymousCall API. For two users to join the same call the target id has to be same.
The API also needs an instance of RTC555Result observer which provides onSuccess and onError callbacks.
anonymousCall 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.anonymousCall("<room-name>",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();
}
});
Parameters | Description |
---|---|
roomName | Room name given by the user |
streamId | Local Stream Id |
observer | Rtc555VideoObserver |
Rtc555Result | Instance of observer which gives success or failue callback |
End an Active Video Call
Users need to invoke hangup API to end the active call.
Rtc555Video.hangup(String callId);
Parameters | Description |
---|---|
callId | callId 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
This API call allows users to mute and unmute its audio in the ongoing call.
Rtc555Video.audioMuteToggle(String callId);
Parameters | Description |
---|---|
callId | callId 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);
Parameters | Description |
---|---|
callId | callId 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 / anonymousCall / 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);
Parameters | Description |
---|---|
streamId | Local 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);
Parameters | Description |
---|---|
streamId | Remote Stream Id |
onParticipantJoined
This callback is used to get stream id and participant id when a remote participant joined the room.
public void onParticipantJoined(String streamId, String id);
Parameters | Description |
---|---|
streamId | Remote Stream Id |
id | Participant Id |
onParticipantLeft
This callback is used to get participant id when a remote participant left the room.
public void onParticipantLeft(String id);
Parameters | Description |
---|---|
id | Participant Id |
onDominantSpeakerChanged
This callback is used to get participant id when a remote participant is actively speaking.
public void onDominantSpeakerChanged(String id);
Parameters | Description |
---|---|
id | Participant Id |
onStatus
This callback gets invoked when we receive the status of an ongoing Video call.
void onStatus(Rtc555Sdk.CallStatus callStatus, String callId);
Parameters | Description |
---|---|
status | status of ongoing call |
callId | Call 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);
Parameters | Description |
---|---|
rtc555Exception | error object consists of error code and error message |
callId | callId 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);
Parameters | Description |
---|---|
width | Width of the rendering View |
height | Height 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);
Parameters | Description |
---|---|
streamId | Stream Id |
activity | Android Activity |