The suspend() method of the OfflineAudioContext interface schedules a suspension of the time progression in the audio context at the specified time and returns a promise. This is generally useful at the time of manipulating the audio graph synchronously on OfflineAudioContext.
Note that the maximum precision of suspension is the size of the render quantum and the specified suspension time will be rounded down to the nearest render quantum boundary. For this reason, it is not allowed to schedule multiple suspends at the same quantized frame. Also scheduling should be done while the context is not running to ensure the precise suspension.
Syntax
OfflineAudioContext.suspend(suspendTime).then(function() { ... });
Parameters
- suspendTime
- A
doublespecifying the suspend time, in seconds.
Returns
A Promise resolving to void.
Exceptions
The promise is rejected when any exception is encountered.
InvalidStateError if the quantized frame number is one of the following:
- a negative number
- is less than or equal to the current time
- is greater than or equal to the total render duration
- is scheduled by another suspend for the same time
Specifications
| Specification | Status | Comment |
| Web Audio APIThe definition of 'suspend()' in that specification. | Working Draft | Initial definition. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
suspend
|
Chrome
Full support 49 |
Edge
Full support ≤18 |
Firefox
No support No |
IE
No support No |
Opera
Full support 36 |
Safari
No support No |
WebView Android
Full support 49 |
Chrome Android
Full support 49 |
Firefox Android
No support No |
Opera Android
Full support 36 |
Safari iOS
No support No |
Samsung Internet Android
Full support 5.0 |
Legend
- Full support
- Full support
- No support
- No support
OfflineAudioContext.suspend() by Mozilla Contributors is licensed under CC-BY-SA 2.5.