Fix track position storage on quit
This commit is contained in:
parent
3e72087a41
commit
6e9266e194
1 changed files with 8 additions and 2 deletions
|
@ -188,7 +188,7 @@ NSDictionary * makeRGInfo(PlaylistEntry *pe)
|
||||||
DLog(@"PLAYLIST CONTROLLER: %@", [playlistController class]);
|
DLog(@"PLAYLIST CONTROLLER: %@", [playlistController class]);
|
||||||
[playlistController setCurrentEntry:pe];
|
[playlistController setCurrentEntry:pe];
|
||||||
|
|
||||||
lastPosition = -1;
|
lastPosition = -10;
|
||||||
|
|
||||||
[self setPosition:[offset doubleValue]];
|
[self setPosition:[offset doubleValue]];
|
||||||
|
|
||||||
|
@ -258,6 +258,8 @@ NSDictionary * makeRGInfo(PlaylistEntry *pe)
|
||||||
|
|
||||||
[audioPlayer seekToTime:time];
|
[audioPlayer seekToTime:time];
|
||||||
|
|
||||||
|
lastPosition = -10;
|
||||||
|
|
||||||
[self setPosition:time];
|
[self setPosition:time];
|
||||||
|
|
||||||
[[playlistController currentEntry] setCurrentPosition:time];
|
[[playlistController currentEntry] setCurrentPosition:time];
|
||||||
|
@ -269,6 +271,8 @@ NSDictionary * makeRGInfo(PlaylistEntry *pe)
|
||||||
{
|
{
|
||||||
double time = (double)(position);
|
double time = (double)(position);
|
||||||
|
|
||||||
|
lastPosition = -10;
|
||||||
|
|
||||||
[audioPlayer seekToTime:time];
|
[audioPlayer seekToTime:time];
|
||||||
|
|
||||||
[self setPosition:time];
|
[self setPosition:time];
|
||||||
|
@ -574,6 +578,8 @@ NSDictionary * makeRGInfo(PlaylistEntry *pe)
|
||||||
|
|
||||||
[playlistController setCurrentEntry:pe];
|
[playlistController setCurrentEntry:pe];
|
||||||
|
|
||||||
|
lastPosition = -10;
|
||||||
|
|
||||||
[self setPosition:0];
|
[self setPosition:0];
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:CogPlaybackDidBeginNotficiation object:pe];
|
[[NSNotificationCenter defaultCenter] postNotificationName:CogPlaybackDidBeginNotficiation object:pe];
|
||||||
|
@ -652,7 +658,7 @@ NSDictionary * makeRGInfo(PlaylistEntry *pe)
|
||||||
|
|
||||||
- (void)setPosition:(double)p
|
- (void)setPosition:(double)p
|
||||||
{
|
{
|
||||||
if (p == 0 || p < lastPosition || (p > lastPosition && (p - lastPosition) >= 10.0))
|
if (p > lastPosition && (p - lastPosition) >= 10.0)
|
||||||
{
|
{
|
||||||
PlaylistEntry * pe = [playlistController currentEntry];
|
PlaylistEntry * pe = [playlistController currentEntry];
|
||||||
NSInteger lastTrackPlaying = [pe index];
|
NSInteger lastTrackPlaying = [pe index];
|
||||||
|
|
Loading…
Reference in a new issue