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,6 +418,7 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) {
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)seekForward:(double)amount {
|
- (void)seekForward:(double)amount {
|
||||||
|
if([self seekable]) {
|
||||||
double seekTo = [audioPlayer amountPlayed] + amount;
|
double seekTo = [audioPlayer amountPlayed] + amount;
|
||||||
|
|
||||||
if(seekTo > [[[playlistController currentEntry] length] doubleValue]) {
|
if(seekTo > [[[playlistController currentEntry] length] doubleValue]) {
|
||||||
|
@ -428,12 +429,14 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) {
|
||||||
[self setPosition:seekTo];
|
[self setPosition:seekTo];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (IBAction)eventSeekBackward:(id)sender {
|
- (IBAction)eventSeekBackward:(id)sender {
|
||||||
[self seekBackward:DEFAULT_SEEK];
|
[self seekBackward:DEFAULT_SEEK];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)seekBackward:(double)amount {
|
- (void)seekBackward:(double)amount {
|
||||||
|
if([self seekable]) {
|
||||||
double seekTo = [audioPlayer amountPlayed] - amount;
|
double seekTo = [audioPlayer amountPlayed] - amount;
|
||||||
|
|
||||||
if(seekTo < 0)
|
if(seekTo < 0)
|
||||||
|
@ -444,6 +447,7 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) {
|
||||||
[audioPlayer performSelectorOnMainThread:@selector(seekToTimeBG:) withObjects:@(seekTo), nil];
|
[audioPlayer performSelectorOnMainThread:@selector(seekToTimeBG:) withObjects:@(seekTo), nil];
|
||||||
[self setPosition:seekTo];
|
[self setPosition:seekTo];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
- (void)changePlayButtonImage:(NSString *)name
|
- (void)changePlayButtonImage:(NSString *)name
|
||||||
|
|
Loading…
Reference in a new issue