Skip to content

Commit ca02298

Browse files
MattiasBuelensgkatsev
authored andcommitted
fix(controls): fix load progress bar never highlighting first buffered time range
The control text element was being counted as the first buffered region but it didn't have the correct styling to be shown. Instead, we keep the buffered region elements in a separate element rather than relying on el.children to be correct.
1 parent 816291e commit ca02298

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/js/control-bar/progress-control/load-progress-bar.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class LoadProgressBar extends Component {
1616

1717
constructor(player, options) {
1818
super(player, options);
19+
this.partEls_ = [];
1920
this.on(player, 'progress', this.update);
2021
}
2122

@@ -41,7 +42,7 @@ class LoadProgressBar extends Component {
4142
const buffered = this.player_.buffered();
4243
const duration = this.player_.duration();
4344
const bufferedEnd = this.player_.bufferedEnd();
44-
const children = this.el_.children;
45+
const children = this.partEls_;
4546

4647
// get the percent width of a time compared to the total end
4748
const percentify = function(time, end) {
@@ -62,6 +63,7 @@ class LoadProgressBar extends Component {
6263

6364
if (!part) {
6465
part = this.el_.appendChild(Dom.createEl());
66+
children[i] = part;
6567
}
6668

6769
// set the percent based on the width of the progress bar (bufferedEnd)
@@ -73,6 +75,7 @@ class LoadProgressBar extends Component {
7375
for (let i = children.length; i > buffered.length; i--) {
7476
this.el_.removeChild(children[i - 1]);
7577
}
78+
children.length = buffered.length;
7679
}
7780

7881
}

0 commit comments

Comments
 (0)