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

dr-liveroom

v1.4.9

Published

Zego double record service with liveroom.

Readme

快速入门

安装

使用 npm 安装 sdk: npm i dr-liveroom

初始化实例

import QueueService from "dl-liveroom";

// userType: staff 为坐席,customer 为用户
const queueService = new QueueService({ userType: "customer" });

// 初始化登录信息
await queueService.loginAsync({
  appId: "<appId>",
  server: "<server>",
  dispatchServer: "<dispatchServer>",
  tokenUrl: "<tokenUrl>",
  idName: "<idName>"
});

获取排队服务列表

// 获取正在所有排队队列的信息
const queueList = await queueService.getQueueList();
const firstQueue = queueList[0];

进入排队服务

// 客户vip信息,0为普通客户,1~9为vip等级客户
const vipInfo = 0;

// 第一个排队队列的数据信息
const { 
  queueId,
  queueName
} = firstQueue;

// 客户进入排队服务队列
const enterRes = await queue.customerEnterQueue({
  queueId,
  extraInfo: "",
  vipInfo: this.state.isVip ? 1 : 0
});

// 坐席进入队列
const enterRes = await queue.staffEnterQueue({
  queueId,
  queueName,
  roomId
});

服务回调通知及回复服务

// 坐席接人
const catchRes = await queue.staffCatch();

// 客户排队服务到达回调
queueService.onCustomerServiceStart(async (para) => {
  const { roomId } = para.body;
  const reject = false;

  // 客户回复排队服务
  await queueService.customerReply({
      /** 协商id */
      consultId,
      /** 服务选项 1 同意服务 2 拒绝服务 */
      operation: reject ? 2 : 1
  });
});

// 坐席收到客户回复
queue.onStaffServiceStart((para) => {
  window._openDialog({
    content: ["", "Customer is accept service", "Customer is reject service", "Service is timeout", "The customer is quitted queue"][para.body.customerOperation]
  });
});

进入音视频房间

// 进入音视频房间逻辑

// 发布的流视频 id
const publishStreamId = "<publishStreamId>";
// 本地预览 HTMLVideoElement
const localViewEl = "<HTMLVideoElement>";
// 远程流播放 HTMLVideoElement
const remoteViewEl = "<HTMLVideoElement>";


// 进入音视频房间
const streamList = await queueService.enterRoomAsync(roomId);
// 开始预览
await queueService.startPreviewAsync(localViewEl);
// 开始发布视频流
await queueService.startPublish(publishStreamId);
// 开始播放第一个远程视频流
await queueService.playStream({ viewEl: remoteViewEl, streamId: streamList[0].streamId });

退出排队服务队列

// 客户退出排队服务队列
await queueService.customerQuitQueue();
// 组拍戏退出排队服务队列
await queueService.staffQuitQueue();

离开音视频房间

// 离开音视频房间逻辑

// 离开音视频房间
await queueService.leaveRoom();
// 停止本地预览
await queueService.stopPreview();
// 停止发布视频流
await queueService.stopPublish();
// 停止播放所有远程视频流
await queueService.stopPlayStreams();

相关事件回调注册

// 注册部分事件回调

queueService.onCustomerServiceTimeout = () => {
    console.log("is service timeout.");
};

queueService.onUserStateUpdate = (roomId, userList) => {
    console.log(roomId, userList);
};

queueService.onRecvCustomCommand = (userId, userName, content) => {
  console.log(userId, userName, content);
};

queueService.onStreamUpdated = (type, newStreamList) => {
  console.log(type, newStreamList);
};

queueService.onPlayQualityUpdate = (streamId, quality) => {
  console.log(streamId, quality);
};

queueService.onTempBroken = () => {
  console.log("临时掉线");
};

queueService.onReconnect = () => {
  console.log("重连成功");
};

queueService.onKickOut = (err) => {
  console.log("被踢下线通知");
};

queueService.onDisconnect = (err) => {
  console.log("服务掉线通知");
};