{"versions":{"1.0.0":{"name":"@muguilin/xf-voice-dictation","version":"1.0.0","description":"讯飞语音听写 WebAPI","main":"main.umd.js","module":"main.mjs","typings":"main.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/MuGuiLin"},"keywords":["语音听写","语音识别","迅飞语音"],"author":{"name":"沐枫（MuGuiLin）","email":"muguilin@foxmail.com","url":"http://wwww.muguilin.com"},"homepage":"https://github.com/MuGuiLin","bugs":{"email":"muguilin@foxmail.com"},"license":"MIT","_id":"@muguilin/xf-voice-dictation@1.0.0","gitHead":"974c38e6ac31fc8a03c6da34fb33239829689622","_nodeVersion":"18.12.0","_npmVersion":"9.8.1","dist":{"integrity":"sha512-sDYO1UtbEWxW5Nq6p9mnnXiKpfnt2gDz9nL+yGYP4qqJzLYmbs1B0Z7PM2t+J00zTsK7MNVkz8jJUxVHuoTPrw==","shasum":"9d7f810c00b913222a01627551b0ccd199dc90f0","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/@muguilin/xf-voice-dictation/-/xf-voice-dictation-1.0.0.tgz","fileCount":6,"unpackedSize":260122,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD2HF7LCBnLoMPIxduE8SugolQTPXal7rTDH0vrtQVqnwIhALC4jJb8bUyQuAMfwZ3hDlTzM0w9aHygPJZIk1ok3j+C"}],"size":72089},"_npmUser":{"name":"anonymous","email":"muguilin@foxmail.com"},"directories":{},"maintainers":[{"name":"anonymous","email":"muguilin@foxmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/xf-voice-dictation_1.0.0_1712332718270_0.8874847751411012"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-04-05T15:58:38.468Z","publish_time":1712332718468,"_source_registry_name":"default","contributors":[]},"1.0.1":{"name":"@muguilin/xf-voice-dictation","version":"1.0.1","description":"讯飞语音听写 WebAPI","main":"main.umd.js","module":"main.mjs","typings":"main.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/MuGuiLin"},"keywords":["语音听写","语音识别","迅飞语音"],"author":{"name":"沐枫（MuGuiLin）","email":"muguilin@foxmail.com","url":"http://wwww.muguilin.com"},"homepage":"https://github.com/MuGuiLin","bugs":{"email":"muguilin@foxmail.com"},"license":"MIT","gitHead":"acc64b6ff7149b8d7ca71b59ee8b6134b1e93402","_id":"@muguilin/xf-voice-dictation@1.0.1","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-mkiTpjSbwJHnnLv4Gi6lBlcINLJRMZ50M7y3in8cJ4LIIHjGk4bu1K2EsmzLTE2+hWCbULzT/9T+D4yu4JuAFQ==","shasum":"e131d0f2b35c8aab30f73007e38c15454e322174","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/@muguilin/xf-voice-dictation/-/xf-voice-dictation-1.0.1.tgz","fileCount":6,"unpackedSize":260981,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICriTlrswhd1NbbdjiNpsSd6xSBcfc4dDtIxgm+M2GCkAiBCeekNcaXFWuCzes7renw78tRG4bOiweQvsuYeSrTqAQ=="}],"size":72484},"_npmUser":{"name":"anonymous","email":"muguilin@foxmail.com"},"directories":{},"maintainers":[{"name":"anonymous","email":"muguilin@foxmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/xf-voice-dictation_1.0.1_1712508171397_0.8058620614967829"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-04-07T16:42:51.536Z","publish_time":1712508171536,"_source_registry_name":"default","contributors":[]}},"dist-tags":{"latest":"1.0.1"},"name":"@muguilin/xf-voice-dictation","time":{"created":"2024-04-05T22:26:26.261Z","modified":"2024-04-07T17:22:45.813Z","1.0.0":"2024-04-05T15:58:38.468Z","1.0.1":"2024-04-07T16:42:51.536Z"},"readme":"# @muguilin/xf-voice-dictation\r\n\r\n[![MIT License](https://img.shields.io/npm/l/utilsjs.svg?style=flat-square)](https://www.npmjs.com/package/mu-tooljs)\r\n\r\n> 基于 讯飞语音听写流式接口 进行二次封装，用于在 1 分钟内的即时语音转文字技术，支持实时返回识别结果，达到一边上传音频一边获得识别文本的效果。\r\n>\r\n> 该语音能力是通过 Websocket API 的方式给开发者提供一个通用的接口。Websocket API 具备流式传输能力，适用于需要流式数据传输的 AI 服务场景，比如边说话边识别。相较于 SDK，API 具有轻量、跨语言的特点；相较于 HTTP API，Websocket API 协议有原生支持跨域的优势。\r\n\r\n#### 🏡 下载安装：\r\n\r\n```shell\r\n# 使用npm命令下载安装\r\n$ npm i @muguilin/xf-voice-dictation\r\n\r\n# 使用yarn命令下载安装\r\n$ yarn add @muguilin/xf-voice-dictation\r\n```\r\n\r\n#### 🔍 实例效果：\r\n\r\n[语音听写 DEMO（流式版）WebAPI (muguilin.github.io)](https://muguilin.github.io/VoiceDictation/)\r\n\r\n[讯飞语音听写（流式版）WebAPI 文档 | (xfyun.cn)](https://www.xfyun.cn/doc/asr/voicedictation/API.html)\r\n\r\n#### 🚀 使用方法：\r\n\r\n> 【关于：】服务接口认证信息这 3 个参数据：APPID、APISecret、APIKey，请到官网申请（https://www.xfyun.cn/services/voicedictation）\r\n>\r\n> 【注意：】APISecret 和 APIKey 的长度都差不多很相似，所以要填错哦！\r\n\r\n```javascript\r\nimport { XfVoiceDictation } from '@muguilin/xf-voice-dictation';\r\n\r\nlet times = null;\r\nconst xfVoice = new XfVoiceDictation({\r\n    APPID: 'xxx',\r\n    APISecret: 'xxx',\r\n    APIKey: 'xxx',\r\n\r\n    // webSocket请求地址 非必传参数，默认为：wss://iat-api.xfyun.cn/v2/iat\r\n    // url: '',\r\n\r\n    // 监听录音状态变化回调\r\n    onWillStatusChange: function (oldStatus, newStatus) {\r\n        // 可以在这里进行页面中一些交互逻辑处理：注：倒计时（语音听写只有60s）,录音的动画，按钮交互等！\r\n        console.log('识别状态：', oldStatus, newStatus);\r\n    },\r\n\r\n    // 监听识别结果的变化回调\r\n    onTextChange: function (text) {\r\n        // 可以在这里进行页面中一些交互逻辑处理：如将文本显示在页面中\r\n        console.log('识别内容：',text)\r\n\r\n        // 如果3秒钟内没有说话，就自动关闭（60s后也会自动关闭）\r\n        if (text) {\r\n            clearTimeout(times);\r\n            times = setTimeout(() => {\r\n                this.stop();\r\n            }, 3000);\r\n        };\r\n    },\r\n\r\n    // 监听识别错误回调\r\n    onError: function(error){\r\n        console.log('错误信息：', error)\r\n    }\r\n});\r\n\r\n\r\n// 给Dom元素加添事件，来调用开始语音识别！\r\n// xfVoice.start();\r\n\r\n\r\n// 给Dom元素加添事件，来调用关闭语音识别！\r\n// xfVoice.stop();\r\n\r\n```","users":{}}