siteorigin / speaking-docs

A Google docs addon that integrates with AWS Polly
MIT License
1 stars 1 forks source link

Implement Speaking Docs #1

Closed gregpriday closed 4 years ago

gregpriday commented 4 years ago

For our writers at Briefer, we need to know what text will sound like when read by AWS Polly. This addon should make it very easy for them to listen to sentences and paragraphs.

For a good idea on how this addon should work, take a look at our Froala/Nova integration with AWS Polly.

https://github.com/brieferbooks/nova-froala-field/tree/develop

The quickstart guide seems to very useful. There's even a function for getting the selected text that we can utilize (unless it's part of the core API by now). The rest of the docs gives a lot more details.

Settings to add AWS credentials

We need to give a user a way of adding their AWS credentials for AWS Polly calls. Google docs seems to have a good way of creating forms and modals, so this should be fairly straight forward. I think the PropertiesService can store data like this.

We need to give users a way to access this settings form from the main menu.

Listening to selected text

Ideally, we need a button right inside the main Google Docs toolbar.

Screenshot 2020-06-18 at 16 17 51

Something like a speaker icon or a speech bubble should work fine. I'm not sure if Google docs has an entire icon pack or if we need to somehow add our own.

Clicking the button should start playing the selected text. Just like the Translate quickstart example, this could display a sidebar with a simple HTML5 audio player so the user can stop and replay the audio if they need to. It's also possible the Cards service will be useful for this.

In addition to the toolbar button, we should have a keyboard shortcut to read the selected text.

Additionally, clicking the listen button while audio is playing should pause the audio.

Challenges

Our Froala integration has the advantage of having a server side component that makes requests to AWS Polly. In our case, we'll need to do everything using Javascript. Maybe this just means we'll need to use data URLs with the fetched MP3s in HTML audio tags.

vkazakevich commented 4 years ago

Unfortunately, the addons do not have the ability to manage Google Docs toolbar, so we can not add an icon. Mostly this addon works according to requirements.

gregpriday commented 4 years ago

Great! I'll check it out and give any feedback in the PR. Did docs at least give us the ability to add a keyboard shortcut?

vkazakevich commented 4 years ago

Unfortunately, the functionality of google addons is very limited at the moment :(

But, I added textarea on the sidebar, maybe this will make the work with the plugin more convenient.

https://issuetracker.google.com/issues/36752620

gregpriday commented 4 years ago

All finished in the develop branch 🚀