title: NodeJs Google Speech API Followed Streaming recognition
body: <p>I am working on a project that will need to use streaming recognition. I want to make it work with NodeJs, like <a href="https://cloud.google.com/speech/docs/streaming-recognize#speech-streaming-mic-recognize-nodejs" rel="nofollow noreferrer">here</a>. It works fine but as the documentation says, it stops after roughtly 60 seconds.</p>
  
  <p>What I want is to restart the recording and the recognition right after this error happens, as my text might take more than one min.</p>
  
  <p>I tried to close the record when I receive an error in my recognition:</p>
  
  <pre><code>const record = require('node-record-lpcm16');
  const unirest = require('unirest');
  
  const speech = require('@google-cloud/speech');
  
  const client = new speech.SpeechClient();
  const request = {
      config: {
          encoding: encoding,
          sampleRateHertz: sampleRateHertz,
          languageCode: languageCode
      },
      interimResults: false
  };
  const recognizeStream = client
      .streamingRecognize(request)
      .on('error', error =&gt; {
          console.log("Timeout...");
          console.error(error);
          console.log("Closing record");
          return record.stop();
      })
      .on('data', (data) =&gt; {
          //Process data
      });
  </code></pre>
  
  <p>And restarting the recording when it is ended:</p>
  
  <pre><code>record
      .start({
          sampleRateHertz: sampleRateHertz,
          threshold: 0,
          verbose: false,
          recordProgram: 'rec',
          silence: '1.0'
      })
      .on('error', console.error)
      .on('end', data =&gt; {
          record.start({
          sampleRateHertz: sampleRateHertz,
          threshold: 0,
          verbose: false,
          recordProgram: 'rec',
          silence: '1.0'
      }).pipe(recognizeStream);
      })
      .pipe(recognizeStream);
  </code></pre>
  
  <p>As a noobie in NodeJs it is the only solution I thought of but it doesn't work. The recording starts again correctly but the recognition doesn't as it doesn't transcript anything after it has been closed.</p>
  
  <p>Any idea on how to perform a recognition for more than one minute with streaming recognition? I'd like something similar to what can be done in Python <a href="https://github.com/GoogleCloudPlatform/python-docs-samples/blob/speech-continuous/speech/cloud-client/transcribe_streaming_indefinite.py" rel="nofollow noreferrer">here</a></p>