Skip to content

Commit cda9db5

Browse files
authored
fix: Added check to see if stream has been destroyed before writing result… (#107)
1 parent eee3583 commit cda9db5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

media-translation/translate_from_mic.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ function main(encoding, sampleRateHertz, sourceLanguage, targetLanguage) {
140140
streamingConfig: config,
141141
audioContent: chunk.toString('base64'),
142142
};
143-
stream.write(request);
143+
if (!stream.destroyed) {
144+
stream.write(request);
145+
}
144146
})
145147
.on('close', () => {
146148
doTranslationLoop();

0 commit comments

Comments
 (0)