Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Basic implementating to help altering between ongoing SpeechRecognition and intermittant SpeechSynthesis
Source: https://github.com/janmarques/discussion
Package: https://www.npmjs.com/package/discussion
When working with SpeechRecognition and SpeechSynthesis, it is important that you don't synthesise while you are recognizing.
This package helps keep this in check.
It will continually be SpeechRecognizing and passing those results to the onRecognitionResult
callback.
But whenever you want to Synthesise something, you can do this using the synthesize
method. The Recognition gets disabled and after the synthesis is done, it gets restarted.
Install with npm i discussion
We need to have a bit of hacky stuff to ensure that in the recognition callback, we can access all the properties and the DOM from your own class.
That is why we pass a factory method to create the SpeechRecognition rather than have the package do it itself.
Example:
// in the header somewhere
public CT = window.SpeechRecognition || webkitSpeechRecognition;
// in the constructor
this.discussion = new Discussion(() => new this.CT(), this.language.code, this.language.code);
this.discussion.onRecognitionResult = (x) => {
// do something with result
};
// in the initializer (eg ngOnInit or whenever your page is loaded)
this.discussion.initialize();
// after user consent, enable the Recognition
this.discussion.enableRecognition();
// anywhere in your code
this.discussion.synthesize("hello world");
FAQs
Basic implementating to help altering between ongoing SpeechRecognition and intermittant SpeechSynthesis
The npm package discussion receives a total of 1 weekly downloads. As such, discussion popularity was classified as not popular.
We found that discussion demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.