mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 00:32:11 +00:00
Bug 1788596 - Force audio element load to avoid edge case on media error handling r=alwu
Differential Revision: https://phabricator.services.mozilla.com/D158076
This commit is contained in:
parent
ce09ecf9e1
commit
efbdf623dc
@ -186,16 +186,26 @@ async function checkAudioDecoder(
|
||||
}
|
||||
};
|
||||
|
||||
audio.addEventListener("timeupdate", timeUpdateHandler, { once: true });
|
||||
const startPlaybackHandler = async ev => {
|
||||
ok(
|
||||
await audio.play().then(
|
||||
_ => true,
|
||||
_ => false
|
||||
),
|
||||
"audio started playing"
|
||||
);
|
||||
|
||||
audio.addEventListener("timeupdate", timeUpdateHandler, { once: true });
|
||||
};
|
||||
|
||||
audio.addEventListener("canplaythrough", startPlaybackHandler, {
|
||||
once: true,
|
||||
});
|
||||
});
|
||||
|
||||
ok(
|
||||
await audio.play().then(
|
||||
_ => true,
|
||||
_ => false
|
||||
),
|
||||
"audio started playing"
|
||||
);
|
||||
// We need to make sure the decoder is ready before play()ing otherwise we
|
||||
// could get into bad situations
|
||||
audio.load();
|
||||
return checkPromise;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user