メインコンテンツまでスキップ
Version: v6

Speech Recognition

This plugin does speech recognition using cloud services

https://github.com/pbakondy/cordova-plugin-speechrecognition

Stuck on a Cordova issue?

Don't waste precious time on plugin issues.

If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic’s experts offer premium advisory services for both community plugins and premier plugins.

Installation

$ npm install cordova-plugin-speechrecognition 
$ npm install @awesome-cordova-plugins/speech-recognition
$ ionic cap sync

Supported Platforms

  • Android
  • iOS

Usage

React

Learn more about using Ionic Native components in React

Angular

import { SpeechRecognition } from '@awesome-cordova-plugins/speech-recognition/ngx';

constructor(private speechRecognition: SpeechRecognition) { }

...



// Check feature available
this.speechRecognition.isRecognitionAvailable()
.then((available: boolean) => console.log(available))

// Start the recognition process
this.speechRecognition.startListening(options)
.subscribe(
(matches: string[]) => console.log(matches),
(onerror) => console.log('error:', onerror)
)

// Stop the recognition process (iOS only)
this.speechRecognition.stopListening()

// Get the list of supported languages
this.speechRecognition.getSupportedLanguages()
.then(
(languages: string[]) => console.log(languages),
(error) => console.log(error)
)

// Check permission
this.speechRecognition.hasPermission()
.then((hasPermission: boolean) => console.log(hasPermission))

// Request permissions
this.speechRecognition.requestPermission()
.then(
() => console.log('Granted'),
() => console.log('Denied')
)