https://github.com/kimfucious/polly-is-a-cracker
🦜 Amazon Polly does dad jokes... 😂
https://github.com/kimfucious/polly-is-a-cracker
amazon-polly angular polly
Last synced: about 2 months ago
JSON representation
🦜 Amazon Polly does dad jokes... 😂
- Host: GitHub
- URL: https://github.com/kimfucious/polly-is-a-cracker
- Owner: kimfucious
- Created: 2019-08-20T14:42:58.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T08:52:55.000Z (over 2 years ago)
- Last Synced: 2025-02-14T00:20:52.630Z (3 months ago)
- Topics: amazon-polly, angular, polly
- Language: TypeScript
- Homepage: https://polly.abts.io/
- Size: 2.56 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 28
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🦜 Polly is a Cracker [](https://app.netlify.com/sites/serene-haibt-4aed40/deploys)
## About
- This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.2.0
- Audio handled by [howler.js](https://www.npmjs.com/package/howler)
- Base Polly code example started from [here](https://docs.aws.amazon.com/code-samples/latest/catalog/javascript-browserstart-polly.html.html)
- Humour provided by the groan-worthy, [icanhazdadjoke](https://icanhazdadjoke.com/api) API
- Voices are made possible by [Amazon Polly](https://aws.amazon.com/polly/)## Notes
### The aws-sdk does not seem to work out of the box with Angular.
To get this working:
1. Add the following line to `polyfills.ts`:
```js
(window as any).global = window;
```2. add @types/node package (via npm or yarn)
3. change the following line in `tsconfig.app.json`from this:
```js
"types": []
```to this:
```js
"types": ["node"]
```_Your mileage may vary_
### Change detection in callbacks needs a tick in the pants
💡 I learned that change detection in Angular needs an [app.tick()](https://angular.io/api/core/ApplicationRef#tick) when the change occurs within a callback function.
### Unneeded/unwanted arguments from base code example
😑 Working from the Polly base code example [here](https://docs.aws.amazon.com/code-samples/latest/catalog/javascript-browserstart-polly.html.html), I found that the following lines where throwing errors in my angular app:
```js
var polly = new AWS.Polly({ apiVersion: "2016-06-10" });
var signer = new AWS.Polly.Presigner(speechParams, polly);
```I wound up removing the first line and the all of the arguments on the `signer` to get things working without errors.
```js
const signer = new AWS.Polly.Presigner();
```