@@ -364,11 +364,20 @@ Speech.formatResults_ = function(resultSets, verboseMode) {
364364 * property, a `confidence` score from `0` - `100`, and an `alternatives`
365365 * array consisting of other transcription possibilities.
366366 *
367+ * Google Cloud Speech sets the limits for the audio duration. For more
368+ * information, see
369+ * [Content Limits]{@link https://cloud.google.com/speech/limits#content}.
370+ *
367371 * @resource [StreamingRecognize API Reference]{@link https://cloud.google.com/speech/reference/rpc/google.cloud.speech.v1beta1#google.cloud.speech.v1beta1.Speech.StreamingRecognize}
368372 * @resource [StreamingRecognizeRequest API Reference]{@link https://cloud.google.com/speech/reference/rpc/google.cloud.speech.v1beta1#google.cloud.speech.v1beta1.StreamingRecognizeRequest}
373+ * @resource [Content Limits]{@link https://cloud.google.com/speech/limits#content}
369374 *
370375 * @param {object } config - A `StreamingRecognitionConfig` object. See
371376 * [`StreamingRecognitionConfig`](https://cloud.google.com/speech/reference/rpc/google.cloud.speech.v1beta1#google.cloud.speech.v1beta1.StreamingRecognitionConfig).
377+ * @param {number= } config.timeout - In seconds, the amount of time before the
378+ * underlying API request times out. The default value, `190`, is sufficient
379+ * for audio input of 60 seconds or less. If your input is longer, consider
380+ * using a higher timeout value.
372381 * @param {boolean= } config.verbose - Enable verbose mode for a more detailed
373382 * response. See the examples below. Default: `false`.
374383 *
@@ -469,10 +478,17 @@ Speech.prototype.createRecognizeStream = function(config) {
469478 var verboseMode = config . verbose === true ;
470479 delete config . verbose ;
471480
481+ var gaxOptions = { } ;
482+
483+ if ( is . number ( config . timeout ) ) {
484+ gaxOptions . timeout = config . timeout * 1000 ;
485+ delete config . timeout ;
486+ }
487+
472488 var recognizeStream = streamEvents ( pumpify . obj ( ) ) ;
473489
474490 recognizeStream . once ( 'writing' , function ( ) {
475- var requestStream = self . api . Speech . streamingRecognize ( ) ;
491+ var requestStream = self . api . Speech . streamingRecognize ( gaxOptions ) ;
476492
477493 requestStream . on ( 'response' , function ( response ) {
478494 recognizeStream . emit ( 'response' , response ) ;
0 commit comments