Get started with annyang CDN

MIT licensed

Annyang is a library for creating voice command applications in the browser.

Tags:
  • annyang
  • annyang.js
  • speechrecognition
  • webkitspeechrecognition
  • voice
  • speech
  • recognition

Stable version

Copied!

How to start using annyang CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with annyang CDN - cdnhub.io</title>
  <style>
    body { text-align: center; }
  </style>
  <script src="https://cdn.jsdelivr.net/npm/annyang/dist/annyang.min.js"></script>
</head>
<body>
  <button id="start">Start</button>
  <script>
    const commands = {
      'hello annyang': function() { console.log('Hello Annyang!'); },
      'what is your name': function() { console.log('I am Annyang, your voice command assistant.'); }
    };

    const hotwords = ['annyang'];

    const myVoiceController = new Annyang(commands, hotwords);
    myVoiceController.start();

    document.getElementById('start').addEventListener('click', () => {
      myVoiceController.startListening();
    });

    document.getElementById('start').addEventListener('click', () => {
      myVoiceController.stopListening();
    });
  </script>
</body>
</html>
Copied!
Copied!
Copied!

All versions