Commit 1a115481 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Delay playing of video until connection is in good state.

parent 27a2e455
...@@ -932,7 +932,7 @@ async function addFileMedia(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,10 +1230,19 @@ function setMediaStatus(c) { ...@@ -1230,10 +1230,19 @@ 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');
}
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment