ken107 / read-aloud

An awesome browser extension that reads aloud webpage content with one click
https://readaloud.app
MIT License
1.36k stars 233 forks source link

Add checkbox to enable Google Studio voices #353

Closed stephen-soltesz closed 11 months ago

stephen-soltesz commented 11 months ago

This change adds a new checkbox configuration option to the "Enable Custom Voices" dialog to enable GCP Studio voices.

Changes

Testing

Since the authoritative set of Google voices supported by Read Aloud are returned by https://support.readaloud.app/read-aloud/list-voices/google (which do not currently return Studio voices), I temporarily modified GoogleWavenetTtsEngine.updateVoices() to use the static list of voices that now include some Studio examples. This final PR reverts the changes used for testing.

UI Changes

The "Enable Custom Voices" dialog, that allows registration of API keys, now includes a GCP checkbox and warning.

Screen Shot 2023-10-29 at 10 44 52 PM
stephen-soltesz commented 11 months ago

@ken107 -- this is a first attempt to add the functionality mentioned in https://github.com/ken107/read-aloud/issues/351. I'm not very familiar with javascript or jQuery -- if there are preferable ways to do this, please let me know. I'm happy to make revisions.

In an early draft I placed the filtering in options.js:populateVoices, however accessing the gcpCreds felt unnatural here. So, I moved the filtering to GoogleWavenetTtsEngine.updateVoices, where the credentials make sense in context. While the first way correctly updated the displayed list after returning to options.html, unfortunately, the second approach does not. Is there a better way?

ken107 commented 11 months ago

1) The checkbox should be unchecked by default 2) If you do the filtering in the getVoices() function right above the updateVoices(), I think that would be best. Don't worry about getFreeVoices(). Other than that, looks good.

stephen-soltesz commented 11 months ago
  1. The checkbox is disabled by default. The first screenshot above was immediately after setting the value. The screenshot below is the default state after reloading the extension.
  2. I've moved the filtering to getVoices(), that's a better choice. It appears to solve the refresh issues when returning to options.html.

So, I think this is feature complete.

Screen Shot 2023-10-31 at 5 21 30 AM