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

@ailabs-yating/asr-client-sdk-javascript

v1.0.4

Published

[![npm version](https://badge.fury.io/js/@ailabs-yating%2Fasr-client-sdk-javascript.svg)](https://badge.fury.io/js/@ailabs-yating%2Fasr-client-sdk-javascript)

Downloads

773

Readme

Yating ASR SDK - JavaScript

npm version

AILabs Yating ASR Javascript SDK - 幫助使用者在前端介接自動語音辨識

可參考文件

注意: 此SDK只適用於前端

使用方法

import { AILabsYatingASR } from "@ailabs-yating/asr-client-sdk-javascript"
import { getToken } from "./util"

const asr = new AILabsYatingASR(getToken)

asr.on("sentence", (event) => {
  console.log(`sentence: ${JSON.stringify(event)}`)
})

asr.on("sentenceFinal", (event) => {
  console.log(`final sentence: ${JSON.stringify(event)}`)
})

asr.setupAudioDevices()
  .then(devices => {
    return asr.connect(devices[0].deviceId)
  })
  .then(() => {
    console.log("asr connected!")
  })
  • getToken: 取得token的function, 因為asr服務需要換取token, 所以這邊可由使用者決定要如何取得token, function回傳Promise<string>即可
  • asr.setupAudioDevices()會回傳麥克風裝置列表, 開發者可取得device id至asr.connect()選擇所要使用的裝置
  • asr.connect()會要求麥克風權限, 並將收到的音訊傳至ASR
    • 若不傳入device id, 則會使用偵測到的第一個裝置
    • 若要選擇裝置, 請先呼叫asr.setupAudioDevices()取得裝置id