Git Product home page Git Product logo

speech-input's Introduction

speech-input

Simple speech input for <input> and <textarea> elements — replaces the now defunct x-webkit-speech attribute

Use:

  1. Include speech-input.css and speech-input.js
  2. Add a speech-input class to your <input> or <textarea>

And you're done! Here's a demo:

speech-input demo

Extra options

Other languages

It uses the value of the lang attribute on the <html> element by default. But you can override this by specifying a lang attribute on the input fields themselves. You may then also want to customize the "Speak now" text for that language with a data-ready attribute on that field:

<input type="text" class="speech-input" lang="es" data-ready="Habla ahora">

Button size

If, for any reason, you want to change the button size, you can use the data-buttonsize attribute:

<input type="text" class="speech-input" data-buttonsize="20">

Speech time limit

By default, it will wait a full 6 seconds after you finish speaking until it stops listening. You can change this time with the data-patience attribute:

<input type="text" class="speech-input" data-patience="2">

Submit when done

If you add the data-instant-submit attribute, the form that the input is in will automatically be submitted after listening stops:

<input type="text" class="speech-input" data-instant-submit>

FAQ

Why does it keep asking me to allow the microphone?

To have the microphone permissions persist, use https: http://stackoverflow.com/a/15999940/552067

I clicked the mic button but it didn't do anything.

Make sure you're using it on an actual server — it won't work on a file:// URL. Try starting up a simple static HTTP server.

Can I use this in non-webkit browsers?

Not yet.

speech-input's People

Contributors

daniel-hug avatar ebidel avatar gshires avatar konnng-dev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

speech-input's Issues

Does not work with bootstrap-wysihtml5 inputs

Great script, Thanks for the code. I ran into an issue when speech-input class is applied to an input that also has the "textarea_editor" class (bootstrap-wysihtml5 html editor) no text is visually appended to the input.

Enter engages mic again

when using a single input field, enter engages the mic again. Click should engage mic, enter should submit form

Train new words

First of all, this is terrific and is very helpful. But is there a way we can train new words, especially Nouns?

Handle prefilled input value

Consider following scenario with instant-submit option enabled:

  1. User inputs a search query and the page reloads to show search results.
  2. On the loaded page the search field is prefilled with the current search query.
  3. User clicks mic button to enter a new query.
  4. Case 1: Chrome blocks device access.
    • Expected behavior: nothing happens.
    • Actual behavior: the auto-submit feature submits the form, and the page is reloaded.
  5. Case 2: mic access is granted successfully.
    • Expected behavior: the input is cleared before the recognition starts.
    • Actual behavior: the new (recognized) query is appended to the previous one, and the search starts with the concatenation, providing incoherent results.

Problems on Android Tablet

When testing on an android tablet the module works but it having problems when insert the speech into the input or textarea.

It repeats each word several times

speecherror

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.