Thinking “out of the box”Thinking “out of the box”
with Ionic Text To Speechwith Ionic Text To Speech
Eric James FloeEric James Floe
SoCal Code Camp 6/24/17SoCal Code Camp 6/24/17
Ionic Text To SpeechIonic Text To Speech
Why Angular?Why Angular?
Ionic Text To SpeechIonic Text To Speech
Why Angular?Why Angular?
Ionic Text To SpeechIonic Text To Speech
Why Angular?Why Angular?
Ionic Text To SpeechIonic Text To Speech
Why Angular?Why Angular?
Why Ionic?Why Ionic?
Ionic Text To SpeechIonic Text To Speech
Why Angular?Why Angular?
Why Ionic?Why Ionic?
Why Hybrid?Why Hybrid?
Ionic Text To SpeechIonic Text To Speech
Why Angular?Why Angular?
Why Ionic?Why Ionic?
Why Hybrid?Why Hybrid?
• Build and maintain one codebase while deploying toBuild and maintain one codebase while deploying to
numerous device platforms.numerous device platforms.
Ionic Text To SpeechIonic Text To Speech
Why Angular?Why Angular?
Why Ionic?Why Ionic?
Why Hybrid?Why Hybrid?
• Build and maintain one code base.Build and maintain one code base.
• Deploy to numerous device platforms.Deploy to numerous device platforms.
Why Native Device capabilities?Why Native Device capabilities?
Ionic Text To SpeechIonic Text To Speech
Why Angular?Why Angular?
Why Ionic?Why Ionic?
Why Hybrid?Why Hybrid?
• Build and maintain one code base.Build and maintain one code base.
• Deploy to numerous device platforms.Deploy to numerous device platforms.
Why Native Device capabilities?Why Native Device capabilities?
• Because they are cool and synergistically extend theBecause they are cool and synergistically extend the
functional reach of our applications!functional reach of our applications!
Ionic Text To SpeechIonic Text To Speech
Why Angular?Why Angular?
Why Ionic?Why Ionic?
Why Hybrid?Why Hybrid?
• Build and maintain one code base.Build and maintain one code base.
• Deploy to numerous device platforms.Deploy to numerous device platforms.
Why Native Device capabilities?Why Native Device capabilities?
• Because they are cool and synergistically extend theBecause they are cool and synergistically extend the
functional reach of our applications!functional reach of our applications!
• Want Proof? ... go to the docs:Want Proof? ... go to the docs:
http://ionicframework.com/docs/http://ionicframework.com/docs/
Ionic Text To SpeechIonic Text To Speech
Audio/Video Barcode Scanner
Beacons Bluetooth
Camera Contacts
DB Integration File Access
Fingerprint FTP
Geolocation Geofencing
Globalization Google Maps
Media Phone
SMS Social Media
Speech Recognition Text to Speech
Ionic Text To SpeechIonic Text To Speech
Install Ionic and its Dependencies
Install a web development IDEInstall a web development IDE
Install GITInstall GIT
Install Node.jsInstall Node.js
Install/Upgrade npmInstall/Upgrade npm
Install Angular CLIInstall Angular CLI
Install CordovaInstall Cordova
Install IonicInstall Ionic
Ionic Text To SpeechIonic Text To Speech
Demo Time!!!Demo Time!!!
Ionic Text To SpeechIonic Text To Speech
Create a new project:Create a new project:
• ionic start SoCalCodeCamp blank --v2ionic start SoCalCodeCamp blank --v2
Ionic Text To SpeechIonic Text To Speech
Create a new project:Create a new project:
• ionic start SoCalCodeCamp blank --v2ionic start SoCalCodeCamp blank --v2
CD into the new project:CD into the new project:
• cd SoCalCodeCampcd SoCalCodeCamp
Ionic Text To SpeechIonic Text To Speech
Create a new project:Create a new project:
• ionic start SoCalCodeCamp blank --v2ionic start SoCalCodeCamp blank --v2
CD into the new project:CD into the new project:
• CD SoCalCodeCampCD SoCalCodeCamp
Run the new project:Run the new project:
• ionic serveionic serve
• http://localhost:8100/http://localhost:8100/
Ionic Text To SpeechIonic Text To Speech
Create a new project:Create a new project:
• ionic start SoCalCodeCamp blank --v2ionic start SoCalCodeCamp blank --v2
CD into the new project:CD into the new project:
• CD SoCalCodeCampCD SoCalCodeCamp
Run the new project:Run the new project:
• ionic serveionic serve
• http://localhost:8100/http://localhost:8100/
Open the project in an IDE & review the code.Open the project in an IDE & review the code.
• Edit the title & saveEdit the title & save
Ionic Text To SpeechIonic Text To Speech
From the root directory add a Mobile Platform:From the root directory add a Mobile Platform:
• ionic platform add androidionic platform add android
Ionic Text To SpeechIonic Text To Speech
From the root directory add a Mobile Platform:From the root directory add a Mobile Platform:
• ionic platform add androidionic platform add android
Add the tts plugin to the project:Add the tts plugin to the project:
• cordova plugin add cordova-plugin-ttscordova plugin add cordova-plugin-tts
Ionic Text To SpeechIonic Text To Speech
From the root directory add a Mobile Platform:From the root directory add a Mobile Platform:
• ionic platform add androidionic platform add android
Add the tts plugin to the project:Add the tts plugin to the project:
• cordova plugin add cordova-plugin-ttscordova plugin add cordova-plugin-tts
Add the Ionic Native Package for Text To Speech:Add the Ionic Native Package for Text To Speech:
• npm install @ionic-native/text-to-speech --savenpm install @ionic-native/text-to-speech --save
Ionic Text To SpeechIonic Text To Speech
In the IDE open the src/app/app.module.ts and add theIn the IDE open the src/app/app.module.ts and add the
TextToSpeech import:TextToSpeech import:
• import { TextToSpeech } from '@ionic-native/text-to-speech';import { TextToSpeech } from '@ionic-native/text-to-speech';
Add TextToSpeech to the list of providers:Add TextToSpeech to the list of providers:
providers: [providers: [
StatusBar,StatusBar,
SplashScreen,SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler},{provide: ErrorHandler, useClass: IonicErrorHandler},
TextToSpeechTextToSpeech
]]
Ionic Text To SpeechIonic Text To Speech
In the markup:In the markup:
• Add an ion-itemAdd an ion-item
Ionic Text To SpeechIonic Text To Speech
In the markup:In the markup:
• Add an ion-itemAdd an ion-item
• Add a ion-labelAdd a ion-label
Ionic Text To SpeechIonic Text To Speech
In the markup:In the markup:
• Add an ion-itemAdd an ion-item
• Add a ion-labelAdd a ion-label
• Add a ion-text areaAdd a ion-text area
Ionic Text To SpeechIonic Text To Speech
In the markup:In the markup:
• Add an ion-itemAdd an ion-item
• Add a ion-labelAdd a ion-label
• Add a ion-text areaAdd a ion-text area
• Add a buttonAdd a button
Ionic Text To SpeechIonic Text To Speech
In the markup:In the markup:
<ion-content padding><ion-content padding>
<ion-item><ion-item>
<ion-label>Text</ion-label><ion-label>Text</ion-label>
<ion-textarea rows="5" [(ngModel)]="text"></ion-textarea><ion-textarea rows="5" [(ngModel)]="text"></ion-textarea>
</ion-item></ion-item>
<button ion-button (click)="sayText()">Text to Speech</button><button ion-button (click)="sayText()">Text to Speech</button>
</ion-content></ion-content>
Ionic Text To SpeechIonic Text To Speech
In the component import TextToSpeech:In the component import TextToSpeech:
• import { TextToSpeech } from '@ionic-native/text-to-speech';import { TextToSpeech } from '@ionic-native/text-to-speech';
Ionic Text To SpeechIonic Text To Speech
In the component import TextToSpeech:In the component import TextToSpeech:
• import { TextToSpeech } from '@ionic-native/text-to-speech';import { TextToSpeech } from '@ionic-native/text-to-speech';
Create a string variable in the export class.Create a string variable in the export class.
• text: string;text: string;
Ionic Text To SpeechIonic Text To Speech
In the component import TextToSpeech:In the component import TextToSpeech:
• import { TextToSpeech } from '@ionic-native/text-to-speech';import { TextToSpeech } from '@ionic-native/text-to-speech';
Create a string variable in the export class.Create a string variable in the export class.
• text: string;text: string;
Inject TextToSpeech into the constructor.Inject TextToSpeech into the constructor.
• private tts: TextToSpeechprivate tts: TextToSpeech
Ionic Text To SpeechIonic Text To Speech
import { Component } from '@angular/core';import { Component } from '@angular/core';
import { TextToSpeech } from '@ionic-native/text-to-speech';import { TextToSpeech } from '@ionic-native/text-to-speech';
@Component({@Component({
selector: 'page-home',selector: 'page-home',
templateUrl: 'home.html'templateUrl: 'home.html'
})})
export class HomePage {export class HomePage {
text: string;text: string;
constructor(private tts: TextToSpeech) {constructor(private tts: TextToSpeech) {
}}
Ionic Text To SpeechIonic Text To Speech
In the component:In the component:
• import { TextToSpeech } from '@ionic-native/text-import { TextToSpeech } from '@ionic-native/text-
to-speech';to-speech';
Inject TextToSpeech into the constructor.Inject TextToSpeech into the constructor.
• private tts: TextToSpeechprivate tts: TextToSpeech
Ionic Text To SpeechIonic Text To Speech
In the component build the function:In the component build the function:
async sayText():Promise<any>{async sayText():Promise<any>{
try{try{
await this.tts.speak(this.text);await this.tts.speak(this.text);
}}
catch(e){catch(e){
console.log(e)console.log(e)
}}
}}

More Related Content

PPT
Eclipse 3.7 : Tips and tricks
PDF
Mobile Development integration tests
PDF
Continuous delivery from the trenches
PPTX
What's new in AVR 12.0 and VS 2013
PPTX
Browser tools
PPTX
Recorded Remote Simultaneous Interpreting
PDF
Who Took The Cookie From The Cookie Jar?
PPT
API Tooling in Eclipse
Eclipse 3.7 : Tips and tricks
Mobile Development integration tests
Continuous delivery from the trenches
What's new in AVR 12.0 and VS 2013
Browser tools
Recorded Remote Simultaneous Interpreting
Who Took The Cookie From The Cookie Jar?
API Tooling in Eclipse

What's hot (15)

PPT
Open Source Business Case
PDF
CDI 1.1 university
PPTX
Plugin architecture (Extensible Application Architecture)
PDF
Managing OSS license obligations
PDF
Enlightenment: A Cross Platform Window Manager & Toolkit
PPT
San Francisco PHP Meetup Presentation on Zend Framework
PDF
p2, your savior or your achilles heel? Everything an Eclipse team needs to kn...
PPTX
Optimising video delivery - Brightcove PLAY 2019
PDF
A Tale of Two Toolkits
PPTX
Automated Infrastructure Testing
PDF
Why ClassforName Sucks - BJ Hargrave
PPT
Eclipse Plug-in Develompent Tips And Tricks
PDF
iText IP Review
PPTX
Codestrong 2012 breakout session exploring the new titanium command line in...
Open Source Business Case
CDI 1.1 university
Plugin architecture (Extensible Application Architecture)
Managing OSS license obligations
Enlightenment: A Cross Platform Window Manager & Toolkit
San Francisco PHP Meetup Presentation on Zend Framework
p2, your savior or your achilles heel? Everything an Eclipse team needs to kn...
Optimising video delivery - Brightcove PLAY 2019
A Tale of Two Toolkits
Automated Infrastructure Testing
Why ClassforName Sucks - BJ Hargrave
Eclipse Plug-in Develompent Tips And Tricks
iText IP Review
Codestrong 2012 breakout session exploring the new titanium command line in...
Ad

Similar to Thinking tts - Eric Floe (20)

PDF
Hybrid app development with ionic
PPTX
Hybrid Apps in a Snap
PDF
Titanium #MDS13
PPTX
NCDevCon 2017 - Cross Platform Mobile Apps
PDF
Appcelerator Titanium Intro (2014)
PPT
Native Mobile Application Using Open Source
PPT
OSCON Titanium Tutorial
PDF
Ionic App Platform Overview
PPTX
Getting started with Appcelerator Titanium
PDF
Ionic2 First Lesson of Four
PPT
Getting Started with Titanium
PPT
Getting Started with Titanium
KEY
Getting Started with .NET
PDF
Dr. Strangelove, or how I learned to love plugin development
PDF
IBM Bootcamp - Text to Speech API Lab
PPTX
Getting started with titanium
PPT
Whats New in Titanium 0.7
PDF
Ionic Framework
PPTX
Appcelerator Titanium Intro
PDF
Emulators as an Emerging Best Practice for API Providers
Hybrid app development with ionic
Hybrid Apps in a Snap
Titanium #MDS13
NCDevCon 2017 - Cross Platform Mobile Apps
Appcelerator Titanium Intro (2014)
Native Mobile Application Using Open Source
OSCON Titanium Tutorial
Ionic App Platform Overview
Getting started with Appcelerator Titanium
Ionic2 First Lesson of Four
Getting Started with Titanium
Getting Started with Titanium
Getting Started with .NET
Dr. Strangelove, or how I learned to love plugin development
IBM Bootcamp - Text to Speech API Lab
Getting started with titanium
Whats New in Titanium 0.7
Ionic Framework
Appcelerator Titanium Intro
Emulators as an Emerging Best Practice for API Providers
Ad

Recently uploaded (20)

PPT
Module 1.ppt Iot fundamentals and Architecture
PPTX
2018-HIPAA-Renewal-Training for executives
PDF
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
PDF
Getting started with AI Agents and Multi-Agent Systems
PPTX
Build Your First AI Agent with UiPath.pptx
PPTX
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
PDF
Comparative analysis of machine learning models for fake news detection in so...
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PDF
Five Habits of High-Impact Board Members
PPT
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
PDF
STKI Israel Market Study 2025 version august
PPTX
Microsoft Excel 365/2024 Beginner's training
DOCX
search engine optimization ppt fir known well about this
PPTX
Modernising the Digital Integration Hub
PDF
sustainability-14-14877-v2.pddhzftheheeeee
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
Architecture types and enterprise applications.pdf
PPTX
The various Industrial Revolutions .pptx
PDF
Improvisation in detection of pomegranate leaf disease using transfer learni...
PPTX
Chapter 5: Probability Theory and Statistics
Module 1.ppt Iot fundamentals and Architecture
2018-HIPAA-Renewal-Training for executives
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
Getting started with AI Agents and Multi-Agent Systems
Build Your First AI Agent with UiPath.pptx
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
Comparative analysis of machine learning models for fake news detection in so...
A contest of sentiment analysis: k-nearest neighbor versus neural network
Five Habits of High-Impact Board Members
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
STKI Israel Market Study 2025 version august
Microsoft Excel 365/2024 Beginner's training
search engine optimization ppt fir known well about this
Modernising the Digital Integration Hub
sustainability-14-14877-v2.pddhzftheheeeee
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
Architecture types and enterprise applications.pdf
The various Industrial Revolutions .pptx
Improvisation in detection of pomegranate leaf disease using transfer learni...
Chapter 5: Probability Theory and Statistics

Thinking tts - Eric Floe

