Fix iOS audio (#11863)

This commit is contained in:
Paulus Schoutsen 2022-02-26 13:08:42 -08:00 committed by GitHub
parent 6907fa5c8e
commit 298296a81f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,6 +25,7 @@ export class BrowserMediaPlayer {
private onChange: () => void
) {
const player = new Audio(this.resolved.url);
player.autoplay = true;
player.volume = volume;
player.addEventListener("play", this._handleChange);
player.addEventListener("playing", () => {
@ -33,15 +34,7 @@ export class BrowserMediaPlayer {
});
player.addEventListener("pause", this._handleChange);
player.addEventListener("ended", this._handleChange);
player.addEventListener("canplaythrough", () => {
if (this._removed) {
return;
}
if (this.buffering) {
player.play();
}
this.onChange();
});
player.addEventListener("canplaythrough", this._handleChange);
this.player = player;
}