javascript - Speech Recognition Safari - Stack Overflow

I have created a Speech Recognition site following the API: . The site works in Chrome but not in Sa

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
Add a ment  | 

2 Answers 2

Reset to default 3

I 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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745205187a4616560.html

相关推荐

  • javascript - Speech Recognition Safari - Stack Overflow

    I have created a Speech Recognition site following the API: . The site works in Chrome but not in Sa

    7小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信