Skip to content

Instantly share code, notes, and snippets.

@savelee
Created April 8, 2020 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save savelee/9283fd2abea90bae44d5dc2fce0bfe29 to your computer and use it in GitHub Desktop.
Save savelee/9283fd2abea90bae44d5dc2fce0bfe29 to your computer and use it in GitHub Desktop.
Client - Streaming to Dialogflow
// 1)
timeSlice: 4000,
// 2)
// as soon as the stream is available
ondataavailable: function(blob) {
// 3
// making use of socket.io-stream for bi-directional
// streaming, create a stream
var stream = ss.createStream();
// stream directly to server
// it will be temp. stored locally
ss(socket).emit('stream', stream, {
name: 'stream.wav',
size: blob.size
});
// pipe the audio blob to the read stream
ss.createBlobReadStream(blob).pipe(stream);
}
// 4 ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment