Suggestions

close search

Upgrade an audio call to video call

You can upgrade an audio call to a video call by calling the enableVideo(true) method of the StringeeCall object:

mStringeeCall.enableVideo(true);

Stringee also provides APIs to make it easy to send an upgrade request from a client to another. Follow the instructions below to implement a full upgrade flow:

1. Client A and client B is on an audio call.

2. Client A calls the enableVideo(true):

stringeeCallA.enableVideo(true);

3. Client A implements the StringeeCallMediaListener to display the local and remote video (see Get started).

4. Client A sends an upgrade request to client B:

JSONObject jsonObject = new JSONObject();
try {
    jsonObject.put("type", "cameraRequest");
} catch (JSONException e) {
    e.printStackTrace();
}
stringeeCallA.sendCallInfo(jsonObject);

5. Client B implements the StringeeCallMediaListener and overrides the onCallInfo(StringeeCall stringeeCall, final JSONObject jsonObject) method:

@Override
public void onCallInfo(StringeeCall stringeeCall, final JSONObject jsonObject) {
}

6. Client B calls the enableVideo(true):

public void onCallInfo(StringeeCall stringeeCall, final JSONObject jsonObject) {
    try {
        String type = jsonObject.getString("type");
        if (type.equals("cameraRequest")) {
            stringeeCallB.enableVideo(true);
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
}

7. Client B displays the local and remote video (see Get started).