зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1198386 - Wait for the AudioContext to enter the running state before calling suspend() on it; r=karlt
This commit is contained in:
Родитель
00da404692
Коммит
724bf24658
|
@ -1,6 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<script>
|
||||
var ac = new AudioContext();
|
||||
var runningPromise = new Promise(resolve => {
|
||||
ac.onstatechange = event => {
|
||||
if (ac.state == "running") {
|
||||
resolve();
|
||||
}
|
||||
};
|
||||
});
|
||||
fetch("audio.ogg").then(response => {
|
||||
return response.arrayBuffer();
|
||||
}).then(ab => {
|
||||
|
@ -17,7 +24,9 @@ fetch("audio.ogg").then(response => {
|
|||
|
||||
var suspendPromise;
|
||||
function suspendAC() {
|
||||
suspendPromise = ac.suspend();
|
||||
runningPromise.then(() => {
|
||||
suspendPromise = ac.suspend();
|
||||
});
|
||||
}
|
||||
|
||||
var resumePromise;
|
||||
|
|
Загрузка…
Ссылка в новой задаче