Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

voice is duplicated on web #537

Open
1 task
Ammarmahmoud1995 opened this issue Oct 15, 2024 · 0 comments
Open
1 task

voice is duplicated on web #537

Ammarmahmoud1995 opened this issue Oct 15, 2024 · 0 comments
Assignees

Comments

@Ammarmahmoud1995
Copy link

🐛 Bug Report

I have this flutter code that I use to call tts to speak a String , The problem is that on web and if the site is loaded for the first time , It would restart the voice automatically immediately after the first time , so I have to hear it 2 times ! (it works perfectly in iOS , android)

  Future speak({required String textToSpeak}) async {
   // 
        homecontroller. isTTSspeaking = true ;
   
homecontroller.update();
if(defaultTargetPlatform == TargetPlatform.iOS  && !kIsWeb) 
await homecontroller.flutterTts.setIosAudioCategory(IosTextToSpeechAudioCategory.ambient,
     [
          IosTextToSpeechAudioCategoryOptions.allowBluetooth,
          IosTextToSpeechAudioCategoryOptions.allowBluetoothA2DP,
          IosTextToSpeechAudioCategoryOptions.mixWithOthers
     ],
     IosTextToSpeechAudioMode.voicePrompt
);

    await homecontroller. flutterTts.setVolume(volume);
    await  homecontroller. flutterTts.setSpeechRate(homecontroller.voiceRate);
    await  homecontroller. flutterTts.setPitch(pitch);
    await  homecontroller. flutterTts.speak(textToSpeak);
      homecontroller.isTTSspeaking = false ;

  }

am calling it here , and am using 1 second delay so the tts finish the last call in the previous page

  @override
  void initState() {
    super.initState();
       _setAwaitOptions();
 print("init state is called");
    if( extractLatexSymbols(homecontroller.selectedsectionAI.text!) ) {
isLatexThere = true ;

    }else{
  isLatexThere = false ;    
    }

         Future.delayed(Duration(seconds: 1),(){
 speak(textToSpeak: homecontroller.selectedsectionAI.text?? "") ;
    }) ;

Platform:

  • :Browser: Chrome
@dlutton dlutton self-assigned this Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants