blob: 26b475b1269c951cc61766a07fe8a331b4b0ac5a (
plain)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
---
title: suspend
slug: Web/API/OfflineAudioContext/suspend
translation_of: Web/API/OfflineAudioContext/suspend
---
<p>{{ APIRef("Web Audio API") }}</p>
<p>The <strong><code>suspend()</code></strong> method of the {{ domxref("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.</p>
<p>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.</p>
<h2 id="语法">语法</h2>
<pre class="syntaxbox">OfflineAudioContext.suspend(<em>suspendTime</em>).then(function() { ... });</pre>
<h3 id="参数">参数</h3>
<dl>
<dt>暂停时间</dt>
<dd>A {{jsxref("double")}} 指定暂停的时间.</dd>
</dl>
<h3 id="返回值">返回值</h3>
<p>A {{jsxref("Promise")}} resolving to void.</p>
<h3 id="异常">异常</h3>
<p>发生任何异常,promise就会拒绝.</p>
<p>如果帧数出现下列情况,就会抛出错误{{exception("InvalidStateError")}}:</p>
<ul>
<li>一个负值</li>
<li>小于或等于当前时间</li>
<li>大于或等于渲染的总渲染时间</li>
<li>is scheduled by another suspend for the same time</li>
</ul>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
<tr>
<td>{{SpecName('Web Audio API', '#widl-OfflineAudioContext-suspend-Promise-void--double-suspendTime', 'suspend()')}}</td>
<td>{{Spec2('Web Audio API')}}</td>
<td>Initial definition.</td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<div>{{CompatibilityTable}}</div>
<div id="compat-desktop">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Chrome</th>
<th>Firefox (Gecko)</th>
<th>Internet Explorer</th>
<th>Opera</th>
<th>Safari (WebKit)</th>
</tr>
<tr>
<td>Basic support</td>
<td>{{CompatChrome(49.0)}}</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
</div>
<div id="compat-mobile">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Android</th>
<th>Android Webview</th>
<th>Firefox Mobile (Gecko)</th>
<th>Firefox OS</th>
<th>IE Mobile</th>
<th>Opera Mobile</th>
<th>Safari Mobile</th>
<th>Chrome for Android</th>
</tr>
<tr>
<td>Basic support</td>
<td>{{CompatNo}}</td>
<td>{{CompatChrome(49.0)}}</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td>{{CompatChrome(49.0)}}</td>
</tr>
</tbody>
</table>
</div>
|