Search code examples
javascriptcordovatext-to-speech

TTS breaks Background mode


I use TTS with this plugin: https://github.com/vilic/cordova-plugin-tts

I use it in combination with this Background Mode Plugin: https://github.com/katzer/cordova-plugin-background-mode

The problem is, if I start TTS (even if I give an empty string) the background mode will be broken and is not working anymore and other functions are stopping. The voice itself runs in the Background mode. Without starting TTS everything is fine.

It's only on the second time. When I run TTS the first time, the background mode is working. Can it be related to the fact that I call TTS the second time and then there are existing two of it?

TTS.speak({
        text: text,
        locale: 'de-DE',
        rate: 1.5
        }, function () {

            // run function which is stopping (if I go to Background) after the second TTS

             }, function (reason) {
        console.log(reason);
    });

What could be the reason? Is there a way to solve it?


Solution

  • Now I tried an alternative TTS Cordova Plugin:

    https://github.com/GruppoMeta/cordova-plugin-adv-tts

    This is working without the issue.