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

Add fast-forward/rewind buttons #932

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vijayabhaskar78
Copy link

The recent update to MusicPlayerBackgroundTask adds configurable skip forward and backward controls with smart visibility features. The implementation includes skip forward (default 30 seconds) and backward (default 10 seconds) controls that can be customized through the new SkipControlSettings class.

The visibility of these controls is managed through a smart system that can automatically show or hide them based on content type. In automatic mode, the controls appear for content longer than 10 minutes or content tagged as podcasts, audiobooks, or speech. You can also configure the visibility to be always shown or never shown through the SkipButtonVisibility enum.

The skip controls are fully integrated with the existing media controls system and can optionally appear in the notification area. The implementation includes Android-specific icons for the skip buttons, which need to be added to the project's drawable resources (ic_skip_back_10 and ic_skip_forward_30).

To use the skip controls, you can either interact with the UI buttons that appear based on the visibility settings, or programmatically call skipForward() and skipBackward(). The skip durations, visibility behavior, and notification presence can all be customized through the SkipControlSettings class when initializing the player.

@Chaphasilor
Copy link
Collaborator

Hmm, that's a bit different from what you proposed in your recent comment.

Most importantly, please target the redesign branch with your PR. A lot of the functionality you're relying on is only available in that branch, and you should have an easier time adding your changes there because a lot of the groundwork has already been done.
Aside from that, please consider the following:

  • The settings and default values should be put into finamp_models.dart along with the other settings.
  • The logic for showing the skip buttons should be a simple modification to the existing logic in metadata_provider.dart, where some variables are renamed to reflect that not just speed controls are affected by it, and then that MetadataProvider should be used to decide if the playback controls should be shown or not on the player screen. Right now you're not showing any new buttons on the player screen, just in the media notification
  • You are specifying icons/drawables for the media notification, but these don't exist yet
  • You are not using the existing fastForward and rewind methods from AudioService (which is implemented by MusicPlayerBackgroundTask. You can also set the default fast-forward and rewind interval as part of the AudioServiceConfig specified when MusicPlayerBackgroundTask is being instantiated.
  • You can configure if the fast-forward and rewind buttons are shown within the _transformEvent() method in MusicPlayerBackgroundTask. There you can access the MetadataProvider to determine if the controls should be shown or not. This should be very similar to what is being done to get the favorite status.
  • Your PR doesn't compile since you're specifying the media controls incorrectly. Please make sure that your code compiles.

@Chaphasilor Chaphasilor changed the title Update music_player_background_task.dart Add fast-forward/rewind buttons Oct 27, 2024
@Chaphasilor Chaphasilor added the awaiting response / stale Issue is possibly outdated or waiting for user feedback label Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting response / stale Issue is possibly outdated or waiting for user feedback
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants