capacitor-community / text-to-speech

⚡️ Capacitor plugin for synthesizing speech from text.
MIT License
99 stars 29 forks source link

feat: Add pause and resume methods #133

Open Lechevallier opened 3 months ago

Lechevallier commented 3 months ago

Is your feature request related to a problem? Please describe: I wish this plugin would allow to pause and resume the read. For example, speechSynthesis allow this, but unfortunately this is not supported on android browser.

Describe the solution you'd like: As a developer, I expect the 2 following functions to be added to the TextToSpeechPlugin interface:

export interface TextToSpeechPlugin {
    ...
    /**
     * Pause the read.
     */
    pause(): Promise<void>;
    /**
     * Resume the read.
     */
    resume(): Promise<void>;

Describe alternatives you've considered: As said before, I tried speechSynthesis, but this is not supported for android browser.

window.speechSynthesis.start("Hello world");
window.speechSynthesis.pause();
window.speechSynthesis.resume();

Additional context: Expected behaviour: