Created
April 8, 2020 11:34
-
-
Save savelee/9283fd2abea90bae44d5dc2fce0bfe29 to your computer and use it in GitHub Desktop.
Client - Streaming to Dialogflow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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