You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,9 +58,11 @@ See a more advanced example at https://speech-to-text-demo.mybluemix.net/
58
58
All API methods require an auth token that must be [generated server-side](https://github.com/watson-developer-cloud/node-sdk#authorization).
59
59
(See https://github.com/watson-developer-cloud/speech-javascript-sdk/tree/master/examples/ for a couple of basic examples in Node.js and Python.)
60
60
61
+
_NOTE_: The `token` parameter only works for CF instances of services. For RC services using IAM for authentication, the `access_token` parameter must be used.
Speaks the supplied text through an automatically-created `<audio>` element.
66
68
Currently limited to text that can fit within a GET URL (this is particularly an issue on [Internet Explorer before Windows 10](http://stackoverflow.com/questions/32267442/url-length-limitation-of-microsoft-edge)
@@ -80,7 +82,7 @@ The `recognizeMicrophone()` and `recognizeFile()` helper methods are recommended
80
82
81
83
The core of the library is the [RecognizeStream] that performs the actual transcription, and a collection of other Node.js-style streams that manipulate the data in various ways. For less common use-cases, the core components may be used directly with the helper methods serving as optional templates to follow. The full library is documented at http://watson-developer-cloud.github.io/speech-javascript-sdk/master/module-watson-speech_speech-to-text.html
Can recognize and optionally attempt to play a URL, [File](https://developer.mozilla.org/en-US/docs/Web/API/File) or [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
102
104
(such as from an `<input type="file"/>` or from an ajax request.)
Copy file name to clipboardExpand all lines: speech-to-text/recognize-file.js
+4-3Lines changed: 4 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,8 @@ var fetch = require('nodeify-fetch'); // like regular fetch, but with an extra m
36
36
* (e.g. from a file <input>, a dragdrop target, or an ajax request)
37
37
*
38
38
* @param {Object} options - Also passed to {MediaElementAudioStream} and to {RecognizeStream}
39
-
* @param {String} options.token - Auth Token - see https://github.com/watson-developer-cloud/node-sdk#authorization
39
+
* @param {String} options.token - Auth Token for CF services - see https://github.com/watson-developer-cloud/node-sdk#authorization
40
+
* @param {String} options.access_token - IAM Access Token for RC services - see https://github.com/watson-developer-cloud/node-sdk#authorization
40
41
* @param {Blob|FileString} options.file - String url or the raw audio data as a Blob or File instance to be transcribed (and optionally played). Playback may not with with Blob or File on mobile Safari.
41
42
* @param {Boolean} [options.play=false] - If a file is set, play it locally as it's being uploaded
42
43
* @param {Boolena} [options.format=true] - pipe the text through a {FormatStream} which performs light formatting. Also controls smart_formatting option unless explicitly set.
@@ -49,8 +50,8 @@ var fetch = require('nodeify-fetch'); // like regular fetch, but with an extra m
Copy file name to clipboardExpand all lines: speech-to-text/recognize-microphone.js
+4-3Lines changed: 4 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,8 @@ var bitBucket = new Writable({
44
44
* Create and return a RecognizeStream sourcing audio from the user's microphone
45
45
*
46
46
* @param {Object} options - Also passed to {RecognizeStream}, and {FormatStream} when applicable
47
-
* @param {String} options.token - Auth Token - see https://github.com/watson-developer-cloud/node-sdk#authorization
47
+
* @param {String} options.token - Auth Token for CF services - see https://github.com/watson-developer-cloud/node-sdk#authorization
48
+
* @param {String} options.access_token - IAM Access Token for RC services - see https://github.com/watson-developer-cloud/node-sdk#authorization
48
49
* @param {Boolean} [options.format=true] - pipe the text through a FormatStream which performs light formatting. Also controls smart_formatting option unless explicitly set.
49
50
* @param {Boolean} [options.keepMicrophone=false] - keeps an internal reference to the microphone stream to reuse in subsequent calls (prevents multiple permissions dialogs in firefox)
50
51
* @param {String|DOMElement} [options.outputElement] pipe the text to a [WriteableElementStream](WritableElementStream.html) targeting the specified element. Also defaults objectMode to true to enable interim results.
* @param {String} [options.model='en-US_BroadbandModel'] - voice model to use. Microphone streaming only supports broadband models.
55
55
* @param {String} [options.url='wss://stream.watsonplatform.net/speech-to-text/api'] base URL for service
56
-
* @param {String} [options.token] - Auth token
56
+
* @param {String} [options.token] - Auth token for CF services
57
+
* @param {String} options.access_token - IAM Access Token for RC services
57
58
* @param {Object} [options.headers] - Only works in Node.js, not in browsers. Allows for custom headers to be set, including an Authorization header (preventing the need for auth tokens)
58
59
* @param {String} [options.content-type='audio/wav'] - content type of audio; can be automatically determined from file header in most cases. only wav, flac, ogg/opus, and webm are supported
59
60
* @param {Boolean} [options.interim_results=true] - Send back non-final previews of each "sentence" as it is being processed. These results are ignored in text mode.
Copy file name to clipboardExpand all lines: util/querystring.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@
13
13
exports.stringify=functionstringify(queryParams){
14
14
returnObject.keys(queryParams)
15
15
.map(function(key){
16
-
returnkey+'='+(key==='watson-token' ? queryParams[key] : encodeURIComponent(queryParams[key]));// the server chokes if the token is correctly url-encoded
16
+
returnkey+'='+(key==='watson-token'||key==='access_token'? queryParams[key] : encodeURIComponent(queryParams[key]));// the server chokes if the token is correctly url-encoded
0 commit comments