Web&H5
This document describes how to use the Call Status Callback of the TUICallKit component.
Call Status Monitoring
If your business needs to monitor the status of calls, such as events during the call process including the start and end of calls (see TUICallEvent for details), refer to the following code:
import { TUICallEvent } from 'tuicall-engine-webrtc';let handleUserEnter = function(event) {console.log('TUICallEvent.USER_ENTER: ', event);};TUICallKitServer.getTUICallEngineInstance().on(TUICallEvent.USER_ENTER, handleUserEnter);TUICallKitServer.getTUICallEngineInstance().off(TUICallEvent.USER_ENTER, handleUserEnter);
Component Callback Event
The TUICallKit component provides call status callbacks, which can be used for more interaction logic on the business side. For details, see Introduction to TUICallKit Attributes.
beforeCalling: Executed before the call starts.
afterCalling: Executed after the call ends.
function App() {const handleBeforeCalling = () => {console.log("[TUICallKit Demo] beforeCalling");};const handleAfterCalling = () => {console.log("[TUICallKit Demo] afterCalling");};return (<TUICallKitbeforeCalling={handleBeforeCalling}afterCalling={handleAfterCalling} />)}
<template><TUICallKit:beforeCalling="handleBeforeCalling":afterCalling="handleAfterCalling" /></template><script setup>function handleBeforeCalling() {console.log("[TUICallKit Demo] beforeCalling");}function handleAfterCalling() {console.log("[TUICallKit Demo] afterCalling");}</script>