-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
57 lines (37 loc) · 1.29 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
title: "SpeechRecognition: audiostart event"
short-title: audiostart
slug: Web/API/SpeechRecognition/audiostart_event
page-type: web-api-event
browser-compat: api.SpeechRecognition.audiostart_event
---
{{APIRef("Web Speech API")}}
The **`audiostart`** event of the [Web Speech API](/en-US/docs/Web/API/Web_Speech_API) is fired when the user agent has started to capture audio for speech recognition.
## Syntax
Use the event name in methods like {{domxref("EventTarget.addEventListener", "addEventListener()")}}, or set an event handler property.
```js
addEventListener("audiostart", (event) => {});
onaudiostart = (event) => {};
```
## Event type
A generic {{DOMxRef("Event")}} with no added properties.
## Examples
You can use the `audiostart` event in an [`addEventListener`](/en-US/docs/Web/API/EventTarget/addEventListener) method:
```js
const recognition = new webkitSpeechRecognition() || new SpeechRecognition();
recognition.addEventListener("audiostart", () => {
console.log("Audio capturing started");
});
```
Or use the `onaudiostart` event handler property:
```js
recognition.onaudiostart = () => {
console.log("Audio capturing started");
};
```
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- [Web Speech API](/en-US/docs/Web/API/Web_Speech_API)