Skip to content

Commit

Permalink
fix(player): fill all slider chapters when live edge
Browse files Browse the repository at this point in the history
  • Loading branch information
mihar-22 committed Oct 6, 2023
1 parent 78e126e commit d8283a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/react/.templates/sandbox/player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export function Player() {
setSrc(`https://stream.mux.com/${muxPlaybackId}.m3u8`);
break;
case 'live':
player.src = 'https://stream.mux.com/v69RSHhFelSm4701snP22dYz2jICy4E4FUyk02rW4gxRM.m3u8';
setSrc('https://stream.mux.com/v69RSHhFelSm4701snP22dYz2jICy4E4FUyk02rW4gxRM.m3u8');
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ export class SliderChapters extends Component<SliderChaptersProps> {
}

private _watchFillPercent() {
const { liveEdge } = this._media.$state;

let { fillPercent, value } = this._sliderState,
prevActiveIndex = peek(this._activeIndex),
currentChapter = this._cues[prevActiveIndex],
Expand All @@ -156,13 +158,18 @@ export class SliderChapters extends Component<SliderChaptersProps> {
fillPercent(),
);

if (currentActiveIndex > prevActiveIndex) {
if (liveEdge()) {
this._updateFillPercents(0, this._cues.length, '100%');
} else if (currentActiveIndex > prevActiveIndex) {
this._updateFillPercents(prevActiveIndex, currentActiveIndex, '100%');
} else if (currentActiveIndex < prevActiveIndex) {
this._updateFillPercents(currentActiveIndex + 1, prevActiveIndex + 1, '0%');
}

const percent = this._calcPercent(this._cues[currentActiveIndex], fillPercent()) + '%';
const percent = liveEdge()
? '100%'
: this._calcPercent(this._cues[currentActiveIndex], fillPercent()) + '%';

this._updateFillPercent(this._refs[currentActiveIndex], percent);

this._activeIndex.set(currentActiveIndex);
Expand Down

0 comments on commit d8283a6

Please sign in to comment.