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:
parent
90a62821f4
commit
d4dcf29dd4
1 changed files with 21 additions and 17 deletions
|
@ -418,14 +418,16 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) {
|
|||
}
|
||||
|
||||
- (void)seekForward:(double)amount {
|
||||
double seekTo = [audioPlayer amountPlayed] + amount;
|
||||
|
||||
if(seekTo > [[[playlistController currentEntry] length] doubleValue]) {
|
||||
[self next:self];
|
||||
} else {
|
||||
lastPosition = -10;
|
||||
[audioPlayer performSelectorOnMainThread:@selector(seekToTimeBG:) withObjects:@(seekTo), nil];
|
||||
[self setPosition:seekTo];
|
||||
if([self seekable]) {
|
||||
double seekTo = [audioPlayer amountPlayed] + amount;
|
||||
|
||||
if(seekTo > [[[playlistController currentEntry] length] doubleValue]) {
|
||||
[self next:self];
|
||||
} else {
|
||||
lastPosition = -10;
|
||||
[audioPlayer performSelectorOnMainThread:@selector(seekToTimeBG:) withObjects:@(seekTo), nil];
|
||||
[self setPosition:seekTo];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -434,15 +436,17 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) {
|
|||
}
|
||||
|
||||
- (void)seekBackward:(double)amount {
|
||||
double seekTo = [audioPlayer amountPlayed] - amount;
|
||||
|
||||
if(seekTo < 0)
|
||||
seekTo = 0;
|
||||
|
||||
lastPosition = -10;
|
||||
|
||||
[audioPlayer performSelectorOnMainThread:@selector(seekToTimeBG:) withObjects:@(seekTo), nil];
|
||||
[self setPosition:seekTo];
|
||||
if([self seekable]) {
|
||||
double seekTo = [audioPlayer amountPlayed] - amount;
|
||||
|
||||
if(seekTo < 0)
|
||||
seekTo = 0;
|
||||
|
||||
lastPosition = -10;
|
||||
|
||||
[audioPlayer performSelectorOnMainThread:@selector(seekToTimeBG:) withObjects:@(seekTo), nil];
|
||||
[self setPosition:seekTo];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue