搜索插件、代码仓与 APP 分类

插件详情v2.0.1

flutter_speech

支持 Android、iOS 和 Mac OSX 上语音识别的 Flutter 插件

AndroidiOSmacOS
近 30 天下载
197
喜欢数
55
Pub 分数
140

安装插件

flutter pub add flutter_speech

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

Flutter Speech 是一个跨平台插件,可在 Android、iOS 和 macOS 上实现语音识别(语音转文本)。它提供了一个简单的接口,用于访问设备原生的语音识别 API,使开发者能够将其集成到 Flutter 应用程序中。该插件支持实时转录,适用于语音助手、语音输入工具和免提交互。它利用各平台特定的实现以获得最佳性能和准确性。该包由 jaumard.com 维护,并可通过 pub.dev 获取。

适合场景

  • 语音控制的应用程序
  • 语音输入功能
  • 免提导航
  • 无障碍工具
  • 交互式语音接口

主要特点

  • 跨平台支持(Android、iOS、macOS)
  • 实时语音识别
  • 简单 API 集成
  • 平台原生精度
  • 开源,带有 GitHub 仓库

适合对象

  • 开发语音功能应用的开发者
  • 注重可访问性的应用程序
  • 原型设计语音助手
  • 需要免提输入的应用程序

使用建议

  • 在 Android 和 iOS 上需要运行时权限
  • 根据平台,离线功能有限
  • 依赖于设备级别的语音服务
  • 可能需要用户同意才能访问麦克风
  • 性能因设备和操作系统版本而异

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

flutter_speech_recognition

Based on rxlabz plugin

Objective C and Java Flutter plugin.

A flutter plugin to use the speech recognition iOS10+ / Android 4.1+ and MacOS 10.15+

Setup:

iOS and MacOS

Add this on your Info.plist

<key>NSMicrophoneUsageDescription</key>
<string>This application needs to access your microphone</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>This application needs the speech recognition permission</string>
Android

Nothing to do :)

Usage:

//..
_speech = SpeechRecognition();

// The flutter app not only call methods on the host platform,
// it also needs to receive method calls from host.
_speech.setAvailabilityHandler((bool result) 
  => setState(() => _speechRecognitionAvailable = result));

// handle device current locale detection
_speech.setCurrentLocaleHandler((String locale) =>
 setState(() => _currentLocale = locale));

_speech.setRecognitionStartedHandler(() 
  => setState(() => _isListening = true));

// this handler will be called during recognition. 
// the iOS API sends intermediate results,
// On my Android device, only the final transcription is received
_speech.setRecognitionResultHandler((String text) 
  => setState(() => transcription = text));

_speech.setRecognitionCompleteHandler(() 
  => setState(() => _isListening = false));

// 1st launch : speech recognition permission / initialization
_speech
    .activate()
    .then((res) => setState(() => _speechRecognitionAvailable = res));
//..

speech.listen(locale:_currentLocale).then((result)=> print('result : $result'));

// ...

speech.cancel();

// ||

speech.stop();

所属分类

源码仓库

使用此插件的项目

暂无相关数据。