1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Do nothing if there is 1 second left

This commit is contained in:
viown 2024-10-15 15:20:39 +03:00
parent 64b9ab2a19
commit 7ad7f07b7c

View file

@ -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';
@ -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();
}
}
});