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 🙏

© 2024 – Pkg Stats / Ryan Hefner

ar-talk-sdk

v0.0.19

Published

JavaScript SDK for anyRTC Talk

Downloads

7

Readme

anyrtc Talk Web SDK 是一款实时语音通讯的库,通常用于指挥调度中的语音对讲以及日常通讯的一些对讲场景。

ArTalk 是 Talk SDK 的导出模块。

使用 <script> 标签引入 SDK 时,产生名为 ArTalk 的全局变量,该变量含有该模块的所有成员。

<script> 标签导入

<script src="https://unpkg.com/ar-talk-sdk"></script>

ES6 导入

import ArTalk from 'ar-talk-sdk'

CommonJs 导入

const ArTalk = require('ar-talk-sdk');

功能介绍

anyrtc Talk Web SDK 可以通过 ArTalk 全局对象创建对讲客户端(实例),客户端可以登录或者登出对讲系统, 同时客户端可以创建对讲频道(实例),对讲频道实例可以加入频道、退出频道、发起对讲、结束对讲、打断对讲等操作。

登录登出相关

方法

创建对讲实例

创建一个 ArTalkClient 实例。

const talkClient = ArTalk.createInstance('<YOUR_APPID>', {});

登录对讲系统

登录对讲系统。

await talkClient.login();

退出对讲系统

退出登录,退出后自动断开连接。

talkClient.logout();

事件回调

客户端与对讲服务的连接状态回调

用于通知 SDK 与 anyrtc RTM 系统的连接状态发生了改变。

talkClient.on("ConnectionStateChanged", (newState, reason) => {

});

加入离开频道相关

方法

创建频道

创建一个 ArTalkChannel 实例。

const talkChannel = talkClient.createChannel('<YOUR_CHANNEL_ID>');

加入频道

加入频道。加入频道成功后可收到该频道消息和频道用户进出通知。

await talkChannel.join();
// join channel success

离开频道

离开频道。不再接收频道消息和频道用户进出通知

talkChannel.leave();

事件回调

ArTalkChannel 的所有事件回调。

事件回调应该在加入频道join 之前监听。

用户上麦

用户上麦。

talkChannel.on("UserIsTalkOn", (channelId, userId, UserData) => {

});

用户下麦

用户下麦。

talkChannel.on("UserIsTalkOff", (channelId, userId, UserData) => {

});

广播开始

广播开始。当前有媒体广播正在直播。

talkChannel.on("UserIsStreamOn", (channelId, userId, UserData) => {

});

广播结束

广播结束。

talkChannel.on("UserIsStreamOff", (channelId, userId, UserData) => {

});

上麦被打断

上麦被打断。自己的对讲被等级高的人打断时。

talkChannel.on("BreakTalk", () => {

});

更新 Token

| 方法 | 描述 | | ------------------------------------------------------------ | ---------------- | | renewToken | 更新当前 Token。 |

| 事件 | 描述 | | ------------------------------------------------------------ | ---------------- | | TokenWillExpired | Token 即将过期回调。 | | TokenDidExpired | Token 已经过期回调。 |

日志设置与版本查询

| 变量 | 描述 | | ------------------------------------------------------------ | ------------------------------ | | logFilter | 设置 SDK 的日志输出等级。 | | VERSION | anyrtc RTM SDK 的当前版本信息。 |

##定制方法

| 方法 | 描述 | | ------------------------------------------------------------ | ------------------------------------- | | setParameters | 配置 SDK 提供技术预览或特别定制功能。 |