Skip to content

Commit 33048ee

Browse files
committed
feat: streaming added to s2t emo screen
1 parent 271e6bb commit 33048ee

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

examples/speech-to-text/screens/SpeechToTextScreen.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,18 @@ export const SpeechToTextScreen = () => {
7878
const onChunk = (data: string) => {
7979
const float32Chunk = float32ArrayFromPCMBinaryBuffer(data);
8080
audioBuffer.current?.push(...float32Chunk);
81-
streamingTranscribe(audioBuffer.current, STREAMING_ACTION.DATA);
81+
streamingTranscribe(float32Chunk, STREAMING_ACTION.DATA);
8282
};
8383

8484
const handleRecordPress = async () => {
8585
if (isRecording) {
8686
LiveAudioStream.stop();
8787
setIsRecording(false);
88-
await streamingTranscribe(audioBuffer.current, STREAMING_ACTION.STOP);
88+
await streamingTranscribe([], STREAMING_ACTION.STOP);
8989
audioBuffer.current = [];
9090
} else {
9191
setIsRecording(true);
92-
streamingTranscribe(audioBuffer.current, STREAMING_ACTION.START);
92+
streamingTranscribe([], STREAMING_ACTION.START);
9393
startStreamingAudio(audioStreamOptions, onChunk);
9494
}
9595
};
@@ -184,7 +184,7 @@ export const SpeechToTextScreen = () => {
184184
]}
185185
>
186186
<TouchableOpacity
187-
disabled={recordingButtonDisabled || isGenerating}
187+
disabled={recordingButtonDisabled}
188188
style={[
189189
styles.recordingButton,
190190
recordingButtonDisabled && styles.backgroundGrey,

src/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@ export * from './types/image_segmentation';
3434

3535
// constants
3636
export * from './constants/modelUrls';
37+
export { STREAMING_ACTION } from './constants/sttDefaults';

0 commit comments

Comments
 (0)