pravinkumarputta / cordova-plugin-speech Goto Github PK
View Code? Open in Web Editor NEWcordova-plugin-speech
cordova-plugin-speech
Hi Pravin,
I have implemented the Speech framework in my Cordova App and it didn't ask the NSSpeechRecognitionUsageDescription permission on iOS real device also the speechRecognizer variable comes nil because of an optional:
@objc(startRecognition:) // Declare your function name. func startRecognition(command: CDVInvokedUrlCommand) { if !self.**speechRecognizer!**.isAvailable { self.publishSTTError(error: "Speech recognition service not available") return }
PS: I am using Xcode 13.2.
Could anyone can help me out for the above mentioned query?
Thanks in advance!
I fixed it by replacing Line 46
let language = options && options.language ? options.language : 'en-US' // Line 46
with the following codes
if (typeof Speech.__currentSpeakOutSuccess == 'function') {
success('tts-end')
return
}
Speech.__currentSpeakOutSuccess = onMessage
exec(onMessage, error, SPEECH, API_LIST.SPEAK_OUT, [message, pitchRate, speechRate, language])
function onMessage (msg) {
if (msg == 'tts-end') delete Speech.__currentSpeakOutSuccess
success(msg)
}
App Store Connect doesn't accept Swift 3 architect anymore. Could you please upgrade the codes?
While this doesn't seem officialy documented as of now, from my testing on Android 10 and above devices when using
recognizerIntent.putExtra(RecognizerIntent.EXTRA_PREFER_OFFLINE, true);
I get the following error log : Error parsing intent: EXTRA_PREFER_OFFLINE parameter is deprecated
and speech recognition fails immediatly returning SpeechRecognizer.ERROR_NO_MATCH
.
Note that offline speech recognition appears to work fine when not using EXTRA_PREFER_OFFLINE
.
Is it possible to halt currently-speaking words?
Perhaps calling speakOut() again before TTS has ended would cut off current speech, or...
Thanks!
I found the language property is not passed to the native codes. I fixed it with the following changes.
Speech.js
let language = options && options.language ? options.language : 'en-US' // Line 45
exec(success, error, SPEECH, API_LIST.SPEAK_OUT, [message, pitchRate, speechRate, language]) // Line 46
Speech.swift
var language = command.arguments[3] as? String ?? "en-US" // Line 92
speechUtterance.voice = AVSpeechSynthesisVoice(language: language) / Line 99
Speech.java
Speech.this.speak(message, pitchRate, speechRate, language); // Line 179
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.