npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ririxin/talking-avatar-sdk

v1.0.3

Published

文本驱动数字人的js sdk, typescript 版本

Readme

Talking Avatar SDK

文本驱动数字人的js sdk。使用 TypeScript 实现,提供完整类型定义(.d.ts)。

安装

npm install @ririxin/talking-avatar-sdk

或直接使用打包后的单文件(无需构建工具):

  • ESMdist/talking-avatar-sdk.js(配合 import
  • IIFEdist/talking-avatar-sdk.global.js<script src="">,全局 TalkingAvatarSDK.TalkingAvatar

本地打包:npm run build

使用方式

npm / ESM 单文件:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Talking Avatar SDK Demo</title>
</head>
<body>
  <video id="video" autoplay muted></video>

  <script type="module">
    import { TalkingAvatar } from 'talking-avatar-sdk';
    // 或单文件: import { TalkingAvatar } from './dist/talking-avatar-sdk.js';

    const avatar = new TalkingAvatar({
      token: 'your-token',
      videoElement: document.getElementById('video'),
      onStatusChange: (status, text) => console.log('status', status, text),
      onMessage: (type, text) => console.log(type, text),
      onData: (msg) => console.log('raw', msg)
    });

    avatar.connect();
    avatar.sendText('你好');
    avatar.disconnect();
  </script>
</body>
</html>

IIFE 单文件(无构建):

<script src="./dist/talking-avatar-sdk.global.js"></script>
<script>
  const { TalkingAvatar } = TalkingAvatarSDK;
  const avatar = new TalkingAvatar({ token: '…', videoElement: document.querySelector('video'), onMessage: () => {} });
  avatar.connect('wss://…');
</script>

TalkingAvatar 选项

| 选项 | 类型 | 说明 | |------|------|------| | token | string | 认证 Token,需要预先创建token,联系我们获取 | | wsUrl | string | 可选,频道地址,也可在 connect(url) 时传入 | | whepUrl | string | 可选,WHEP 拉流端点 URL | | videoElement | HTMLVideoElement | 可选,渲染远程视频的DOM | | onStatusChange | (status, text) => void | 连接状态变化回调:connecting / connected / disconnected | | onMessage | (type, text) => void | 消息:system / sent / received | | onData | (message) => void | 收到 JSON 时的原始对象 | | config | object | 可选,覆盖 WS 默认 config 字段 | | iceServers | array | 可选,ICE 服务器 |

方法

| 方法 | 说明 | |------|------| | connect(wsUrl?) | 发起连接 | | disconnect() | 断开连接 | | sendText(text, final?) | 发送对话文本(direct_drive) | | send(message) | 发送任意 JSON 或字符串 | | setToken(token) | 设置认证 Token | | setVideoElement(element) | 设置视频元素 | | setWsUrl(url) | 设置频道地址 | | setWhepUrl(url) | 设置 WHEP 端点 | | setOnConnectError(callback) | 连接失败时的回调 | | isConnected() | 返回是否已连接 | | getThreadId() | 返回当前 thread_id |