本文介绍 TUICallKit 组件通话状态回调的使用。
通话状态监听
<script setup>// 替换成 TUICallKit 源码中的地址import { TUICallKitServer } from "../../TUICallKit/src/index";import { EVENT } from "tuicall-engine-wx";// 绑定监听的函数const bindEvent = () => {// setup 语法糖没有this,需要绑定回调函数的执行上下文const context = {handleNewInvitationReceived,};TUICallKitServer.getTUICallEngineInstance().on(EVENT.INVITED,handleNewInvitationReceived,context);};// 回调函数const handleNewInvitationReceived = (event) => {console.log("收到新的邀请", event);};</script>
<script>// 替换成 TUICallKit 源码中的地址import { TUICallKitServer } from "../../TUICallKit/src/index";import { EVENT } from "tuicall-engine-wx";// 绑定监听的函数bindEvent() {TUICallKitServer.getTUICallEngineInstance().on(EVENT.INVITED,this.handleNewInvitationReceived,this);},// 回调函数handleNewInvitationReceived(event) {console.log("收到新的邀请", event);},</script>