-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
67 lines (49 loc) · 1.8 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
58
59
60
61
62
63
64
65
66
67
---
title: "SourceBuffer: removeAsync() method"
short-title: removeAsync()
slug: Web/API/SourceBuffer/removeAsync
page-type: web-api-instance-method
status:
- experimental
- non-standard
browser-compat: api.SourceBuffer.removeAsync
---
{{APIRef("Media Source Extensions")}}{{Non-standard_Header}}{{SeeCompatTable}}
The **`removeAsync()`** method of the
{{domxref("SourceBuffer")}} interface starts the process of asynchronously removing
from the `SourceBuffer` media segments found within a specific time
range. A {{jsxref("Promise")}} is returned, which is fulfilled when the buffers
in the specified time range have been removed.
This method can only be called when {{domxref("SourceBuffer.updating", "updating")}} is
`false`. If that's not the case, call {{domxref("SourceBuffer.abort", "abort()")}} instead.
## Syntax
```js-nolint
removeAsync(start, end)
```
### Parameters
- `start`
- : A double representing the start of the time range, in seconds.
- `end`
- : A double representing the end of the time range, in seconds.
### Return value
A {{jsxref("Promise")}} whose fulfillment handler is executed once the buffers in the
specified time range have been removed from the `SourceBuffer`.
## Examples
This example establishes an asynchronous function, `emptySourceBuffer()`,
which clears the contents of the specified `SourceBuffer`.
```js
async function emptySourceBuffer(msBuffer) {
await msBuffer.removeAsync(0, Infinity).catch((e) => {
handleException(e);
});
}
```
## Specifications
This feature is not part of any specification. It is not on track to become a standard.
## Browser compatibility
{{Compat}}
## See also
- [Media Source Extensions API](/en-US/docs/Web/API/Media_Source_Extensions_API)
- {{domxref("SourceBuffer.remove()")}}
- {{domxref("MediaSource")}}
- {{domxref("SourceBufferList")}}