  • 1. Thinking “out of the box”Thinking “out of the box” with Ionic Text To Speechwith Ionic Text To Speech Eric James FloeEric James Floe SoCal Code Camp 6/24/17SoCal Code Camp 6/24/17
  • 2. Ionic Text To SpeechIonic Text To Speech Why Angular?Why Angular?
  • 3. Ionic Text To SpeechIonic Text To Speech Why Angular?Why Angular?
  • 4. Ionic Text To SpeechIonic Text To Speech Why Angular?Why Angular?
  • 5. Ionic Text To SpeechIonic Text To Speech Why Angular?Why Angular? Why Ionic?Why Ionic?
  • 6. Ionic Text To SpeechIonic Text To Speech Why Angular?Why Angular? Why Ionic?Why Ionic? Why Hybrid?Why Hybrid?
  • 7. Ionic Text To SpeechIonic Text To Speech Why Angular?Why Angular? Why Ionic?Why Ionic? Why Hybrid?Why Hybrid? • Build and maintain one codebase while deploying toBuild and maintain one codebase while deploying to numerous device platforms.numerous device platforms.
  • 8. Ionic Text To SpeechIonic Text To Speech Why Angular?Why Angular? Why Ionic?Why Ionic? Why Hybrid?Why Hybrid? • Build and maintain one code base.Build and maintain one code base. • Deploy to numerous device platforms.Deploy to numerous device platforms. Why Native Device capabilities?Why Native Device capabilities?
  • 9. Ionic Text To SpeechIonic Text To Speech Why Angular?Why Angular? Why Ionic?Why Ionic? Why Hybrid?Why Hybrid? • Build and maintain one code base.Build and maintain one code base. • Deploy to numerous device platforms.Deploy to numerous device platforms. Why Native Device capabilities?Why Native Device capabilities? • Because they are cool and synergistically extend theBecause they are cool and synergistically extend the functional reach of our applications!functional reach of our applications!
  • 10. Ionic Text To SpeechIonic Text To Speech Why Angular?Why Angular? Why Ionic?Why Ionic? Why Hybrid?Why Hybrid? • Build and maintain one code base.Build and maintain one code base. • Deploy to numerous device platforms.Deploy to numerous device platforms. Why Native Device capabilities?Why Native Device capabilities? • Because they are cool and synergistically extend theBecause they are cool and synergistically extend the functional reach of our applications!functional reach of our applications! • Want Proof? ... go to the docs:Want Proof? ... go to the docs: http://ionicframework.com/docs/http://ionicframework.com/docs/
  • 11. Ionic Text To SpeechIonic Text To Speech Audio/Video Barcode Scanner Beacons Bluetooth Camera Contacts DB Integration File Access Fingerprint FTP Geolocation Geofencing Globalization Google Maps Media Phone SMS Social Media Speech Recognition Text to Speech
  • 12. Ionic Text To SpeechIonic Text To Speech Install Ionic and its Dependencies Install a web development IDEInstall a web development IDE Install GITInstall GIT Install Node.jsInstall Node.js Install/Upgrade npmInstall/Upgrade npm Install Angular CLIInstall Angular CLI Install CordovaInstall Cordova Install IonicInstall Ionic
  • 13. Ionic Text To SpeechIonic Text To Speech Demo Time!!!Demo Time!!!
  • 14. Ionic Text To SpeechIonic Text To Speech Create a new project:Create a new project: • ionic start SoCalCodeCamp blank --v2ionic start SoCalCodeCamp blank --v2
  • 15. Ionic Text To SpeechIonic Text To Speech Create a new project:Create a new project: • ionic start SoCalCodeCamp blank --v2ionic start SoCalCodeCamp blank --v2 CD into the new project:CD into the new project: • cd SoCalCodeCampcd SoCalCodeCamp
  • 16. Ionic Text To SpeechIonic Text To Speech Create a new project:Create a new project: • ionic start SoCalCodeCamp blank --v2ionic start SoCalCodeCamp blank --v2 CD into the new project:CD into the new project: • CD SoCalCodeCampCD SoCalCodeCamp Run the new project:Run the new project: • ionic serveionic serve • http://localhost:8100/http://localhost:8100/
  • 17. Ionic Text To SpeechIonic Text To Speech Create a new project:Create a new project: • ionic start SoCalCodeCamp blank --v2ionic start SoCalCodeCamp blank --v2 CD into the new project:CD into the new project: • CD SoCalCodeCampCD SoCalCodeCamp Run the new project:Run the new project: • ionic serveionic serve • http://localhost:8100/http://localhost:8100/ Open the project in an IDE & review the code.Open the project in an IDE & review the code. • Edit the title & saveEdit the title & save
  • 18. Ionic Text To SpeechIonic Text To Speech From the root directory add a Mobile Platform:From the root directory add a Mobile Platform: • ionic platform add androidionic platform add android
  • 19. Ionic Text To SpeechIonic Text To Speech From the root directory add a Mobile Platform:From the root directory add a Mobile Platform: • ionic platform add androidionic platform add android Add the tts plugin to the project:Add the tts plugin to the project: • cordova plugin add cordova-plugin-ttscordova plugin add cordova-plugin-tts
  • 20. Ionic Text To SpeechIonic Text To Speech From the root directory add a Mobile Platform:From the root directory add a Mobile Platform: • ionic platform add androidionic platform add android Add the tts plugin to the project:Add the tts plugin to the project: • cordova plugin add cordova-plugin-ttscordova plugin add cordova-plugin-tts Add the Ionic Native Package for Text To Speech:Add the Ionic Native Package for Text To Speech: • npm install @ionic-native/text-to-speech --savenpm install @ionic-native/text-to-speech --save
  • 21. Ionic Text To SpeechIonic Text To Speech In the IDE open the src/app/app.module.ts and add theIn the IDE open the src/app/app.module.ts and add the TextToSpeech import:TextToSpeech import: • import { TextToSpeech } from '@ionic-native/text-to-speech';import { TextToSpeech } from '@ionic-native/text-to-speech'; Add TextToSpeech to the list of providers:Add TextToSpeech to the list of providers: providers: [providers: [ StatusBar,StatusBar, SplashScreen,SplashScreen, {provide: ErrorHandler, useClass: IonicErrorHandler},{provide: ErrorHandler, useClass: IonicErrorHandler}, TextToSpeechTextToSpeech ]]
  • 22. Ionic Text To SpeechIonic Text To Speech In the markup:In the markup: • Add an ion-itemAdd an ion-item
  • 23. Ionic Text To SpeechIonic Text To Speech In the markup:In the markup: • Add an ion-itemAdd an ion-item • Add a ion-labelAdd a ion-label
  • 24. Ionic Text To SpeechIonic Text To Speech In the markup:In the markup: • Add an ion-itemAdd an ion-item • Add a ion-labelAdd a ion-label • Add a ion-text areaAdd a ion-text area
  • 25. Ionic Text To SpeechIonic Text To Speech In the markup:In the markup: • Add an ion-itemAdd an ion-item • Add a ion-labelAdd a ion-label • Add a ion-text areaAdd a ion-text area • Add a buttonAdd a button
  • 26. Ionic Text To SpeechIonic Text To Speech In the markup:In the markup: <ion-content padding><ion-content padding> <ion-item><ion-item> <ion-label>Text</ion-label><ion-label>Text</ion-label> <ion-textarea rows="5" [(ngModel)]="text"></ion-textarea><ion-textarea rows="5" [(ngModel)]="text"></ion-textarea> </ion-item></ion-item> <button ion-button (click)="sayText()">Text to Speech</button><button ion-button (click)="sayText()">Text to Speech</button> </ion-content></ion-content>
  • 27. Ionic Text To SpeechIonic Text To Speech In the component import TextToSpeech:In the component import TextToSpeech: • import { TextToSpeech } from '@ionic-native/text-to-speech';import { TextToSpeech } from '@ionic-native/text-to-speech';
  • 28. Ionic Text To SpeechIonic Text To Speech In the component import TextToSpeech:In the component import TextToSpeech: • import { TextToSpeech } from '@ionic-native/text-to-speech';import { TextToSpeech } from '@ionic-native/text-to-speech'; Create a string variable in the export class.Create a string variable in the export class. • text: string;text: string;
  • 29. Ionic Text To SpeechIonic Text To Speech In the component import TextToSpeech:In the component import TextToSpeech: • import { TextToSpeech } from '@ionic-native/text-to-speech';import { TextToSpeech } from '@ionic-native/text-to-speech'; Create a string variable in the export class.Create a string variable in the export class. • text: string;text: string; Inject TextToSpeech into the constructor.Inject TextToSpeech into the constructor. • private tts: TextToSpeechprivate tts: TextToSpeech
  • 30. Ionic Text To SpeechIonic Text To Speech import { Component } from '@angular/core';import { Component } from '@angular/core'; import { TextToSpeech } from '@ionic-native/text-to-speech';import { TextToSpeech } from '@ionic-native/text-to-speech'; @Component({@Component({ selector: 'page-home',selector: 'page-home', templateUrl: 'home.html'templateUrl: 'home.html' })}) export class HomePage {export class HomePage { text: string;text: string; constructor(private tts: TextToSpeech) {constructor(private tts: TextToSpeech) { }}
  • 31. Ionic Text To SpeechIonic Text To Speech In the component:In the component: • import { TextToSpeech } from '@ionic-native/text-import { TextToSpeech } from '@ionic-native/text- to-speech';to-speech'; Inject TextToSpeech into the constructor.Inject TextToSpeech into the constructor. • private tts: TextToSpeechprivate tts: TextToSpeech
  • 32. Ionic Text To SpeechIonic Text To Speech In the component build the function:In the component build the function: async sayText():Promise<any>{async sayText():Promise<any>{ try{try{ await this.tts.speak(this.text);await this.tts.speak(this.text); }} catch(e){catch(e){ console.log(e)console.log(e) }} }}