1.0.1 • Published 1 year ago

chrome-speech-recognition v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

chromeSpeechRecognition

Access chrome SpeechRecognition with puppeteer in headless mode

NOTE: You will need to put chrome in the source directory

Install

$ npm i chrome-speech-recognition

Import

import chromeSpeechRecognition from "chromeSpeechRecognition";
//or
const chromeSpeechRecognition = require("chromeSpeechRecognition").default;

Example

function callback(text) {
  console.log("The user said: ", text);
}

const chromePath = path.resolve(__dirname, "../chrome/chrome.exe");

const speechRecognitionOptions = {
  lang: "en",
};

const browser = await chromeSpeechRecognition(
  callback,
  chromePath,
  speechRecognitionOptions
);

//when you want to stop listening
setTimeout(() => browser.close(), 10000);