Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 2.72 KB

File metadata and controls

43 lines (30 loc) · 2.72 KB

Quickstart: Recognize speech in JavaScript on a Web Browser.

This sample demonstrates how to recognize speech with the Speech SDK for JavaScript on a web browser, like Microsoft Edge, or Chrome. See the accompanying article on the SDK documentation page which describes how to build this sample from scratch in your favourite editor.

Prerequisites

  • A subscription key for the Speech service. See Try the speech service for free.
  • A PC or Mac, with a working microphone.
  • A text editor.
  • Optionally, a web server that supports hosting PHP scripts.

Build the sample

Note: more detailed step-by-step instructions are available here.

If you want to host the sample on a web server:

  • Edit the token.php source:
    • Replace the string YourServiceRegion with the service region of your subscription. For example, replace with westus if you are using the 30-day free trial subscription.
    • Replace the string YourSubscriptionKey with your own subscription key.
  • Edit the index.html source:
    • Replace the value for the variable authorizationEndpoint with the full URL where you can access the token.php resource.
  • Deploy all files to your web server.

Run the sample

  • In case you are running the sample from your local computer, open index.html from the location where you have downloaded this quickstart with a JavaScript capable browser. Use the input fields to set your subscription key and service region.
  • In case you are hosting the sample on a web server, open a web browser and navigate to the full URL where you host the sample.

Note: On Safari, the sample web page needs to be hosted on a web server; Safari doesn't allow websites loaded from a local file to use the microphone.

References