Socket
Socket
Sign inDemoInstall

watson-html5-speech-recognition

Package Overview
Dependencies
50
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.6.4 to 0.6.5

5

dist/adaptors/watson.speech.to.text.adaptor.js

@@ -24,5 +24,6 @@ 'use strict';

var WatsonSpeechToTextAdaptor = exports.WatsonSpeechToTextAdaptor = function () {
function WatsonSpeechToTextAdaptor() {
function WatsonSpeechToTextAdaptor(conf) {
_classCallCheck(this, WatsonSpeechToTextAdaptor);
this.tokenUrl = conf.watsonTokenUrl || '/api/speech-to-text/token';
this.mic = mic;

@@ -102,3 +103,3 @@ }

value: function _requestToken() {
return (0, _isomorphicFetch2.default)('/api/speech-to-text/token').then(function (response) {
return (0, _isomorphicFetch2.default)(this.tokenUrl).then(function (response) {
console.log('got response');

@@ -105,0 +106,0 @@ return response.text();

4

dist/index.js

@@ -19,7 +19,7 @@ 'use strict';

var SpeechToText = exports.SpeechToText = function () {
function SpeechToText() {
function SpeechToText(conf) {
_classCallCheck(this, SpeechToText);
this.webkitSpeechAdaptor = new _webkitSpeechToText.WebKitSpeechToTextAdaptor();
this.watsonSpeechAdaptor = new _watsonSpeechToText.WatsonSpeechToTextAdaptor();
this.watsonSpeechAdaptor = new _watsonSpeechToText.WatsonSpeechToTextAdaptor(conf);
}

@@ -26,0 +26,0 @@

{
"name": "watson-html5-speech-recognition",
"version": "0.6.4",
"version": "0.6.5",
"description": "Watson HTML5 Speech to Text",
"main": "./dist/index.js",
"main": "dist/index.js",
"scripts": {

@@ -29,3 +29,3 @@ "compile": "rm -rf ./dist && ./node_modules/.bin/babel ./lib -d ./dist",

"devDependencies": {
"babel-cli": "^6.0.0",
"babel-cli": "^6.9.0",
"babel-preset-es2015": "^6.6.0",

@@ -32,0 +32,0 @@ "babel-preset-stage-0": "^6.5.0",

@@ -20,3 +20,3 @@ # watson-html5-speech-recognition

- Chrome
- Safari
- Opera

@@ -41,2 +41,5 @@ - Watson Speech to Text

```javascript
var Speech = require('watson-html5-speech-recognition');
var speech = new Speech.SpeechToText();
speech.listen({

@@ -58,2 +61,16 @@ onStart: function() {

## Customized Usage
If Watson speech services are engaged, the watson-html5-speech-recognition request a token from the server then communicates via websocket.
By default, watson-html5-speech-recognition assumes the token endpoint exists at `/api/speech-to-text/token`. If you alter the location of that endpoint, you must supply the new location via a configuration parameter upon instantiation. Like so...
```javascript
var Speech = require('watson-html5-speech-recognition');
var speech = new Speech.SpeechToText({
watsonTokenUrl: `/path/to/my/speech-to-text/token`
});
```
**NOTE:** The example server uses the `watson-developer-cloud` npm package to configure the token endpoint (see `example/server/stt-token.js`).
## Example

@@ -72,3 +89,3 @@ The example contains a simple web front end, along with a backend web socket server that communicates with the Watson Speech To Text service

```shell
cd examples
cd example/server
```

@@ -90,2 +107,6 @@

First, be sure to complete all steps in the section above, "Setup the example"
Then,
Open `stt-token.js` to line 10

@@ -92,0 +113,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc