watson-html5-speech-recognition
Advanced tools
Comparing version 0.6.4 to 0.6.5
@@ -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(); |
@@ -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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 6 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
125
0
1
26562
8
307