janco
janco

Reputation: 13

Is it possible to integrate the Speech-To-Text API from Google into my website

I'm trying to find a documentation to integrate the Speech-To-Text API into my Website.

With exact that use-case, filling a textarea via voice input

but it doesn't seem to work - only finding ways to integrate it into applications

I tried to authenticate via this snippet

function initGoogleApi() {
  gapi.load('client:auth2', function() {
    gapi.client.init({
      apiKey: 'YOUR_API_KEY',
      clientId: 'YOUR_CLIENT_ID.apps.googleusercontent.com',
      discoveryDocs: ['https://speech.googleapis.com/$discovery/rest?version=v1'],
      scope: 'https://www.googleapis.com/auth/cloud-platform'
    }).then(function() 
    }).catch(function(error) {
    });
  });
}

and added the form and JS from the Demo

Upvotes: 0

Views: 52

Answers (1)

passThru
passThru

Reputation: 36

You don’t need Google for that! Speech recognition has existed in browsers for like 15 years now...

var recognition = new SpeechRecognition();

recognition.lang = 'en-US';

recognition.onstart =()=>{

 // some action

};

Reference...

https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition

Upvotes: 2

Related Questions