@@ -708,10 +708,12 @@ Each {{BaseAudioContext}} has a unique
708
708
media element event task source</a>.
709
709
Additionally, a {{BaseAudioContext}} has several private slots <dfn attribute
710
710
for="BaseAudioContext">[[rendering thread state]]</dfn> and <dfn attribute
711
- for="BaseAudioContext">[[control thread state]]</dfn> that take values from
712
- {{AudioContextState}}, and that are both initially set to <code>"suspended"
713
- </code>, and a private slot <dfn attribute for="BaseAudioContext">
714
- [[render quantum size]]</dfn> that is an unsigned integer.
711
+ for="BaseAudioContext">[[control thread state]]</dfn> that take values
712
+ from {{AudioContextState}}, and that are both initially set to <code>"suspended"
713
+ </code>, <dfn attribute for="BaseAudioContext">[[interrupt end return state]]
714
+ </dfn> that also take values from {{AudioContextState}} and is initially set to
715
+ `null` and a private slot <dfn attribute for="BaseAudioContext">[[render quantum
716
+ size]]</dfn> that is an unsigned integer.
715
717
716
718
<pre class="idl">
717
719
enum AudioContextState {
@@ -1549,6 +1551,8 @@ Constructors</h4>
1549
1551
1550
1552
1. Set a {{[[rendering thread state]]}} to <code>suspended</code> on
1551
1553
|context|.
1554
+
1555
+ 1. Set {{[[interrupt end return state]]}} to `null` on |context|.
1552
1556
1553
1557
1. Let |messageChannel| be a new {{MessageChannel}}.
1554
1558
@@ -1987,11 +1991,19 @@ Methods</h4>
1987
1991
1. If the {{[[control thread state]]}} on the {{AudioContext}} is
1988
1992
<code>suspended</code> and there is an ongoing
1989
1993
[=interruption=]:
1994
+
1995
+ 1. If the context's {{BaseAudioContext/state}} attribute is
1996
+ "{{AudioContextState/suspended}}" and the context's
1997
+ {{[[control thread state]]}} is
1998
+ "{{AudioContextState/interrupted}}", then:
1990
1999
1991
- 1. Queue a media element task</a> to execute the following steps:
2000
+ 1. <a> Queue a media element task</a> to execute the following steps:
1992
2001
1993
2002
1. Set the {{BaseAudioContext/state}} attribute of the
1994
2003
{{AudioContext}} to "{{AudioContextState/interrupted}}".
2004
+
2005
+ 1. Set the {{[[interrupt end return state]]}} slot to
2006
+ "{{AudioContextState/running}}".
1995
2007
1996
2008
1. [=Queue a media element task=] to [=fire an event=] named
1997
2009
{{BaseAudioContext/statechange}} at the {{AudioContext}}.
@@ -2104,14 +2116,19 @@ Methods</h4>
2104
2116
2105
2117
1. Attempt to <a>release system resources</a>.
2106
2118
2107
- 2. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to <code>suspended</code>.
2119
+ 1. If the {{[[rendering thread state]]}} on the {{AudioContext}} is
2120
+ "{{AudioContextState/interrupted}}", <a>queue a media element
2121
+ task</a> to set the {{[[interrupt end return state]]}} slot to
2122
+ "{{AudioContextState/suspended}}".
2108
2123
2109
- 3. <a href="https://html.spec.whatwg.org/multipage/media.html#queue-a-media-element-task">
2110
- queue a media element task</a> to execute the following steps:
2124
+ 1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to
2125
+ "{{AudioContextState/suspended}}".
2126
+
2127
+ 1. <a>Queue a media element task</a> to execute the following steps:
2111
2128
2112
2129
1. Resolve <em>promise</em>.
2113
2130
2114
- 2 . If the {{BaseAudioContext/state}}
2131
+ 1 . If the {{BaseAudioContext/state}}
2115
2132
attribute of the {{AudioContext}} is not already "{{AudioContextState/suspended}}":
2116
2133
2117
2134
1. Set the {{BaseAudioContext/state}} attribute of the {{AudioContext}} to "{{AudioContextState/suspended}}".
@@ -12121,70 +12138,69 @@ to halt audio playback for an {{AudioContext}}. For example, The user agent may
12121
12138
create an interruption when another application requests exclusive access to the
12122
12139
audio output hardware.
12123
12140
12124
- When an [=interruption=] happens, the user agent must <a>queue a control message</a>
12141
+ When an [=interruption=] happens, the user agent MUST <a>queue a control message</a>
12125
12142
to interrupt the {{AudioContext}}.
12126
12143
12127
12144
Running a <a>control message</a> to <dfn attribute for="AudioContext"
12128
12145
lt="interruption-start">interrupt an {{AudioContext}}</dfn> |context|
12129
12146
means running these steps on the <a>rendering thread</a>:
12130
12147
12131
- 1. If the |context|'s {{[[rendering thread state]]}} is <code>closed</code>
12132
- or <code>interrupted</code>:
12133
-
12134
- 1. Abort these steps.
12148
+ 1. If the |context|'s {{[[rendering thread state]]}} is
12149
+ {{AudioContextState/closed}} or {{AudioContextState/interrupted}}, abort
12150
+ these steps.
12135
12151
12136
12152
1. If the |context|'s {{[[rendering thread state]]}} is
12137
- <code>running</code> :
12153
+ {{AudioContextState/running}} :
12138
12154
12139
12155
1. Attempt to <a>release system resources</a>.
12140
12156
12141
12157
1. [=Queue a media element task=] to execute the following steps:
12142
12158
12143
12159
1. Set the |context|'s {{[[control thread state]]}} to
12144
- <code>interrupted</code>.
12160
+ {{AudioContextState/interrupted}}.
12161
+
12162
+ 1. Set the |context|'s {{[[interrupt end return state]]}} slot to
12163
+ "{{AudioContextState/running}}".
12145
12164
12146
12165
1. [=Fire an event=] named {{BaseAudioContext/statechange}} at the
12147
12166
|context|.
12148
12167
12149
12168
1. If the |context|'s {{[[rendering thread state]]}} is
12150
- <code>suspended</code> :
12169
+ {{AudioContextState/suspended}} :
12151
12170
12152
12171
1. [=Queue a media element task=] to execute the following steps:
12153
12172
12154
12173
1. Set the |context|'s {{[[control thread state]]}} to
12155
- <code>interrupted</code>.
12174
+ {{AudioContextState/interrupted}}.
12175
+
12176
+ 1. Set the |context|'s {{[[interrupt end return state]]}} slot to
12177
+ "{{AudioContextState/suspended}}".
12156
12178
12157
12179
1. Set the |context|'s {{[[rendering thread state]]}} to
12158
- <code>interrupted</code> .
12180
+ {{AudioContextState/interrupted}} .
12159
12181
12160
- Note: If the {{AudioContext}} is <code>suspended</code> a
12182
+ Note: If the {{AudioContext}} is {{AudioContextState/suspended}} a
12161
12183
{{BaseAudioContext/statechange}} event is not fired for privacy reasons to avoid
12162
12184
over-sharing user activity - e.g. when a phone call comes in or when the screen
12163
12185
gets locked.
12164
12186
12165
- When an [=interruption=] ends, the user agent must <a>queue a control message</a>
12187
+ When an [=interruption=] ends, the user agent MUST <a>queue a control message</a>
12166
12188
to <dfn attribute for="AudioContext" lt="interruption-end">end the
12167
12189
{{AudioContext}} interruption</dfn>.
12168
12190
12169
- <dfn lt="linear PCM">Linear pulse code modulation</dfn>
12170
-
12171
12191
Running a <a>control message</a> to end an {{AudioContext}} |context|
12172
12192
[=interruption=] means running these steps on the <a>rendering thread</a>:
12173
12193
12174
12194
1. If the |context|'s {{[[rendering thread state]]}} is not
12175
- <code>interrupted</code>:
12195
+ {{AudioContextState/interrupted}}, abort these steps.
12176
12196
12177
- 1. Abort these steps.
12178
-
12179
- 1. If the |context|'s {{[[rendering thread state]]}} was
12180
- <code>running</code> before the [=interruption=] or if the the
12181
- |context|'s {{[[rendering thread state]]}} was <code>suspended</code>
12182
- and {{AudioContext/resume}} was called during the [=interruption=]:
12197
+ 1. If the |context|'s {{[[interrupt end return state]]}} is
12198
+ "{{AudioContextState/running}}":
12183
12199
12184
12200
1. Attempt to <a href="#acquiring">acquire system resources</a>.
12185
12201
12186
12202
1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to
12187
- <code>running</code> .
12203
+ "{{AudioContextState/running}}" .
12188
12204
12189
12205
1. Start <a href="#rendering-loop">rendering the audio graph</a>.
12190
12206
@@ -12194,13 +12210,13 @@ Running a <a>control message</a> to end an {{AudioContext}} |context|
12194
12210
is not already "{{AudioContextState/running}}":
12195
12211
12196
12212
1. Set the |context|'s {{[[control thread state]]}} to
12197
- <code>running</code> .
12213
+ "{{AudioContextState/running}}" .
12198
12214
12199
12215
1. [=Fire an event=] named {{BaseAudioContext/statechange}} at the
12200
12216
|context|.
12201
12217
12202
- 1. If the |context|'s {{[[rendering thread state]]}} was
12203
- <code>suspended</code> before the [=interruption=]:
12218
+ 1. If the |context|'s {{[[interrupt end return state]]}} is
12219
+ "{{AudioContextState/suspended}}"
12204
12220
12205
12221
1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to
12206
12222
<code>suspended</code>.
@@ -12210,6 +12226,8 @@ Running a <a>control message</a> to end an {{AudioContext}} |context|
12210
12226
1. Set the |context|'s {{[[control thread state]]}} to
12211
12227
<code>suspended</code>.
12212
12228
12229
+ 1. Set the |context|'s {{[[interrupt end return state]]}} to `null`.
12230
+
12213
12231
<h3 id="error-handling-on-a-running-audio-context">
12214
12232
Handling an error from System Audio Resources on the {{AudioContext}}</h3>
12215
12233
0 commit comments