Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

previous button #13

Open
rastaman111 opened this issue May 27, 2020 · 4 comments
Open

previous button #13

rastaman111 opened this issue May 27, 2020 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@rastaman111
Copy link

But you can fix the button back so that it does not wind the audio up to 0 second, and immediately switches to the previous track, if there is one

@yoheimuta
Copy link
Owner

@rastaman111 Thank you for your suggestion.

Do you mean that your change request helps #12 fixed?
I think that in absolute terms, the current behavior makes sense because some popular music apps like Apple Music and Amazon Music follow the same.

That said, it would be appropriate to add the new option like always_previous_track that is set to false as default. Does it work for you?

@rastaman111
Copy link
Author

I think this will not change problem #12, but it will help to solve other problems, such as the application crash, but it will also add convenience

@rastaman111
Copy link
Author

@yoheimuta Hey. so there is some news about the back button, so that you can wind not for 0 second, but immediately to the previous track, you can implement as two functions to choose from

@yoheimuta yoheimuta added enhancement New feature or request good first issue Good for newcomers labels Jul 25, 2020
@yoheimuta
Copy link
Owner

@rastaman111 Thank you for your confirmation.
Can you make a PR whenever you have time? Otherwise, it falls under I will get to it when I have time.

  • private func playPrevious() -> Observable<()> {
    if 1 < (player?.currentTime().seconds ?? 0) {
    return seek(toSecond: 0)
    .flatMapLatest { [weak self] _ -> Driver<CMTime?> in
    guard let weakSelf = self else { return .just(nil) }
    return weakSelf.rx.currentItemTime()
    }
    .asObservable()
    .filter { ($0?.seconds ?? 0) <= 1 }
    .map { [weak self] _ in
    self?.forceUpdateNowPlayingInfo.accept(())
    }
    .take(1)
    }
    return play(atIndex: playIndex - 1)
    }
    is a related part. Maybe if 1 < (player?.currentTime().seconds ?? 0) && !always_previous_track { would be a main change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants