Skip to content

Commit

Permalink
Do nothing if there is 1 second left
Browse files Browse the repository at this point in the history
  • Loading branch information
viown committed Oct 15, 2024
1 parent 45b3f74 commit 6ca8311
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/components/playback/skipsegment.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PlaybackManager } from './playbackmanager';
import { TICKS_PER_MILLISECOND } from 'constants/time';
import { TICKS_PER_MILLISECOND, TICKS_PER_SECOND } from 'constants/time';
import { MediaSegmentDto, MediaSegmentType } from '@jellyfin/sdk/lib/generated-client';
import { PlaybackSubscriber } from 'apps/stable/features/playback/utils/playbackSubscriber';
import { isInSegment } from 'apps/stable/features/playback/utils/mediaSegments';
Expand Down Expand Up @@ -39,8 +39,13 @@ class SkipSegment extends PlaybackSubscriber {
elem.classList.add('skip-button-hidden');

elem.addEventListener('click', () => {
if (this.currentSegment) {
this.playbackManager.seek(this.currentSegment.EndTicks);
const time = this.playbackManager.currentTime() * TICKS_PER_MILLISECOND;
if (this.currentSegment?.EndTicks) {
if (time < this.currentSegment.EndTicks - TICKS_PER_SECOND) {
this.playbackManager.seek(this.currentSegment.EndTicks);
} else {
this.hideSkipButton();
}
}
});

Expand Down

0 comments on commit 6ca8311

Please sign in to comment.