admin管理员组文章数量:1415664
I have created a Speech Recognition site following the API: / . The site works in Chrome but not in Safari.
This makes sense: Based on the browser support details: , (speech to text is currently limited to Chrome for Desktop and Android.)
But doesn’t make sense based on: The last link, claims there is support.
I am confused, does Safari offer support or not?
The error I get from Safari is: Speech recognition error detected: service-not-allowed
What does this error mean?
service-not-allowed
The user agent disallowed the requested speech recognition service, either because the user agent doesn't support it or because of reasons of security, privacy or user preference. In this case it would allow another more suitable speech recognition service to be used instead.
I tried giving explicit permission for the mic, in the Safari settings and in my puter settings. Didn’t work. I don’t know how to give explicit permission to safari for speech recognition. It should ask for permission, but it doesn’t.
Does anyone have any advice on how to proceed to get speech recognition to work on Safari?
This is the code:
var recognition = new speechRecognition()
var textBox = $("#textbox")
var instructions = $("#instructions")
var cont = ''
recognition.continuous = true
// Recognition started
recognition.onstart = function () {
instructions.text("Voice recognition is on")
}
recognition.onspeechend = function () {
instructions.text("No speech detected")
}
recognition.onerror = function (event) {
instructions.text('Speech recognition error detected: ' + event.error)
}
recognition.onresult = function (event) {
var current = event.resultIndex;
var transcript = event.results[current][0].transcript;
cont += transcript
textBox.val(cont)
}
$("#start-btn").click(function (event) {
if(cont.length){
cont += ''
}
recognition.start()
})```
I created this based on this tutorial:
I have created a Speech Recognition site following the API: https://wicg.github.io/speech-api/ . The site works in Chrome but not in Safari.
This makes sense: Based on the browser support details: https://developer.mozilla/en-US/docs/Web/API/Web_Speech_API/Using_the_Web_Speech_API#browser_support, (speech to text is currently limited to Chrome for Desktop and Android.)
But doesn’t make sense based on: https://developer.mozilla/en-US/docs/Web/API/SpeechRecognition#browser_patibility The last link, claims there is support.
I am confused, does Safari offer support or not?
The error I get from Safari is: Speech recognition error detected: service-not-allowed
What does this error mean?
service-not-allowed
The user agent disallowed the requested speech recognition service, either because the user agent doesn't support it or because of reasons of security, privacy or user preference. In this case it would allow another more suitable speech recognition service to be used instead.
https://developer.mozilla/en-US/docs/Web/API/SpeechRecognitionErrorEvent/error
I tried giving explicit permission for the mic, in the Safari settings and in my puter settings. Didn’t work. I don’t know how to give explicit permission to safari for speech recognition. It should ask for permission, but it doesn’t.
Does anyone have any advice on how to proceed to get speech recognition to work on Safari?
This is the code:
var recognition = new speechRecognition()
var textBox = $("#textbox")
var instructions = $("#instructions")
var cont = ''
recognition.continuous = true
// Recognition started
recognition.onstart = function () {
instructions.text("Voice recognition is on")
}
recognition.onspeechend = function () {
instructions.text("No speech detected")
}
recognition.onerror = function (event) {
instructions.text('Speech recognition error detected: ' + event.error)
}
recognition.onresult = function (event) {
var current = event.resultIndex;
var transcript = event.results[current][0].transcript;
cont += transcript
textBox.val(cont)
}
$("#start-btn").click(function (event) {
if(cont.length){
cont += ''
}
recognition.start()
})```
I created this based on this tutorial: https://www.youtube./watch?v=rwB6RqqCmXc
Share
Improve this question
asked Sep 7, 2021 at 4:26
Raisa MenesesRaisa Meneses
811 silver badge7 bronze badges
2 Answers
Reset to default 3I figured this out. For Safari, users need to enable dictation for speech to text to work. Details can be found here: https://bugs.webkit/show_bug.cgi?id=225298
Did you make sure you have an SSL certificate set up on the site? Sometimes the browser might block access to the microphone if it is not on a secure connection.
Now if this is a local site you can use a Self-Signed SSL certificate as a workaround if this isn't published.
本文标签: javascriptSpeech Recognition SafariStack Overflow
版权声明:本文标题:javascript - Speech Recognition Safari - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745205187a2647606.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论