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
|
---
title: AudioScheduledSourceNode
slug: Web/API/AudioScheduledSourceNode
tags:
- API
- Audio
- AudioScheduledSourceNode
- Interface
- Media
- NeedsTranslation
- Reference
- TopicStub
- Web Audio API
- sound
translation_of: Web/API/AudioScheduledSourceNode
---
<div>{{APIRef("Web Audio API")}}</div>
<p><code>AudioScheduledSourceNode</code> 接口作为web音频API的一部分,是几种具有在特定时刻开始与停止能力的音频源节点接口的父接口。更具体地来说,这个接口定义了{{domxref("AudioScheduledSourceNode.start", "start()")}} 和{{domxref("AudioScheduledSourceNode.stop", "stop()")}} 方法,以及{{domxref("AudioScheduledSourceNode.onended", "onended")}}事件</p>
<div class="note">
<p>你不能直接创建<code>AudioScheduledSourceNode</code>。而是应该使用继承于它的子接口,如{{domxref("AudioBufferSourceNode")}}, {{domxref("OscillatorNode")}}和{{domxref("ConstantSourceNode")}}.</p>
</div>
<p>除非另有说明,基于<code>AudioScheduledSourceNode</code>节点的输出在没有播放时处于静默状态(这种状态在start()之前与stop()之后调用)。静默状态总是由一个全0值流组成。</p>
<h2 id="Properties">Properties</h2>
<p><em>Inherits properties from its parent interface, {{domxref("AudioNode")}}, and adds the following properties:</em></p>
<h3 id="Event_handlers">Event handlers</h3>
<dl>
<dt>{{domxref("AudioScheduledSourceNode.onended", "onended")}}</dt>
<dd>A function to be called when the {{event("ended")}} event is fired, indicating that the node has finished playing.</dd>
</dl>
<h2 id="Methods">Methods</h2>
<p><em>Inherits methods from its parent interface, {{domxref("AudioNode")}}, and adds the following methods:</em></p>
<dl>
<dt>{{domxref("AudioScheduledSourceNode.start", "start()")}}</dt>
<dd>Schedules the node to begin playing the constant sound at the specified time. If no time is specified, the node begins playing immediately.</dd>
<dt>{{domxref("AudioScheduledSourceNode.stop", "stop()")}}</dt>
<dd>Schedules the node to stop playing at the specified time. If no time is specified, the node stops playing at once.</dd>
</dl>
<h2 id="Specification">Specification</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', '#idl-def-AudioScheduledSourceNode', 'AudioScheduledSourceNode')}}</td>
<td>{{Spec2('Web Audio API')}}</td>
<td></td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<div>
<p>{{Compat("api.AudioScheduledSourceNode")}}</p>
</div>
<h2 id="See_also">See also</h2>
<ul>
<li><a href="/en-US/docs/Web/API/Web_Audio_API/Using_Web_Audio_API">Using the Web Audio API</a></li>
<li>{{domxref("AudioNode")}}</li>
</ul>
|