Bug Fix: Disable seeking hotkeys when unseekable

Disable the seek forward and backward actions when the current track
doesn't support seeking.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
Christopher Snowhill 2025-03-09 23:44:26 -07:00
parent 60ef6c873c
commit b34e1b5c6d

View file

@ -418,6 +418,7 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) {
}
- (void)seekForward:(double)amount {
if([self seekable]) {
double seekTo = [audioPlayer amountPlayed] + amount;
if(seekTo > [[[playlistController currentEntry] length] doubleValue]) {
@ -427,6 +428,7 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) {
[audioPlayer performSelectorOnMainThread:@selector(seekToTimeBG:) withObjects:@(seekTo), nil];
[self setPosition:seekTo];
}
}
}
- (IBAction)eventSeekBackward:(id)sender {
@ -434,6 +436,7 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) {
}
- (void)seekBackward:(double)amount {
if([self seekable]) {
double seekTo = [audioPlayer amountPlayed] - amount;
if(seekTo < 0)
@ -443,6 +446,7 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) {
[audioPlayer performSelectorOnMainThread:@selector(seekToTimeBG:) withObjects:@(seekTo), nil];
[self setPosition:seekTo];
}
}
/*