更新记录

0.0.2(2025-12-24)

  • chore: 更新文档

0.0.1(2025-12-24)

  • init

平台兼容性

uni-app(4.84)

Vue2 Vue3 Chrome Safari app-vue app-nvue Android iOS 鸿蒙
- - - - - -
微信小程序 支付宝小程序 抖音小程序 百度小程序 快手小程序 京东小程序 鸿蒙元服务 QQ小程序 飞书小程序 快应用-华为 快应用-联盟
- - - - - - - - - - -

uni-app x(4.84)

Chrome Safari Android iOS 鸿蒙 微信小程序
- - - - -

lime-speech 语音识别

语音识别插件,支持音频文件识别和实时录音识别。

文档

🚀 语音识别【站点1】 🌍 语音识别【站点2】 🔥 语音识别【站点3】

安装

插件市场导入,在页面引入,自定义基座

注意 本插件是付费,建议:
✅ 先试用后购买
✅ 试用测试满意后,慎重考虑后再购买

代码演示

识别音频文件

支持识别本地音频文件,仅支持pcm格式 filePath: 音频文件路径

import { useSpeech, type RecognizeFileOptions } from '@/uni_modules/lime-speech'

const speech = useSpeech()

speech.recognizeFile({
    filePath: '/storage/audio.pcm', // 音频文件路径
    success(res) {
        console.log('识别结果:', res.text)
    },
    fail(err) {
        console.log('识别失败:', err)
    },
    complete(res) {
        console.log('识别完成:', res)
    }
} as RecognizeFileOptions)

实时录音识别

通过设备麦克风进行实时语音识别

import { useSpeech, type StartRecognizeOptions } from '@/uni_modules/lime-speech'

const speech = useSpeech()

// 开始录音识别
speech.startRecognize()

// 监听识别结果
speech.onRecognize(res => {
    console.log('识别结果:', res.text)
})

// 监听错误
speech.onError(err => {
    console.log('识别错误:', err)
})

// 结束录音识别
setTimeout(() => {
    speech.stopRecognize()
}, 10000)

事件监听

import { useSpeech } from '@/uni_modules/lime-speech'

const speech = useSpeech()

// 监听开始事件
speech.onStart(() => {
    console.log('识别开始')
})

// 监听识别结果事件
speech.onRecognize(res => {
    console.log('识别结果:', res.text)
})

// 监听错误事件
speech.onError(err => {
    console.log('识别错误:', err)
})

// 监听结束事件
speech.onStop(res => {
    console.log('识别结束:', res.text)
})

// 取消监听
speech.offStart()
speech.offRecognize()
speech.offError()
speech.offStop()

注意事项

  1. 仅支持pcm格式的音频文件
  2. 实时录音识别需要获取麦克风权限
  3. 不同平台的实现可能存在差异
  4. 请确保设备有网络连接(部分平台需要在线识别)

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

暂无用户评论。