You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: index.bs
+81-9Lines changed: 81 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -1969,26 +1969,40 @@ Methods</h4>
1969
1969
1970
1970
1. If [=this=]'s [=relevant global object=]'s [=associated Document=] is not [=fully active=] then return [=a promise rejected with=] "{{InvalidStateError}}" {{DOMException}}.
1971
1971
1972
-
1. Let <var>promise</var> be a new Promise.
1972
+
2. Let <var>promise</var> be a new Promise.
1973
1973
1974
-
2. If the {{[[control thread state]]}} on the
1975
-
{{AudioContext}} is <code>closed</code> reject the
1974
+
3. If the {{[[control thread state]]}} on the
1975
+
{{AudioContext}} is <code>closed</code> or <code>interrupted</code> reject the
1976
1976
promise with {{InvalidStateError}}, abort these steps,
1977
1977
returning <var>promise</var>.
1978
1978
1979
-
3. Set {{[[suspended by user]]}} to <code>false</code>.
1979
+
4. Set {{[[suspended by user]]}} to <code>false</code>.
1980
+
1981
+
4. If the {{BaseAudioContext/state}} attribute of the {{AudioContext}} is "{{AudioContextState/suspended}}" and the {{[[control thread state]]}} on the
1982
+
{{AudioContext}} is <code>interrupted</code>:
1980
1983
1981
-
4. If the context is not <a>allowed to start</a>, append
queue a media element task</a> to execute the following steps:
1986
+
1987
+
1. Set the {{BaseAudioContext/state}} attribute of the {{AudioContext}} to "{{AudioContextState/interrupted}}".
1988
+
1989
+
2. [=Queue a media element task=] to [=fire an event=] named
1990
+
{{BaseAudioContext/statechange}} at the {{AudioContext}}.
1991
+
1992
+
2. Reject the promise with {{InvalidStateError}}, abort these steps,
1993
+
returning <var>promise</var>.
1994
+
1995
+
5. If the context is not <a>allowed to start</a>, append
1982
1996
<var>promise</var> to {{BaseAudioContext/[[pending promises]]}} and
1983
1997
{{AudioContext/[[pending resume promises]]}} and abort these steps, returning
1984
1998
<var>promise</var>.
1985
1999
1986
-
5. Set the {{[[control thread state]]}} on the
2000
+
6. Set the {{[[control thread state]]}} on the
1987
2001
{{AudioContext}} to <code>running</code>.
1988
2002
1989
-
6. <a>Queue a control message</a> to resume the {{AudioContext}} with <var>promise</var>.
2003
+
7. <a>Queue a control message</a> to resume the {{AudioContext}} with <var>promise</var>.
1990
2004
1991
-
7. Return <var>promise</var>.
2005
+
8. Return <var>promise</var>.
1992
2006
</div>
1993
2007
1994
2008
<div id="context-resume" algorithm="run a control message in AudioContext">
@@ -4078,7 +4092,7 @@ Methods</h4>
4078
4092
scheduled parameter changes with times greater than or equal to
4079
4093
{{AudioParam/cancelAndHoldAtTime()/cancelTime!!argument}}. However, in addition, the automation
4080
4094
value that would have happened at {{AudioParam/cancelAndHoldAtTime()/cancelTime!!argument}} is
4081
-
then proprogated for all future time until other automation
4095
+
then propagated for all future time until other automation
4082
4096
events are introduced.
4083
4097
4084
4098
The behavior of the timeline in the face of
@@ -11968,6 +11982,64 @@ running the algorithm for an {{AudioNode}}, using an <a>input
11968
11982
buffer</a> and the value(s) of the {{AudioParam}}(s) of this
11969
11983
{{AudioNode}} as the input for this algorithm.
11970
11984
11985
+
<h3 id="interruption-handling">Handling an interruption on the {{AudioContext}}</h3>
11986
+
11987
+
The {{AudioContext}} |audioContext| performs the following steps on the <a>rendering thread</a> when an interruption happens.
11988
+
11989
+
1. If the |audioContext|'s {{[[rendering thread state]]}} is <code>closed</code> or <code>interrupted</code>:
11990
+
11991
+
1. Abort these steps.
11992
+
11993
+
1. If the |audioContext|'s {{[[rendering thread state]]}} is <code>running</code>:
11994
+
11995
+
1. Attempt to <a>release system resources</a>.
11996
+
11997
+
1. [=Queue a media element task=] to execute the following steps:
11998
+
11999
+
1. Set the |audioContext|'s {{[[control thread state]]}} to <code>interrupted</code>.
12000
+
12001
+
1. [=Fire an event=] named {{BaseAudioContext/statechange}} at the |audioContext|.
12002
+
12003
+
1. If the |audioContext|'s {{[[rendering thread state]]}} is <code>suspended</code>:
12004
+
12005
+
1. [=Queue a media element task=] to execute the following steps:
12006
+
12007
+
1. Set the |audioContext|'s {{[[control thread state]]}} to <code>interrupted</code>.
12008
+
12009
+
1. Set the |audioContext|'s {{[[rendering thread state]]}} to <code>interrupted</code>.
12010
+
12011
+
Note: If the {{AudioContext}} is <code>suspended</code> a {{BaseAudioContext/statechange}} event is not fired for privacy reasons to avoid over-sharing user activity - e.g. when a phone call comes in or when the screen gets locked.
12012
+
12013
+
The {{AudioContext}} |audioContext| performs the following steps on the <a>rendering thread</a> when the interruption ends.
12014
+
12015
+
1. If the |audioContext|'s {{[[rendering thread state]]}} is not <code>interrupted</code>:
12016
+
12017
+
1. Abort these steps.
12018
+
12019
+
1. If the |audioContext|'s {{[[rendering thread state]]}} was <code>running</code> before the interruption or if the the |audioContext|'s {{[[rendering thread state]]}} was <code>suspended</code> and {{AudioContext/resume}} was called during the interruption:
12020
+
12021
+
1. Attempt to <a href="#acquiring">acquire system resources</a>.
12022
+
12023
+
2. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to <code>running</code>.
12024
+
12025
+
3. Start <a href="#rendering-loop">rendering the audio graph</a>.
12026
+
12027
+
4. [=Queue a media element task=] to execute the following steps:
12028
+
12029
+
1. If the {{BaseAudioContext/state}} attribute of the {{AudioContext}} is not already "{{AudioContextState/running}}":
12030
+
12031
+
1. Set the |audioContext|'s {{[[control thread state]]}} to <code>running</code>.
12032
+
12033
+
1. [=Fire an event=] named {{BaseAudioContext/statechange}} at the |audioContext|.
12034
+
12035
+
1. If the |audioContext|'s {{[[rendering thread state]]}} was <code>suspended</code> before the interruption:
12036
+
12037
+
1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to <code>suspended</code>.
12038
+
12039
+
2. [=Queue a media element task=] to execute the following steps:
12040
+
12041
+
1. Set the |audioContext|'s {{[[control thread state]]}} to <code>suspended</code>.
0 commit comments