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