Skip to content

Commit

Permalink
Merge pull request opencast#1495 from JulianKniephoff/forward-button
Browse files Browse the repository at this point in the history
Make behavior of forward button more intuitive
  • Loading branch information
geichelberger authored Dec 9, 2024
2 parents 6d1dd7b + d204ae4 commit 0b282ae
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/redux/videoSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,17 @@ const videoSlice = createSlice({
state.jumpTriggered = true;
},
jumpToNextSegment: state => {
let nextSegmentIndex = state.activeSegmentIndex + 1;
const nextSegmentIndex = state.activeSegmentIndex + 1;
let jumpTarget = 0;

if (state.activeSegmentIndex + 1 >= state.segments.length) {
// Jump to start of last segment
nextSegmentIndex = state.activeSegmentIndex;
// Jump to end of last segment
jumpTarget = state.segments[state.activeSegmentIndex].end;
} else {
jumpTarget = state.segments[nextSegmentIndex].start;
}

updateCurrentlyAt(state, state.segments[nextSegmentIndex].start);
updateCurrentlyAt(state, jumpTarget);
state.jumpTriggered = true;
},
addSegment: (state, action: PayloadAction<video["segments"][0]>) => {
Expand Down

0 comments on commit 0b282ae

Please sign in to comment.