GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Not able to import in React.js | Not sure if browser support is available as no documentation about it · Issue #280 · GoogleCloudPlatform/nodejs-docs-samples

Not able to import in React.js | Not sure if browser support is available as no documentation about it #280

New issue
Copy link
New issue
Copy link
Closed
Closed
Not able to import in React.js | Not sure if browser support is available as no documentation about it#280
Copy link
Labels
🚨This issue needs some love.triage meI really want to be triaged.

Description

@gajendra93
gajendra93
opened on Dec 21, 2016
Issue body actions

Hi

I am referring this sample to use the Speech APIs in my React.js application

below is what i am trying to do


import Speech from '@google-cloud/speech';
import record from 'node-record-lpcm16';

const speech = Speech();
		const options = {
		    config: {
		      	// Configure these settings based on the audio you're transcribing
		      	encoding: 'LINEAR16',
		      	sampleRate: 16000
		    }
		};

		// Create a recognize stream
		const recognizeStream = speech.createRecognizeStream(options)
		    .on('error', console.error)
		    .on('data', (data) => process.stdout.write(data.results));

	  	// Start recording and send the microphone input to the Speech API
	  	record.start({ sampleRate: 16000 }).pipe(recognizeStream);

But this fails to instantiate the Speech object

Am i missing something or there is something which is not documented for use in React.js/Angular.js?

Activity

  1. jmdobry commented on Dec 21, 2016

    @jmdobry
    jmdobry
    on Dec 21, 2016
    Member
    More actions

    Is your application something that runs in the browser or on the server (via Node.js)? The samples in this repository only run on the server.

  2. rajiff commented on Dec 21, 2016

    @rajiff
    rajiff
    on Dec 21, 2016
    More actions

    @jmdobry it Brunson browser compiled using web pack on server for bundling

    Can you suggest any alternative for using on browser or how we can change it, we can try change and create a pull request

  3. jmdobry commented on Dec 22, 2016

    @jmdobry
    jmdobry
    on Dec 22, 2016
    Member
    More actions

    You can manually make an HTTP request to the Google Cloud Speech API from the browser. You'll need an API Key to authenticate. With Angular 1.x, it might be something like:

    $http({
      method: 'POST',
      url: 'https://speech.googleapis.com/v1beta1/speech:syncrecognize',
      params: {
        key: 'YOUR_API_KEY'
      },
      data: {
        config: {
          encoding: 'LINEAR16', // customize for your audio
          sampleRate: 16000 // customize for your audio
        },
        audio: {
          content: 'as0af8s7d0fa9sd7f=' // base64-encoded string of the content of your audio file
          // or if your audio file is in Google Cloud Storage, "uri" instead:
          // uri: 'gs://your-bucket/your-audio-file'
        }
      }
    }).then(...);

    I don't have a bigger example to give you at the moment, but when I do I'll post back here.

  4. rajiff commented on Dec 23, 2016

    @rajiff
    rajiff
    on Dec 23, 2016
    More actions

    Nice, only worry is, this will expose API key over browser, need to check

  5. jmdobry commented on Aug 21, 2017

    @jmdobry
    jmdobry
    on Aug 21, 2017
    Member
    More actions

    That is the concern. We generally expect there to be a proxy between the browser and the Speech API, such as your own backend server.

  6. jmdobry
    closed this as completedon Aug 21, 2017
  7. yoshi-automation
    added
    🚨This issue needs some love.
    triage meI really want to be triaged.
    on Apr 6, 2020
  8. grayside
    added a commit that references this issue on Oct 26, 2022

    refactor: simplify cloud_tasks_create_http_task_with_token (#280)

    7b2eb7b
  9. ivanmkc
    added a commit that references this issue on Nov 3, 2022

    chore: release 2.2.2 (#280)

    ec62f5b
  10. grayside
    added 2 commits that reference this issue on Nov 3, 2022

    refactor: simplify cloud_tasks_create_http_task_with_token (#280)

    9479853

    chore: release 2.2.2 (#280)

    d540fd7
  11. ahrarmonsur
    added 2 commits that reference this issue on Nov 16, 2022

    chore: release 3.0.0 (#280)

    5561250

    chore: release 3.0.0 (#280)

    d0b7150
  12. ace-n
    added a commit that references this issue on Nov 16, 2022

    chore: release 2.2.2 (#280)

    5a30527
  13. ahrarmonsur
    added 3 commits that reference this issue on Nov 16, 2022

    chore: release 3.0.0 (#280)

    86842fa

    chore: release 3.0.0 (#280)

    1579d48

    chore: release 3.0.0 (#280)

    a222192
  14. telpirion
    added a commit that references this issue on Nov 16, 2022

    ProductSearch GA (#280)

    4f1ec49
  15. ace-n
    added 2 commits that reference this issue on Nov 17, 2022

    chore: release 2.2.2 (#280)

    ad6d95a

    chore: release 3.0.0 (#280)

    2a5aec2
  16. ahrarmonsur
    added 3 commits that reference this issue on Nov 17, 2022

    chore: release 2.2.2 (#280)

    72f0a96

    fix(deps): update dependency yargs to v13 (#280)

    9ddf650

    fix(deps): update dependency yargs to v13 (#280)

    c5dcc84
  17. NimJay
    added a commit that references this issue on Nov 18, 2022

    fix(deps): update dependency yargs to v13 (#280)

    077971b
  18. ahrarmonsur
    added a commit that references this issue on Nov 18, 2022

    chore: release 3.8.1 (#280)

    db4ad1c
  19. pattishin
    added a commit that references this issue on Nov 18, 2022

    chore(main): release 1.19.0 (#281)

    f37ce35
  20. NimJay
    added 2 commits that reference this issue on Nov 19, 2022

    fix: overhauled quickstart (#280)

    3e734c9

    fix: overhauled quickstart (#280)

    4165794
  21. pattishin
    added a commit that references this issue on Nov 22, 2022

    chore(main): release 1.19.0 (#281)

    4dc10a9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🚨This issue needs some love.triage meI really want to be triaged.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.