Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Example of Android application for video calls

On the screenshot below the example is displayed when a call is established.

The interface of he application is the same as in the example Phone, except that controls for muting/unmuting audio and video are added and two videos are played

  • left - video from the camera of this user
  • right - video from the other call party

Image Added

Work with code of the example

To analyze the code, let's take class PhoneMinVideoActivity.java of the phone-min-video example version with hash 4ed4c6d77, which can be downloaded with corresponding build 1.0.1.3.

Functions of initialization, placing an outgoing call and answering incoming call work the same as described in the example Phone.

Differences from the example Phone:

1. Object SessionOptions (line 248) with the following parameters is passed to method createSession() when session for connection to WCS server is created

  • URL of WCS server
  • SurfaceViewRenderer, which will be used to display video from the camera
  • SurfaceViewRenderer, which will be used to play video from the other party

2. Video constraints are set when outgoing call is created and incoming call is received

  • for outgoing call: callOptions.getConstraints().updateVideo(true); line 421
  • for incoming call: call.getCallOptions().getConstraints().updateVideo(true); line 351

3. Mute/unmute audio and video. line 474, line 491

The following methods are used to mute/unmute audio and video

  • call.unmuteAudio();
  • call.muteAudio();
  • call.unmuteVideo();
  • call.muteVideo();