Many people like to listen the news rather than reading. People while driving or doing some other task can also get the new by listining rather than reading so here come
NewsAudioBook
in action you can listen news jsut by tapping on the play button and this app will read news for you.
- Flutter for making this app
- News Api for getting the recent news
- Google Text To Speech Api for converting the news text to speech.
From
news.dart
file we make ahttp
request to newsapi
to get the data in the json format. Then after fromvoice_connection.dart
file we make apost
request totext-to-speech-api
that seems like.
{
"audioConfig": {
"audioEncoding": "LINEAR16",
"pitch": 0,
"speakingRate": 1
},
"input": {
"text": text
},
"voice": {
"languageCode": "en-US",
"name": "en-US-Wavenet-D"
}
}
Then
text-to-sppech
api return aBase64
encoded audio string. Then we decode this Base64 audio to mp3 and serve to the user viaplayer.dart
file
A few resources to get you started if this is your first Flutter project:
For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.