@@ -11993,54 +11993,60 @@ to halt audio playback for an {{AudioContext}}. For example, The user agent may
1199311993create an interruption when another application requests exclusive access to the
1199411994audio output hardware.
1199511995
11996- The {{AudioContext}} |context| performs the following steps on the
11997- <a>rendering thread</a> when an interruption happens .
11996+ When an [=interruption=] happens, the user agent must <a>Queue a control message</a>
11997+ to interrupt the {{AudioContext}} .
1199811998
11999- 1. If the |audioContext|'s {{[[rendering thread state]]}} is <code>closed</code>
11999+ Running a <a>control message</a> to interrupt an {{AudioContext}} |context|
12000+ means running these steps on the <a>rendering thread</a>:
12001+
12002+ 1. If the |context|'s {{[[rendering thread state]]}} is <code>closed</code>
1200012003 or <code>interrupted</code>:
1200112004
1200212005 1. Abort these steps.
1200312006
12004- 1. If the |audioContext |'s {{[[rendering thread state]]}} is
12007+ 1. If the |context |'s {{[[rendering thread state]]}} is
1200512008 <code>running</code>:
1200612009
1200712010 1. Attempt to <a>release system resources</a>.
1200812011
1200912012 1. [=Queue a media element task=] to execute the following steps:
1201012013
12011- 1. Set the |audioContext |'s {{[[control thread state]]}} to
12014+ 1. Set the |context |'s {{[[control thread state]]}} to
1201212015 <code>interrupted</code>.
1201312016
1201412017 1. [=Fire an event=] named {{BaseAudioContext/statechange}} at the
12015- |audioContext |.
12018+ |context |.
1201612019
12017- 1. If the |audioContext |'s {{[[rendering thread state]]}} is
12020+ 1. If the |context |'s {{[[rendering thread state]]}} is
1201812021 <code>suspended</code>:
1201912022
1202012023 1. [=Queue a media element task=] to execute the following steps:
1202112024
12022- 1. Set the |audioContext |'s {{[[control thread state]]}} to
12025+ 1. Set the |context |'s {{[[control thread state]]}} to
1202312026 <code>interrupted</code>.
1202412027
12025- 1. Set the |audioContext |'s {{[[rendering thread state]]}} to
12028+ 1. Set the |context |'s {{[[rendering thread state]]}} to
1202612029 <code>interrupted</code>.
1202712030
1202812031Note: If the {{AudioContext}} is <code>suspended</code> a
1202912032{{BaseAudioContext/statechange}} event is not fired for privacy reasons to avoid
1203012033over-sharing user activity - e.g. when a phone call comes in or when the screen
1203112034gets locked.
1203212035
12033- The {{AudioContext}} |audioContext| performs the following steps on the
12034- <a>rendering thread</a> when the [=interruption=] ends.
12036+ When an [=interruption=] ends, the user agent must <a>Queue a control message</a>
12037+ to end the {{AudioContext}} interruption.
12038+
12039+ Running a <a>control message</a> to end an {{AudioContext}} |context|
12040+ [=interruption=] means running these steps on the <a>rendering thread</a>:
1203512041
12036- 1. If the |audioContext |'s {{[[rendering thread state]]}} is not
12042+ 1. If the |context |'s {{[[rendering thread state]]}} is not
1203712043 <code>interrupted</code>:
1203812044
1203912045 1. Abort these steps.
1204012046
12041- 1. If the |audioContext |'s {{[[rendering thread state]]}} was
12047+ 1. If the |context |'s {{[[rendering thread state]]}} was
1204212048 <code>running</code> before the [=interruption=] or if the the
12043- |audioContext |'s {{[[rendering thread state]]}} was <code>suspended</code>
12049+ |context |'s {{[[rendering thread state]]}} was <code>suspended</code>
1204412050 and {{AudioContext/resume}} was called during the [=interruption=]:
1204512051
1204612052 1. Attempt to <a href="#acquiring">acquire system resources</a>.
@@ -12055,21 +12061,21 @@ The {{AudioContext}} |audioContext| performs the following steps on the
1205512061 1. If the {{BaseAudioContext/state}} attribute of the {{AudioContext}}
1205612062 is not already "{{AudioContextState/running}}":
1205712063
12058- 1. Set the |audioContext |'s {{[[control thread state]]}} to
12064+ 1. Set the |context |'s {{[[control thread state]]}} to
1205912065 <code>running</code>.
1206012066
1206112067 1. [=Fire an event=] named {{BaseAudioContext/statechange}} at the
12062- |audioContext |.
12068+ |context |.
1206312069
12064- 1. If the |audioContext |'s {{[[rendering thread state]]}} was
12070+ 1. If the |context |'s {{[[rendering thread state]]}} was
1206512071 <code>suspended</code> before the [=interruption=]:
1206612072
1206712073 1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to
1206812074 <code>suspended</code>.
1206912075
1207012076 1. [=Queue a media element task=] to execute the following steps:
1207112077
12072- 1. Set the |audioContext |'s {{[[control thread state]]}} to
12078+ 1. Set the |context |'s {{[[control thread state]]}} to
1207312079 <code>suspended</code>.
1207412080
1207512081<h3 id="error-handling-on-a-running-audio-context">
0 commit comments