Making a Video Call

Making a Video Call

Scenario 1: Make a Video Call

  1. Integrate the package; see Integrate Video Package.
  2. Create an RtcEngine object; see Create RtcEngine Object (create).
  3. Create a video renderer view; see Create Render View(createRendererView).
  4. Enable video mode; see Enable Video Mode (enableVideo).
  5. Set the local video; see Set Local Video View(setupLocalVideo).
  6. Set the remote video; see Set Remote Video View (setupRemoteVideo).
  7. Set the video resolution; see Set Video Profile (setVideoProfile).
  8. Create and join a channel; see Join Channel (joinChannel).

Note

After joining a channel, the SDK turns on the camera by default, and the user can call Start Video Preview (startPreview) to enable the preview function. The user can also call Disable Video Mode (disableVideo) to switch to voice mode.

Sample Code:

//Create RtcEngine Object
RtcEngine rtcEngine = RtcEngine.create(ctx, "74******************************a", myRtcEventHandler);

//Enable Video Mode
rtcEngine.enableVideo();

//Set Video Resolution
rtcEngine.setVideoProfile(Constants.VIDEO_PROFILE_360P, false);

//Create Renderer View and Set Local Video View
SurfaceView myVideoView = RtcEngine.CreateRendererView(ctx)
rtcEngine.setupLocalVideo(new VideoCanvas(myVideoView, VideoCanvas.RENDER_MODE_HIDDEN, myUid));

//Create Renderer View and Set Remot Video View
SurfaceView remoteVideoView = RtcEngine.CreateRendererView(ctx)
rtcEngine.setupRemoteVideo(new VideoCanvas(remoteVideoView, VideoCanvas.RENDER_MODE_HIDDEN, remoteUid));

//Create and join a channel
rtcEngine.joinChannel(null, "channelName", null, myUid)

You can now start a one-to-one or group video call. The difference between a one-to-one and group call is the number of people joining the channel.

Scenario 2: Implement other Functions

Agora will provide the API call workflow and sample code for the following scenarios in the future. For now, refer to Video Call API:

  • Voice and video conference
  • Image control
  • Send text messages
  • Capture video data

You may need the following functions for a video call:

  • ../Tutorial/recording
  • ../Tutorial/encryption_android_agora
  • ../Tutorial/encryption_android_customize
  • ../Tutorial/rawdata_android