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-polyfillUsage
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.