All Products
Search
Document Center

Intelligent Media Services:Push-to-talk mode

Last Updated:May 15, 2025

This topic describes how to use AICallKit SDK to enable push-to-talk mode.

Before you begin

Overview

Enable push-to-talk mode

Switches from natural conversation mode to push-to-talk mode.

45050f7ef32c1acc391ab1b18c7b171e

Start speaking

Presses and holds the Speak button to start communicating with the agent.

lQDPJww8JdHXqQHNCMbNBDiwZR5mz6fv448HV0koHPV0AA_1080_2246

Note

This feature is included in the integration solution with a UI.

How it works

In push-to-talk mode, each input from a user and each response from the AI agent are treated as independent events, similar to how traditional intercoms work. This mode makes the interaction between the users and AI agent more structured and orderly. In push-to-talk mode, users can communicate with the AI agent in a more efficient and organized manner.

API details

API operation

Description

enablePushToTalk

Enables or disables push-to-talk mode. The status is indicated by the onPushToTalk callback.

startPushToTalk

Presses and holds to start speaking. This call is valid only after push-to-talk mode is enabled. During this period, the agent will remain in the listening state, and what the user says will be displayed in real time.

Note

We recommend that you call this API operation in the press event, and not in the release event.

finishPushToTalk

Releases to finish speaking. The AI agent enters the thinking state, and soon broadcasts the results.

cancelPushToTalk

Releases to cancel speaking. The AI agent does nothing and immediately returns to the waiting state of holding down to start speaking.

Sample code

Android

// By default, push-to-talk mode is disabled. In this example, true is passed to enable push-to-talk mode.
mARTCAICallEngine.enablePushToTalk(enable: true)

// Press and hold to start speaking.
mARTCAICallEngine.startPushToTalk()

// Release to finish speaking.
mARTCAICallEngine.finishPushToTalk()

// Release to cancel speaking.
mARTCAICallEngine.cancelPushToTalk()

// Handle callback events.
ARTCAICallEngine.IARTCAICallEngineCallback mCallEngineCallbackWrapper = new ARTCAICallEngine.IARTCAICallEngineCallback() {
    
    @Override
    public void onPushToTalk(boolean enable) {
        // Indicate whether the onPushToTalk callback is configured for the current call.
        // The onPushToTalk callback will tell you if push-to-talk mode has been enabled or disabled.
    }
}

Web

// By default, push-to-talk mode is disabled. In this example, true is passed to enable push-to-talk mode.
engine.enablePushToTalk(enable);

// Press and hold to start speaking.
engine.startPushToTalk();

// Release to finish speaking.
engine.finishPushToTalk();

// Release to cancel speaking.
engine.cancelPushToTalk();

engine.on('pushToTalkChanged', (enable) => {
  // Indicate whether the onPushToTalk callback is configured for the current call.
  // The onPushToTalk callback will tell you if push-to-talk mode has been enabled or disabled.
  console.log('AICallPushToTalk', enable);
});