1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-22 16:45:58 +01:00

Delay playing of video until connection is in good state.

This commit is contained in:
Juliusz Chroboczek 2020-12-03 01:07:48 +01:00
parent 27a2e45500
commit 1a11548192

View file

@ -932,7 +932,7 @@ async function addFileMedia(file) {
} }
}; };
setMedia(c, true, video); setMedia(c, true, video);
video.play(); c.userdata.play = true;
setButtonsVisibility() setButtonsVisibility()
} }
@ -1230,11 +1230,20 @@ function setMediaStatus(c) {
console.warn('Setting status of unknown media.'); console.warn('Setting status of unknown media.');
return; return;
} }
if(good) if(good) {
media.classList.remove('media-failed'); media.classList.remove('media-failed');
else if(c.userdata.play) {
if(media instanceof HTMLMediaElement)
media.play().catch(e => {
console.error(e);
displayError(e);
});
delete(c.userdata.play);
}
} else {
media.classList.add('media-failed'); media.classList.add('media-failed');
} }
}
/** /**