Update README.md

This commit is contained in:
__Rylex__
2024-01-20 12:08:20 -08:00
committed by GitHub
parent 2a426b983c
commit 6bc5f4061d

View File

@@ -39,17 +39,36 @@
- ***Cross-Origin-Opener-Policy*** ---> ***same-origin*** - ***Cross-Origin-Opener-Policy*** ---> ***same-origin***
### If you can't set these headers, you can use a VERY HACKY workaround at *src/addCOI.js*. ### If you can't set these headers, you can use a VERY HACKY workaround at *src/addCOI.js*.
## Usage ## Demo
``` ```
<!--Load this from a script tag--> <!--Load this from a script tag-->
<script src="BrowserRecognizer.js"></script> <script src="BrowserRecognizer.js" type="module"></script>
<!--> <!-->
<script> <script>
// Choose a nice, non-conflicting name for the module // Select name
const BrRec = await loadBR() const BrRec = await loadBR()
// Prepare // Prepare
const model = BrRec.makeModel() const model = await BrRec.makeModel(")
const spkmodel = BrRec. const recognizer = await BrRec.makeRecognizer(model)
recognizer.addEventListener("result", e => {
console.log("Result: ",e.details)
}
recognizer.addEventListener("partialResult", e => {
console.log("Partial result: ",e.details)
}
// Recognize
media = await navigator.mediaDevices.getUserMedia({
video: false,
audio: {
echoCancellation: true,
noiseSuppression: true,
channelCount: 1,
sampleRate: 16000
},
});
</script> </script>
``` ```