Skip to content

Commit d8283a6

Browse files
committed
fix(player): fill all slider chapters when live edge
1 parent 78e126e commit d8283a6

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

packages/react/.templates/sandbox/player.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export function Player() {
6262
setSrc(`https://stream.mux.com/${muxPlaybackId}.m3u8`);
6363
break;
6464
case 'live':
65-
player.src = 'https://stream.mux.com/v69RSHhFelSm4701snP22dYz2jICy4E4FUyk02rW4gxRM.m3u8';
65+
setSrc('https://stream.mux.com/v69RSHhFelSm4701snP22dYz2jICy4E4FUyk02rW4gxRM.m3u8');
6666
break;
6767
}
6868
}

packages/vidstack/src/components/ui/sliders/time-slider/slider-chapters.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ export class SliderChapters extends Component<SliderChaptersProps> {
148148
}
149149

150150
private _watchFillPercent() {
151+
const { liveEdge } = this._media.$state;
152+
151153
let { fillPercent, value } = this._sliderState,
152154
prevActiveIndex = peek(this._activeIndex),
153155
currentChapter = this._cues[prevActiveIndex],
@@ -156,13 +158,18 @@ export class SliderChapters extends Component<SliderChaptersProps> {
156158
fillPercent(),
157159
);
158160

159-
if (currentActiveIndex > prevActiveIndex) {
161+
if (liveEdge()) {
162+
this._updateFillPercents(0, this._cues.length, '100%');
163+
} else if (currentActiveIndex > prevActiveIndex) {
160164
this._updateFillPercents(prevActiveIndex, currentActiveIndex, '100%');
161165
} else if (currentActiveIndex < prevActiveIndex) {
162166
this._updateFillPercents(currentActiveIndex + 1, prevActiveIndex + 1, '0%');
163167
}
164168

165-
const percent = this._calcPercent(this._cues[currentActiveIndex], fillPercent()) + '%';
169+
const percent = liveEdge()
170+
? '100%'
171+
: this._calcPercent(this._cues[currentActiveIndex], fillPercent()) + '%';
172+
166173
this._updateFillPercent(this._refs[currentActiveIndex], percent);
167174

168175
this._activeIndex.set(currentActiveIndex);

0 commit comments

Comments
 (0)