@trtc/call-engine-lite-wx
v5.0.1
Published
Pure-JS TUICallEngine implementation for WeChat Mini Program (no WASM). API-compatible with @trtc/call-engine-lite-wx.
Readme
Pure-JS TUICallEngine for WeChat Mini Program. No WASM.
Introduction
@trtc/call-engine-lite-wx is a pure-JavaScript reimplementation of the
TUICallEngine SDK targeting the WeChat Mini Program runtime. It exposes
the same API surface as the classic WASM-based TUICallEngine so that
TUICallKit and existing business code can switch over without changing
event names or method signatures — while shipping a significantly smaller
bundle (no WebAssembly, no C++ glue).
- Built on top of Tencent Cloud IM and TRTC.
- Supports 1v1 and group audio / video calls.
- More platform SDKs (Web / Android / iOS / Flutter): see trtc.io.
Install
Using npm:
$ npm install @trtc/call-engine-lite-wx --saveUsing yarn:
$ yarn add @trtc/call-engine-lite-wxDownload manually:
- Download @trtc/call-engine-lite-wx.
- Copy
@trtc/call-engine-lite-wxinto your project'sminiprogram_npm(or equivalent) directory.
Peer dependencies (install alongside):
$ npm install @tencentcloud/lite-chat @tencentcloud/trtc-component-wxUsage
import TUICallEngine, { TUICallEvent } from '@trtc/call-engine-lite-wx';
TUICallEngine.once('ready', async () => {
const engine = TUICallEngine.createInstance({ SDKAppID });
engine.on(TUICallEvent.SDK_READY, () => console.log('SDK ready'));
engine.on(TUICallEvent.KICKED_OUT, () => { /* ... */ });
engine.on(TUICallEvent.onUserSigExpired, () => { /* refresh userSig */ });
await engine.login({ userID, userSig });
});Explore SDK documents: TUICallEngine WX SDK.
API Overview
- tuiCallEngine instance, provides the core capability for real-time audio and video calls.
- Start single or group calls calls
- Accept call accept
- Reject call reject
- Hangup call hangup
- Turn on camera openCamera
- Turn on microphone openMicrophone
- Turn off camera closeCamera
- Turn off microphone closeMicrophone
- Play remote video startRemoteView
- Stop playing remote video stopRemoteView
Directory
├── README-zh_CN.md
├── README.md
├── index.js // WeChat Mini Program bundle (CJS, minified)
├── index.esm.mjs // sdk file base on ESM modules
├── index.cjs.js // sdk file base on CommonJS modules
├── index.umd.js // sdk file base on UMD modules
├── index.d.ts // ts declaration file
└── package.json