Skip to content

Frequent invocation of the speakTextAsync method in JavaScript causes HTML page freezing #2981

@FEI-888

Description

@FEI-888

Describe the bug
Frequent calls to the speakTextAsync method cause the HTML page to freeze completely. The page loses responsiveness and cannot perform any interactive operations until the browser tab is refreshed or restarted.
To Reproduce
Steps to reproduce the behavior:
Scenario 1: Send approximately 5 concurrent speakTextAsync requests, then repeat this operation for several rounds. The HTML page will freeze.
Scenario 2: Send one speakTextAsync request at a time, and immediately initiate a new speakTextAsync request as soon as the previous request ends. After repeating this about 10 times continuously, the HTML page will freeze.
Expected behavior
The HTML page should remain responsive even when speakTextAsync is called frequently (either concurrently or in rapid succession). The speech synthesis requests should execute normally without causing page freezes or loss of interactivity.
Version of the Cognitive Services Speech SDK
^1.38.0
Platform, Operating System, and Programming Language
OS: Windows (specific version not specified)
Hardware: x86
Programming language: JavaScript
Browser: Chrome 143.0.7499.147
Additional context
Source code to reproduce the issue
vue


<button @click="load">textToSpeech

<script> import * as sdk from 'microsoft-cognitiveservices-speech-sdk'; import { MICROSOFT_TEXT_TO_SPEECH } from '@shared/constants/ai'; const speechConfig = sdk.SpeechConfig.fromSubscription( MICROSOFT_TEXT_TO_SPEECH.KEY, MICROSOFT_TEXT_TO_SPEECH.REGION ); speechConfig.speechRecognitionLanguage = MICROSOFT_TEXT_TO_SPEECH.LANGUAGE; export default { data() { return {}; }, methods: { load() { const synthesizer = new sdk.SpeechSynthesizer(speechConfig, null); synthesizer.speakTextAsync( '特别的是,文本文件是指以ASCII码方式(也称文本方式)存储的文件', () => { synthesizer.close(); }, () => { synthesizer.close(); } ); } } }; </script> <style lang="scss" scoped></style>

Metadata

Metadata

Assignees

Labels

text-to-speechText-to-Speechupdate neededFor items that are in progress but have not been updated

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions