Skip to content

Commit 4b57f60

Browse files
authored
Merge pull request #60 from anweshan/master
Added webm to headerContentTypes [semver minor]
2 parents 586c18c + 2760217 commit 4b57f60

File tree

4 files changed

+26
-25
lines changed

4 files changed

+26
-25
lines changed

dist/watson-speech.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2896,27 +2896,27 @@ function forEach(xs, f) {
28962896
/* 6 */
28972897
/***/ (function(module, exports) {
28982898

2899-
var g;
2900-
2901-
// This works in non-strict mode
2902-
g = (function() {
2903-
return this;
2904-
})();
2905-
2906-
try {
2907-
// This works if eval is allowed (see CSP)
2908-
g = g || Function("return this")() || (1,eval)("this");
2909-
} catch(e) {
2910-
// This works if the window reference is available
2911-
if(typeof window === "object")
2912-
g = window;
2913-
}
2914-
2915-
// g can still be undefined, but nothing to do about it...
2916-
// We return undefined, instead of nothing here, so it's
2917-
// easier to handle this case. if(!global) { ...}
2918-
2919-
module.exports = g;
2899+
var g;
2900+
2901+
// This works in non-strict mode
2902+
g = (function() {
2903+
return this;
2904+
})();
2905+
2906+
try {
2907+
// This works if eval is allowed (see CSP)
2908+
g = g || Function("return this")() || (1,eval)("this");
2909+
} catch(e) {
2910+
// This works if the window reference is available
2911+
if(typeof window === "object")
2912+
g = window;
2913+
}
2914+
2915+
// g can still be undefined, but nothing to do about it...
2916+
// We return undefined, instead of nothing here, so it's
2917+
// easier to handle this case. if(!global) { ...}
2918+
2919+
module.exports = g;
29202920

29212921

29222922
/***/ }),
@@ -4480,7 +4480,7 @@ var QUERY_PARAMS_ALLOWED = ['customization_id', 'model', 'watson-token', 'X-Wats
44804480
* @param {String} [options.url='wss://stream.watsonplatform.net/speech-to-text/api'] base URL for service
44814481
* @param {String} [options.token] - Auth token
44824482
* @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)
4483-
* @param {String} [options.content-type='audio/wav'] - content type of audio; can be automatically determined from file header in most cases. only wav, flac, and ogg/opus are supported
4483+
* @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
44844484
* @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.
44854485
* @param {Boolean} [options.word_confidence=false] - include confidence scores with results. Defaults to true when in objectMode.
44864486
* @param {Boolean} [options.timestamps=false] - include timestamps with results. Defaults to true when in objectMode.

speech-to-text/content-type.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ var headerContentTypes = {
1212
fLaC: 'audio/flac',
1313
RIFF: 'audio/wav',
1414
OggS: 'audio/ogg',
15-
ID3: 'audio/mp3'
15+
ID3: 'audio/mp3',
16+
'\u001aEߣ': 'audio/webm' // String for first four hex's of webm: [1A][45][DF][A3] (https://www.matroska.org/technical/specs/index.html#EBML)
1617
};
1718

1819
/**

speech-to-text/file-player.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function getContentTypeFromFile(file) {
6666
if (ct) {
6767
resolve(ct);
6868
} else {
69-
var err = new Error('Unable to determine content type from file header; only wav, flac, and ogg/opus are supported.');
69+
var err = new Error('Unable to determine content type from file header. Supported file types: wav, mp3, flac, ogg, and webm.');
7070
err.name = FilePlayer.ERROR_UNSUPPORTED_FORMAT;
7171
reject(err);
7272
}

speech-to-text/recognize-stream.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ var QUERY_PARAMS_ALLOWED = ['customization_id', 'model', 'watson-token', 'X-Wats
5555
* @param {String} [options.url='wss://stream.watsonplatform.net/speech-to-text/api'] base URL for service
5656
* @param {String} [options.token] - Auth token
5757
* @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-
* @param {String} [options.content-type='audio/wav'] - content type of audio; can be automatically determined from file header in most cases. only wav, flac, and ogg/opus are supported
58+
* @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
5959
* @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.
6060
* @param {Boolean} [options.word_confidence=false] - include confidence scores with results. Defaults to true when in objectMode.
6161
* @param {Boolean} [options.timestamps=false] - include timestamps with results. Defaults to true when in objectMode.

0 commit comments

Comments
 (0)