Text to Speech

Hello I’m new to Ionic and I’m studying version 2. I’m trying to use the Speech component but I’m not having success.

I’m using the link: http://ionicframework.com/docs/v2/native/texttospeech/

good…
What I’ve done and I’ve failed so far.
I created a blank project. I added the plugin through the command line
$ ionic plugin add cordova-plugin-tts

Then I went to the initial page of the project and added the items listed in the reference page

code:
import { Component } from ‘@angular/core’;
import { NavController } from ‘ionic-angular’;
import {TextToSpeech} from ‘ionic-native’;

@Component({
selector: ‘page-home’,
templateUrl: ‘home.html’
})
export class HomePage {

constructor(public navCtrl: NavController) {

}

ionViewDidEnter()
{

TextToSpeech.speak('Hello World')
.then(() => console.log('Success'))
.catch((reason: any) => console.log(reason));
console.log("Hello World");

}
}

I tried to run the product from that in the browser, IOS emulator and ionicView. In none of the tests did I succeed. Could someone help me?

Thank you

What’s in the console? Errors? Anything?

browser = cordova_not_available
emulator log

Marcador - 7 de mar de 2017 18:04:54
Mar 7 18:05:09 MacBook-Pro-de-Fernando CoreSimulatorBridge[16127]: Pasteboard change listener callback port <NSMachPort: 0x7f90f9e11560> registered
Mar 7 18:05:38 MacBook-Pro-de-Fernando CoreSimulatorBridge[16127]: Pasteboard change listener callback port <NSMachPort: 0x7f90f9f10780> registered
Mar 7 18:05:41 MacBook-Pro-de-Fernando CoreSimulatorBridge[16127]: Pasteboard change listener callback port <NSMachPort: 0x7f90f9f10830> registered
Mar 7 18:05:41 MacBook-Pro-de-Fernando CoreSimulatorBridge[16127]: Pasteboard change listener callback port <NSMachPort: 0x7f90f9c13fb0> registered
Mar 7 18:05:42 MacBook-Pro-de-Fernando CoreSimulatorBridge[16127]: Pasteboard change listener callback port <NSMachPort: 0x7f90f9e14220> registered
Mar 7 18:05:43 MacBook-Pro-de-Fernando CoreSimulatorBridge[16127]: Pasteboard change listener callback port <NSMachPort: 0x7f90f9e142d0> registered
Mar 7 18:05:44 MacBook-Pro-de-Fernando CoreSimulatorBridge[16127]: Pasteboard change listener callback port <NSMachPort: 0x7f90f9c15250> registered
Mar 7 18:05:44 MacBook-Pro-de-Fernando CoreSimulatorBridge[16127]: Requesting installation of file:///Users/fmello/Documents/Biblia/TextToSpeech/Speech/platforms/ios/build/emulator/Speech.app/ with options: {
CFBundleIdentifier = “com.ionicframework.speech267650”;
PackageType = Developer;
SimulatorRootPath = “/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk”;
SimulatorUserPath = “/Users/fmello/Library/Developer/CoreSimulator/Devices/6DA1FB4B-BA17-40EC-ADE9-B74C6247932D/data”;
}
Mar 7 18:05:44 MacBook-Pro-de-Fernando installd[16113]: 0x70000019a000 -[MIClientConnection _doInstallationForURL:withOptions:completion:]: Install of “/Users/fmello/Documents/Biblia/TextToSpeech/Speech/platforms/ios/build/emulator/Speech.app” type Developer (LSInstallType = (null)) requested by CoreSimulatorBridge (pid 16127)
Mar 7 18:05:44 MacBook-Pro-de-Fernando installd[16113]: 0x70000019a000 MDMCreateDeltaDirectory: calling MDMDirectoryDiff with:
state->old_bundle: /Users/fmello/Library/Developer/CoreSimulator/Devices/6DA1FB4B-BA17-40EC-ADE9-B74C6247932D/data/Containers/Bundle/Application/45179441-2207-42CC-94AA-1CAD5653A0DA/Speech.app
state->new_bundle: /Users/fmello/Documents/Biblia/TextToSpeech/Speech/platforms/ios/build/emulator/Speech.app
state->dst_bundle: /Users/fmello/Library/Developer/CoreSimulator/Devices/6DA1FB4B-BA17-40EC-ADE9-B74C6247932D/data/Library/Caches/com.apple.mobile.installd.staging/temp.mgKZKJ/extracted/Payload//Speech.app, binaryDiff flag: FALSE
dst_ipa: /Users/fmello/Library/Developer/CoreSimulator/Devices/6DA1FB4B-BA17-40EC-ADE9-B74C6247932D/data/Library/Caches/com.apple.mobile.installd.staging/temp.mgKZKJ/extracted
Mar 7 18:05:44 MacBook-Pro-de-Fernando installd[16113]: 0x700000094000 __MDMDirectoryDiff_block_invoke.37: calling writeDictToFile with: /Users/fmello/Library/Developer/CoreSimulator/Devices/6DA1FB4B-BA17-40EC-ADE9-B74C6247932D/data/Library/Caches/com.apple.mobile.installd.staging/temp.mgKZKJ/extracted/ManifestCache.plist
Mar 7 18:05:44 MacBook-Pro-de-Fernando installd[16113]: 0x700000094000 writeDictToFile: ==== Successfully wrote Manifest cache to /Users/fmello/Library/Developer/CoreSimulator/Devices/6DA1FB4B-BA17-40EC-ADE9-B74C6247932D/data/Library/Caches/com.apple.mobile.installd.staging/temp.mgKZKJ/extracted/ManifestCache.plist
Mar 7 18:05:44 MacBook-Pro-de-Fernando installd[16113]: 0x70000019a000 -[MIInstaller performInstallationWithError:]: Installing
Mar 7 18:05:44 MacBook-Pro-de-Fernando installd[16113]: 0x70000019a000 -[MIInstallableBundlePatch applyPatchWithError:]: Attempting patch update of com.ionicframework.speech267650 from 0.0.1 (0.0.1) to 0.0.1 (0.0.1)
Mar 7 18:05:44 MacBook-Pro-de-Fernando com.apple.CoreSimulator.SimDevice.6DA1FB4B-BA17-40EC-ADE9-B74C6247932D.launchd_sim[16101] (UIKitApplication:com.ionicframework.speech267650[0xcdd4][17668]): Service exited due to Killed: 9
Mar 7 18:05:44 MacBook-Pro-de-Fernando backboardd[16119]: [Common] Unable to get short BSD proc info for 17668: No such process
Mar 7 18:05:44 MacBook-Pro-de-Fernando backboardd[16119]: [Common] Unable to get proc info for 17668: No such process
Mar 7 18:05:44 MacBook-Pro-de-Fernando assertiond[16122]: notify_suspend_pid() failed with error 7
Mar 7 18:05:45 MacBook-Pro-de-Fernando installd[16113]: 0x70000019a000 -[MIInstallableBundle _refreshUUIDForContainer:withError:]: Data container for com.ionicframework.speech267650 is now at /Users/fmello/Library/Developer/CoreSimulator/Devices/6DA1FB4B-BA17-40EC-ADE9-B74C6247932D/data/Containers/Data/Application/32BFA1B2-A4D5-444D-B99C-2036156495AE
Mar 7 18:05:45 MacBook-Pro-de-Fernando installd[16113]: 0x70000019a000 -[MIContainer makeContainerLiveReplacingContainer:reason:withError:]: Made container live for com.ionicframework.speech267650 at /Users/fmello/Library/Developer/CoreSimulator/Devices/6DA1FB4B-BA17-40EC-ADE9-B74C6247932D/data/Containers/Bundle/Application/8EC908D5-9257-4F22-AC54-25C01C660B93
Mar 7 18:05:45 MacBook-Pro-de-Fernando installd[16113]: 0x70000019a000 -[MIInstaller performInstallationWithError:]: Install Successful; Staging: 0.63s; Waiting: 0.00s; Preflight/Patch: 0.27s, Verifying: 0.00s; Overall: 1.07s
Mar 7 18:05:45 MacBook-Pro-de-Fernando UserEventAgent[16104]: [default] LaunchServices observer: Installed (
"<LSApplicationProxy: 0x7fb2dbd4bbb0> com.ionicframework.speech267650 file:///Users/fmello/Library/Developer/CoreSimulator/Devices/6DA1FB4B-BA17-40EC-ADE9-B74C6247932D/data/Containers/Bundle/Application/8EC908D5-9257-4F22-AC54-25C01C660B93/Speech.app <com.ionicframework.speech267650 >"
) {1B69163A-0509-468F-A9F9-F05A38686103 276}
Mar 7 18:05:45 MacBook-Pro-de-Fernando appstored[16180]: [default] LaunchServices observer: Installed (
"<LSApplicationProxy: 0x7f83a26411c0> com.ionicframework.speech267650 file:///Users/fmello/Library/Developer/CoreSimulator/Devices/6DA1FB4B-BA17-40EC-ADE9-B74C6247932D/data/Containers/Bundle/Application/8EC908D5-9257-4F22-AC54-25C01C660B93/Speech.app <com.ionicframework.speech267650 >"
) {1B69163A-0509-468F-A9F9-F05A38686103 276}
Mar 7 18:05:45 MacBook-Pro-de-Fernando SpringBoard[16117]: [default] LaunchServices observer: Installed (
"<LSApplicationProxy: 0x7f8199f758a0> com.ionicframework.speech267650 file:///Users/fmello/Library/Developer/CoreSimulator/Devices/6DA1FB4B-BA17-40EC-ADE9-B74C6247932D/data/Containers/Bundle/Application/8EC908D5-9257-4F22-AC54-25C01C660B93/Speech.app <com.ionicframework.speech267650 >"
) {1B69163A-0509-468F-A9F9-F05A38686103 272}
Mar 7 18:05:45 MacBook-Pro-de-Fernando SpringBoard[16117]: [default] LaunchServices observer: Installed (
"<LSApplicationProxy: 0x7f8199f131c0> com.ionicframework.speech267650 file:///Users/fmello/Library/Developer/CoreSimulator/Devices/6DA1FB4B-BA17-40EC-ADE9-B74C6247932D/data/Containers/Bundle/Application/8EC908D5-9257-4F22-AC54-25C01C660B93/Speech.app <com.ionicframework.speech267650 >"
) {1B69163A-0509-468F-A9F9-F05A38686103 276}
Mar 7 18:05:45 MacBook-Pro-de-Fernando passd[16165]: [default] LaunchServices observer: Installed (
"<LSApplicationProxy: 0x7fed8be331f0> com.ionicframework.speech267650 file:///Users/fmello/Library/Developer/CoreSimulator/Devices/6DA1FB4B-BA17-40EC-ADE9-B74C6247932D/data/Containers/Bundle/Application/8EC908D5-9257-4F22-AC54-25C01C660B93/Speech.app <com.ionicframework.speech267650 >"
) {1B69163A-0509-468F-A9F9-F05A38686103 276}
Mar 7 18:05:45 MacBook-Pro-de-Fernando profiled[16167]: [default] LaunchServices observer: Installed (
"<LSApplicationProxy: 0x7f88e3e67570> com.ionicframework.speech267650 file:///Users/fmello/Library/Developer/CoreSimulator/Devices/6DA1FB4B-BA17-40EC-ADE9-B74C6247932D/data/Containers/Bundle/Application/8EC908D5-9257-4F22-AC54-25C01C660B93/Speech.app <com.ionicframework.speech267650 >"
) {1B69163A-0509-468F-A9F9-F05A38686103 276}
Mar 7 18:05:45 MacBook-Pro-de-Fernando routined[16107]: [default] LaunchServices observer: Installed (
"<LSApplicationProxy: 0x7ff3fa52a000> com.ionicframework.speech267650 file:///Users/fmello/Library/Developer/CoreSimulator/Devices/6DA1FB4B-BA17-40EC-ADE9-B74C6247932D/data/Containers/Bundle/Application/8EC908D5-9257-4F22-AC54-25C01C660B93/Speech.app <com.ionicframework.speech267650 >"
) {1B69163A-0509-468F-A9F9-F05A38686103 276}
Mar 7 18:05:45 MacBook-Pro-de-Fernando nsurlsessiond[16158]: [default] LaunchServices observer: Installed (
"<LSApplicationProxy: 0x7fa8daf18a30> com.ionicframework.speech267650 file:///Users/fmello/Library/Developer/CoreSimulator/Devices/6DA1FB4B-BA17-40EC-ADE9-B74C6247932D/data/Containers/Bundle/Application/8EC908D5-9257-4F22-AC54-25C01C660B93/Speech.app <com.ionicframework.speech267650 >"
) {1B69163A-0509-468F-A9F9-F05A38686103 276}
Mar 7 18:05:45 MacBook-Pro-de-Fernando SpringBoard[16117]: [Common] could not find icon for representation -> com.apple.mobilemail
Mar 7 18:05:45 MacBook-Pro-de-Fernando SpringBoard[16117]: [Common] throwing out icon because it isn’t visible in the model : node=<SBApplicationIcon: 0x6080001fa500; nodeID: ‘com.apple.camera’> com.apple.camera
Mar 7 18:05:45 MacBook-Pro-de-Fernando SpringBoard[16117]: [Common] could not find icon for representation -> com.apple.mobiletimer
Mar 7 18:05:45 MacBook-Pro-de-Fernando SpringBoard[16117]: [Common] could not find icon for representation -> com.apple.weather
Mar 7 18:05:45 MacBook-Pro-de-Fernando SpringBoard[16117]: [Common] could not find icon for representation -> com.apple.stocks
Mar 7 18:05:45 MacBook-Pro-de-Fernando SpringBoard[16117]: [Common] could not find icon for representation -> com.apple.mobilenotes
Mar 7 18:05:45 MacBook-Pro-de-Fernando SpringBoard[16117]: [Common] could not find icon for representation -> com.apple.MobileStore
Mar 7 18:05:45 MacBook-Pro-de-Fernando SpringBoard[16117]: [Common] could not find icon for representation -> com.apple.AppStore
Mar 7 18:05:45 MacBook-Pro-de-Fernando SpringBoard[16117]: [Common] could not find icon for representation -> com.apple.iBooks
Mar 7 18:05:45 MacBook-Pro-de-Fernando SpringBoard[16117]: [Common] could not find icon for representation -> com.apple.videos
Mar 7 18:05:45 MacBook-Pro-de-Fernando SpringBoard[16117]: [Common] could not find icon for representation -> com.apple.Home
Mar 7 18:05:45 MacBook-Pro-de-Fernando SpringBoard[16117]: [Common] could not find icon for representation -> com.apple.facetime
Mar 7 18:05:45 MacBook-Pro-de-Fernando SpringBoard[16117]: [Common] could not find icon for representation -> com.apple.calculator
Mar 7 18:05:45 MacBook-Pro-de-Fernando SpringBoard[16117]: [Common] could not find icon for representation -> com.apple.podcasts
Mar 7 18:05:45 MacBook-Pro-de-Fernando SpringBoard[16117]: [Common] could not find icon for representation -> com.apple.compass
Mar 7 18:05:45 MacBook-Pro-de-Fernando SpringBoard[16117]: [Common] could not find icon for representation -> com.apple.tips
Mar 7 18:05:45 MacBook-Pro-de-Fernando SpringBoard[16117]: [Common] could not find icon for representation -> com.apple.VoiceMemos
Mar 7 18:05:45 MacBook-Pro-de-Fernando SpringBoard[16117]: [Common] could not find icon for representation -> com.apple.mobileme.fmf1
Mar 7 18:05:45 MacBook-Pro-de-Fernando SpringBoard[16117]: [Common] could not find icon for representation -> com.apple.mobileme.fmip1
Mar 7 18:05:45 MacBook-Pro-de-Fernando SpringBoard[16117]: [Common] could not find icon for representation -> com.apple.mobilephone
Mar 7 18:05:45 MacBook-Pro-de-Fernando SpringBoard[16117]: [Common] could not find icon for representation -> com.apple.Music
Mar 7 18:05:49 MacBook-Pro-de-Fernando CoreSimulatorBridge[16127]: Pasteboard change listener callback port <NSMachPort: 0x7f90f9c15300> registered
Mar 7 18:05:49 MacBook-Pro-de-Fernando CoreSimulatorBridge[16127]: Requesting launch of com.ionicframework.speech267650 with options: {
environment = {
};
}
Mar 7 18:05:49 MacBook-Pro-de-Fernando CoreSimulatorBridge[16127]: Beginning launch sequence for bundle 'com.ionicframework.speech267650’
retryTimeout: 120.000000 (default write com.apple.CoreSimulatorBridge LaunchRetryTimeout )
bootTimeout: 300.000000 (default write com.apple.CoreSimulatorBridge BootRetryTimeout )
bootLeeway: 120.000000 (default write com.apple.CoreSimulatorBridge BootLeeway )
Note: Use 'xcrun simctl spawn booted defaults write ’ to modify defaults in the booted Simulator device.
Simulator booted at: 2017-03-06 20:55:56 +0000
Current time: 2017-03-07 21:05:49 +0000
Within boot leeway: NO
Mar 7 18:05:49 MacBook-Pro-de-Fernando CoreSimulatorBridge[16127]: Launch attempt #0 for bundle ‘com.ionicframework.speech267650’, have been trying to launch for 0 seconds. Modern launch services = YES
Mar 7 18:05:49 MacBook-Pro-de-Fernando CoreSimulatorBridge[16127]: Got LSBundleProxy for ‘com.ionicframework.speech267650’, sequenceNumber 276, cacheGUID 1B69163A-0509-468F-A9F9-F05A38686103
Mar 7 18:05:49 MacBook-Pro-de-Fernando CoreSimulatorBridge[16127]: [Common] [FBSSystemService][0x8867] Sending request to open "com.ionicframework.speech267650"
Mar 7 18:05:50 MacBook-Pro-de-Fernando CoreSimulatorBridge[16127]: [Common] [FBSSystemService][0x8867] Request successful: <FBSProcessHandle: 0x7f90f9c1b790; Speech:17836; valid: YES>
Mar 7 18:05:50 MacBook-Pro-de-Fernando CoreSimulatorBridge[16127]: Launch successful for 'com.ionicframework.speech267650’
Mar 7 18:05:50 MacBook-Pro-de-Fernando Speech[17836]: objc[17836]: Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x9a5e44c) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x97f6b78). One of the two will be used. Which one is undefined.
Mar 7 18:05:50 MacBook-Pro-de-Fernando logd[16112]: metadata shared cache uuid is null (cannot repair 32-bit info) Speech (17836)
Mar 7 18:05:50 MacBook-Pro-de-Fernando Speech[17836]: assertion failed: 15G31 14C89: libxpc.dylib + 68346 [F3AA3C03-1D97-3E2F-AB3C-5B679540170D]: 0x7d
Mar 7 18:05:50 MacBook-Pro-de-Fernando Speech[17836]: DiskCookieStorage changing policy from 2 to 0, cookie file: file:///Users/fmello/Library/Developer/CoreSimulator/Devices/6DA1FB4B-BA17-40EC-ADE9-B74C6247932D/data/Containers/Data/Application/32BFA1B2-A4D5-444D-B99C-2036156495AE/Library/Cookies/com.ionicframework.speech267650.binarycookies
Mar 7 18:05:50 MacBook-Pro-de-Fernando Speech[17836]: Apache Cordova native platform version 4.1.1 is starting.
Mar 7 18:05:50 MacBook-Pro-de-Fernando Speech[17836]: Multi-tasking -> Device: YES, App: YES
Mar 7 18:05:50 MacBook-Pro-de-Fernando Speech[17836]: Using UIWebView
Mar 7 18:05:50 MacBook-Pro-de-Fernando Speech[17836]: [CDVTimer][handleopenurl] 0.095010ms
Mar 7 18:05:50 MacBook-Pro-de-Fernando Speech[17836]: [CDVTimer][intentandnavigationfilter] 2.305984ms
Mar 7 18:05:50 MacBook-Pro-de-Fernando Speech[17836]: [CDVTimer][gesturehandler] 0.057995ms
Mar 7 18:05:50 MacBook-Pro-de-Fernando Speech[17836]: [CDVTimer][splashscreen] 20.819008ms
Mar 7 18:05:50 MacBook-Pro-de-Fernando Speech[17836]: [CDVTimer][statusbar] 8.687019ms
Mar 7 18:05:50 MacBook-Pro-de-Fernando Speech[17836]: [CDVTimer][keyboard] 1.273990ms
Mar 7 18:05:50 MacBook-Pro-de-Fernando Speech[17836]: [CDVTimer][TotalPluginStartup] 34.843981ms
Mar 7 18:05:51 MacBook-Pro-de-Fernando Speech[17836]: Resetting plugins due to page load.
Mar 7 18:05:52 MacBook-Pro-de-Fernando Speech[17836]: Finished load of: file:///Users/fmello/Library/Developer/CoreSimulator/Devices/6DA1FB4B-BA17-40EC-ADE9-B74C6247932D/data/Containers/Bundle/Application/8EC908D5-9257-4F22-AC54-25C01C660B93/Speech.app/www/index.html
Mar 7 18:05:52 MacBook-Pro-de-Fernando Speech[17836]: DEVICE READY FIRED AFTER 1126 ms

So that means then text to speech never ran. You should probably wrap that in a platform ready. Also, strange that it would say cordova not found in the browser console when running it in an emulator. Cordova should be available when running in an emulator. That sounds like a problem.