Replies: 3 comments 1 reply
-
import "react-native-url-polyfill/auto"; export class TranscribeController { async init() { async start() {
} stop() { async* audioGenerator() { |
Beta Was this translation helpful? Give feedback.
-
Has anyone had luck with this in React Native? My code is almost identical to @mukashow but I keep getting a TypeError that the object is not async iterable. The
But when I dig into the |
Beta Was this translation helpful? Give feedback.
-
Hi, Hermes doesn't support async iterators yet (the feature is planned, but no release date yet), so for await is unsupported and produces the corresponding error message when encountered. As you know, in RN apps JS code undergoes Babel transformations which should eliminate instances of for await. - Please disable Hermes on iOS & android. It works fine!!!. |
Beta Was this translation helpful? Give feedback.
-
Hello
I have been trying to use @aws-sdk/client-transcribe-streaming in react native, but it's still not working.
It gives the error below:
TypeError: Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a Symbol.iterator method.
_createForOfIteratorHelperLoose@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.easybot&modulesOnly=false&runModule=true:101839:413
handleResult$@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.easybot&modulesOnly=false&runModule=true:102022:75
tryCatch@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.easybot&modulesOnly=false&runModule=true:7739:23
...
My code is as follows:
...
import 'react-native-get-random-values';
import 'react-native-url-polyfill/auto';
import { TranscribeStreamingClient, StartStreamTranscriptionCommand, MediaEncoding } from "@aws-sdk/client-transcribe-streaming";
...
const transStreamingClient = new TranscribeStreamingClient({
...
})
const _audioStreamFunc = async function*() {
try {
while (true)
{
const data = await getAudioDataPromise;
// console.log('got data', data);
if (!data) break;
yield data;
}
} finally {
}
}
const audioStreamFunc = function() {
return {
[Symbol.asyncIterator]: _audioStreamFunc
}
}
...
this.audioStream = audioStreamFunc();
}
...
Could anyone help me to make this work?
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions