JSPM

@blrrt/cordova-plugin-speech-recognition-ios-browser-polyfill

1.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q49275F
  • License Unlicense

Cordova iOS polyfill for the Speech Recognition API

Package Exports

  • @blrrt/cordova-plugin-speech-recognition-ios-browser-polyfill

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@blrrt/cordova-plugin-speech-recognition-ios-browser-polyfill) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

cordova-speech-recognition-ios-browser-polyfill

Installation

npm i --save-dev cordova-plugin-speech-recognition-ios
npm i --save cordova-speech-recognition-ios-browser-polyfill

Usage

import SpeechRecognition as SpeechRecognitionIosPolyfill from 'cordova-speech-recognition-ios-browser-polyfill';

if (!global.SpeechRecognition) {
  if (global.cordova && global.cordova.platformId === 'ios') {
    global.SpeechRecognition = SpeechRecognitionIosPolyfill;
  }
}

Note

The browser API returns partial speech segments comprised of alternatives. However, the iOS API returns full speech alternatives comprised of partial segments. Fortunately, each iOS alternative appears to contain an identical number of segments. Therefore, we can easily convert from the iOS format to the browser's format. If this behavior ever changes then this will no longer be possible, or at least... it will be harder.