Do not render controls until we have metadata

This commit is contained in:
Fernando Jiménez Moreno 2019-05-10 20:41:06 +02:00
parent f16cf2d6a4
commit 3a99c6ba6a

View file

@ -1648,6 +1648,12 @@ impl HTMLMediaElement {
// https://github.com/servo/media/issues/156
// Step 12 & 13 are already handled by the earlier media track processing.
// We wait until we have metadata to render the controls, so we render them
// with the appropriate size.
if self.Controls() {
self.render_controls();
}
},
PlayerEvent::NeedData => {
// The player needs more data.
@ -1725,6 +1731,9 @@ impl HTMLMediaElement {
}
fn render_controls(&self) {
if self.ready_state.get() < ReadyState::HaveMetadata {
return;
}
// XXX cannot render controls while parsing.
// XXX check that controls are not already rendered.
let element = self.htmlelement.upcast::<Element>();