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

setStartHandler/setCompletionHandler are not called #71

Closed
sashko opened this issue Oct 21, 2019 · 5 comments
Closed

setStartHandler/setCompletionHandler are not called #71

sashko opened this issue Oct 21, 2019 · 5 comments
Assignees

Comments

@sashko
Copy link
Contributor

sashko commented Oct 21, 2019

💬 Questions and Help

I have an app in which I am trying to register callbacks to start/stop speak with the appropriate methods, but neither of them is called.

Might be related to #53, but I could not get what the issue was in that case.

Any assistance would be highly appreciated. Thank you.

  initTts() async {
    tts.setStartHandler(() {
      print("start");
      setState(() {
        ttsState = TtsState.playing;
      });
    });

    tts.setCompletionHandler(() {
      print("stop");
      setState(() {
        ttsState = TtsState.stopped;
      });
    });
@dlutton dlutton self-assigned this Oct 22, 2019
@dlutton
Copy link
Owner

dlutton commented Nov 12, 2019

@sashko I tested the registered callbacks again with the example in this repo and it's working. Please test with the example provided and let me know if it's failing and the emulator devices you're testing with.

@sashko
Copy link
Contributor Author

sashko commented Nov 12, 2019

Example app works. I have basically copy-pasted code, and have no idea what I would be missing....

@dlutton
Copy link
Owner

dlutton commented Nov 12, 2019

I'm assuming it's because you're importing package:speak_nato/preferences.dart which is already instantiating FlutterTts. Maybe try passing your instance from your main_screen.dart into the preferences.dart like getLanguage(tts) and your preferences.dart containing Future<String> getLanguage(FlutterTts tts) async so you can remove var tts = new FlutterTts();.

@dlutton
Copy link
Owner

dlutton commented Dec 3, 2019

Did my suggestion fix your issue @sashko ?

@sashko
Copy link
Contributor Author

sashko commented Dec 6, 2019

Apologizes for the delay - was away without my laptop.

You were right. Many thanks for your assistance!

@sashko sashko closed this as completed Dec 6, 2019
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