Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web speech Api not working in chrome browser in android device #25794

Closed
janaki112 opened this issue Jan 24, 2025 · 8 comments · Fixed by #25878
Closed

Web speech Api not working in chrome browser in android device #25794

janaki112 opened this issue Jan 24, 2025 · 8 comments · Fixed by #25878
Labels
needs triage This issue needs to be confirmed

Comments

@janaki112
Copy link

What information was incorrect, unhelpful, or incomplete?

In android chrome browser , after turning on the microphone for detection , after 2 seconds or even less microphone is switching off and even after turning on , it's not working as expected. It's happening in the demo page also https://www.google.com/intl/en/chrome/demos/speech.html

Only in android chrome this issue is coming . Ios , mac , windows every where else it's working fine.

What did you expect to see?

Seamlessly detection should happen in the android device chrome browser .

Do you have any supporting links, references, or citations?

https://www.google.com/intl/en/chrome/demos/speech.html

Do you have anything more you want to share?

No response

@janaki112 janaki112 added the needs triage This issue needs to be confirmed label Jan 24, 2025
@caugner
Copy link
Contributor

caugner commented Jan 27, 2025

@janaki112 Can you share what Chrome version you're using, both on Desktop and Mobile?

I just tried https://mdn.github.io/dom-examples/web-speech-api/speech-color-changer/ in Chrome 132, and the example was working as expected.

@janaki112
Copy link
Author

janaki112 commented Jan 28, 2025

Hi @caugner , I'm using OnePlus Pad Go tablet in chrome browser , I integrated webspeech in angular and started speech detection , mic is turning off even before I stop , but the same implementation is working windows laptop , macbooks and ipads. Can you check the behaviour - https://www.google.com/intl/en/chrome/demos/speech.html . Below attached file contains chrome and android version in the code. If I give a pause web speech microphone is stopping but whereas in other devices it's not stopping.

In desktop - Chrome Version 132.0.6834.111 (Official Build) (arm64)
Android - Chrome 132.0.6834.122

And I found an issue in stack overflow -https://stackoverflow.com/questions/42134899/webkitspeechrecognition-on-android-chrome and work around provided here in the stackoverflow link it's not working.

const { webkitSpeechRecognition, SpeechRecognition } = window as any;
    if ('webkitSpeechRecognition' in window || 'SpeechRecognition' in window) {
      this.recognition = new (webkitSpeechRecognition || SpeechRecognition)();
      this.recognition.lang = 'en-US';
      this.recognition.continuous = true;
      this.recognition.interimResults = true;
      this.recognition.mode="ondevice-preferred";
      this.recognition.onstart = (event: any) => {
        console.log(this.recognition);
      };
      this.recognition.onerror=(event: any) => {
        console.log("error",event);
      }
      this.recognition.onnomatch = (event: any) => {
        console.log("no match",event);

      }
      this.recognition.onspeechend = (event: any) => {
        console.log("speech end",event);
      }
      this.recognition.onspeechstart=(event:any)=>{
        console.log(event,"speech started");
      };
      this.recognition.onresult = (event: any) => {
        const data :any= Array.from(event.results);
        console.log(data);
        console.log(data.length);
       const transcript=(data[data.length-1][0].transcript);
        console.log(transcript);
        
      };
    

      this.recognition.onend = (event:any) => {
        // this.startListening();
        console.log("end",event);


          event.results=[];
          
      };
    } else {
      console.error('SpeechRecognition API not supported in this browser.');
    }

Image

@caugner
Copy link
Contributor

caugner commented Jan 28, 2025

@janaki112 Thank you, can you check if this Chromium issue sounds like the issue you're experiencing, and if Web Speech without continuous works for you?

Meanwhile, I will transfer this over to BCD.

@caugner caugner transferred this issue from mdn/dom-examples Jan 28, 2025
@janaki112
Copy link
Author

Yeah @caugner , it's the same issue , without continuous means by setting it to false, If I set continuous to false , microphone is turning off after a pause while I was speaking.

@janaki112
Copy link
Author

Hey @caugner ,any update on this?

@caugner
Copy link
Contributor

caugner commented Feb 7, 2025

Thanks for your patience, I opened #25878 to fix this.

@janaki112
Copy link
Author

Hey @caugner thanks for the update , #25878 this is showing as completed can I assume this as fixed ?

@caugner
Copy link
Contributor

caugner commented Feb 7, 2025

The change should be reflected in the browser compatibility tables on MDN within the next hours.

Please note that this doesn't mean that the bug is fixed in Chrome Android. That is tracked in Chrome's bug tracker: https://issues.chromium.org/issues/41297427

We have no influence on when the issue will actually be fixed, but please do let us know when that happens, so that we can update the BCD table again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage This issue needs to be confirmed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants