Two-way Audio and Video Call

Last Updated on : 2025-01-02 10:29:23download

Two-way audio and video calls include two-way transmission and call capabilities extended based on the audio and video features. When the SDK sends a call request, it initiates live streaming and starts local audio and video capture. After the peer end answers the call and the P2P channel is connected, two-way audio and video data transmission is implemented.

How it works

Two-way Audio and Video Call

Important notes

  • Request system permissions in advance to collect audio and video data from the users’ mobile phones.
  • When initiating an audio and video call, a large number of atomic interfaces are called. To prevent lag when opening the page, please manage the sequence of interface requests.
  • The device shall enable the two-way video advanced capability to send and receive device calls.

Core code

Create an IThingSmartCameraP2P object

IThingSmartCameraP2P createCameraP2P(String devId);

Connect

void connect(String devId, OperationDelegateCallBack callBack);

Start live streaming

// Start live streaming
void startPreview(int definition, OperationDelegateCallBack callBack);

Stop live streaming

// Stop live streaming
void stopPreview(OperationDelegateCallBack callBack);

Disconnect

// Proactively disconnect
void disconnect(OperationDelegateCallBack callBack);

Bind with a local video rendering view

// Bind with a custom local video rendering view
void generateCameraView(T view);

Audio talk

// Start audio talk
void startAudioTalk(OperationDelegateCallBack callBack);

// Stop audio talk
void stopAudioTalk(OperationDelegateCallBack callBack);

Video talk

// Enable local camera
boolean startVideoCapture();

// Disable local camera
void stopVideoCapture();

// Switch between cameras
boolean switchCamera();

// Start video talk
void startVideoTalk(OperationDelegateCallBack callBack);

// Stop video talk
void stopVideoTalk(OperationDelegateCallBack callBack);

// Pause video talk
void pauseVideoTalk(OperationDelegateCallBack callback);

// Resume video talk
void resumeVideoTalk(OperationDelegateCallBack callback);

Example

You can refer to the complete process in the SDK sample.