Two-way Video Talk

Last Updated on : 2025-12-30 03:35:50download

Two-way video talk refers to IP camera (IPC) devices equipped with a display screen that support two-way video calls with an app or other IPC devices.

Features

Typically, the IPC is responsible for capturing images and transmitting them to the peer end for display. Two-way means the IPC can receive a video stream from the peer end and play it on its own display screen.

Implementation framework

Two-way Video Talk

Product features

Device appearance

Front view

Two-way Video Talk

Top view

Two-way Video Talk

Binding configuration on the app

The following example configures the target for initiating active calls on the app via the device button.

Two-way Video Talk

Two-way talk

Press device button to initiate calls

Two-way Video Talk

Receive a call request on the app

Two-way Video Talk

Answer the call

Two-way Video Talk

Components

  • svc_tmm_link
  • svc_ipc_tmm_control

APIs

Initialize control module

Initialize the two-way video talk control module, mainly including initializing resources and creating threads.

/*****************************************************************************
 * @brief      Initialize the control module.
 *
 * @param      cb: The event callback function, which includes receiving call requests, notifications and replies from the other party.
 * @param      priv_data: User data, returned via the callback.
 * @param      call_timeout_s: Set the call timeout in seconds. The default 30s is used if the set value is ≤0.
 *
 * @return
 *     - 0: success
 *     - Other values: error
*****************************************************************************/
OPERATE_RET tuya_tmm_control_init(TUYA_TMM_CONTROL_EVT_CB cb, VOID* priv_data, INT_T call_timeout_s);

Deinitialize control module

Deinitialize the two-way video talk control module, mainly including destroying resources and terminating threads.

/*****************************************************************************
 * @brief      Deinitialize the control module.
 *
 * @return
 *     - 0: success
 *     - Other values: error
*****************************************************************************/
OPERATE_RET tuya_tmm_control_deinit(VOID);

Initiate a call

/*****************************************************************************
 * @brief     Initiate a call to the target device.
 *
 * @param      target_device: The target device.
 * @param      category: The category of this device, which can be "" (empty string).
 * @param      stream_type: The type of the call stream.
 * @return
 *     - 0: success
 *     - Other values: error
*****************************************************************************/
OPERATE_RET tuya_tmm_control_call(CHAR_T *target_device, CHAR_T *category, TUYA_TMM_CONTROL_STREAM_TYPE_E stream_type);

Get the list of paried devices

/** @brief get the paired device list
 * @warning this will get the local list, no http request to cloud
 * @return the list head of paired device list, use tuya_list_for_each to visit, the type is TMM_ASSOC_DEV_T
 */
LIST_HEAD* tuya_tmm_link_get_paird_dev_list();

Accept a call request

Receive and accept a call request initiated by the peer end.

/*****************************************************************************
 * @brief     Accept an incoming call.
 *
 * @return
 *     - 0: success
 *     - Other values: error
*****************************************************************************/
OPERATE_RET tuya_tmm_control_answer(VOID);

Reject a call request

Receive and reject a call request initiated by the peer end.

/*****************************************************************************
 * @brief      Reject an incoming call.
 *
 * @return
 *     - 0: success
 *     - Other values: error
*****************************************************************************/
OPERATE_RET tuya_tmm_control_reject(VOID);

Proactively cancel a call

After having initiated a call, proactively cancel the call to the peer end before receiving an answer.

/*****************************************************************************
 * @brief      Cancel an outgoing call.
 *
 * @return
 *     - 0: success
 *     - Other values: error
*****************************************************************************/
OPERATE_RET tuya_tmm_control_cancel(VOID);

Proactively hang up the current call

/*****************************************************************************
 * @brief      Hang up the current call.
 *
 * @return
 *     - 0: success
 *     - Other values: error
*****************************************************************************/
OPERATE_RET tuya_tmm_control_hangup(VOID);

Stop initiating and receiving calls

Notify the server that this device stops initiating and receiving calls.

/*****************************************************************************
 * @brief     Stop initiating and receiving calls.
 *
 * @return
 *     - 0: success
 *     - Other values: error
*****************************************************************************/
OPERATE_RET tuya_tmm_control_stop(VOID);

Reject incoming calls

After receiving a call request, notify the peer end that this device is busy.

/*****************************************************************************
 * @brief      The device is busy.
 *
 * @return
 *     - 0: success
 *     - Other values: error
*****************************************************************************/
OPERATE_RET tuya_tmm_control_busy(VOID);

Product development

Development process

Receive an incoming call request

Initialize the module
tuya_tmm_control_init
Bind target accounts in app call settings,
or bind other IPC devices under this account
Receive a call request
TUYA_TMM_CONTROL_EVT_INCOMING
Choose to answer/accept
tuya_tmm_control_answer
Start/Stop + audio/video + sending/receiving
tuya_tmm_link_media_ctl
Hang up the call
tuya_tmm_control_hangup
Terminate dialogue due to device exception
tuya_tmm_control_stop
Exception typically refers to non-user-initiated hang-up:
1. Device detects related service exceptions.
2. Other necessary reasons.
Receive peer end proactively disconnecting
TUYA_TMM_CONTROL_EVT_HANGUP
TUYA_TMM_CONTROL_EVT_STOP
Receive peer end cancelling the call
TUYA_TMM_CONTROL_EVT_CANCEL
Choose not to answer
Reason for not answering: Reject
tuya_tmm_control_reject
How to reject:
1. Device has a dedicated reject button.
2. Device screen has a touch reject button.
Reason for not answering: Busy
tuya_tmm_control_busy
Busy reason could be:
1. Already in a call with another party.
2. Device is being previewed, choose to reject due to uplink bandwidth pressure.
Other considerations.
Reason for not answering: Timeout
tuya_tmm_control_unanswer
After device receives call request, user is not nearby,
no action taken within timeout period.
If device has no reject button, this interface can be ignored.

Proactively call the peer end

Initialize the module
tuya_tmm_control_init
Bind target accounts in app call settings,
or bind other IPC devices under this account
Proactively call the account or device
bound in the app call settings via a button press
tuya_tmm_control_call
The peer end chooses to answer/accept
TUYA_TMM_CONTROL_EVT_ACCEPTED
Hang up the call
tuya_tmm_control_hangup
Proactively terminate dialogue due to device exception
tuya_tmm_control_stop
Receive stop call notification
TUYA_TMM_CONTROL_EVT_STOP
Receive peer end hang-up
TUYA_TMM_CONTROL_EVT_HANGUP
Proactively cancel the call
tuya_tmm_control_cancel
How to proactively cancel a call:
1. On-screen button
2. Double-press the physical button
Peer end chooses not to answer
tuya_tmm_control_cancel
Reason for not answering: Reject
TUYA_TMM_CONTROL_EVT_REJECT
Reason for not answering: Busy
TUYA_TMM_CONTROL_EVT_BUSY
Reason for not answering: Timeout
TUYA_TMM_CONTROL_EVT_UNANSWERED