We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c71a8ba commit 6d52bcdCopy full SHA for 6d52bcd
src/components/ServiceContainer/ServiceContainer.js
@@ -24,16 +24,17 @@ export const ServiceContainer = () => {
24
setError(createError(TOKEN_ERROR_TITLE, authJson));
25
}
26
27
- try {
28
- synthesize({
29
- accessToken: authJson.accessToken,
30
- element: audioElementRef.current,
31
- text,
32
- voice: voice.id,
33
- });
34
- } catch (error) {
35
- setError(createError(SYNTHESIZE_ERROR_TITLE, error));
36
- }
+ const audio = await synthesize({
+ accessToken: authJson.accessToken,
+ autoPlay: false,
+ element: audioElementRef.current,
+ text,
+ voice: voice.id,
+ });
+ audio.play().catch(error => {
+ console.log('ERROR', error);
+ setError(createError(SYNTHESIZE_ERROR_TITLE, error.message));
37
38
};
39
40
return (
0 commit comments