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

Handle onTap separately than drag events #51

Open
suragch opened this issue Oct 7, 2022 · 1 comment
Open

Handle onTap separately than drag events #51

suragch opened this issue Oct 7, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@suragch
Copy link
Owner

suragch commented Oct 7, 2022

Current Behavior

Currently the behavior is like so:

  • After the user lifts their finger from an drag event, onSeek is triggered at the duration position of the up event.
  • If a user taps the progress bar, onSeek is called at the duration position of the tap event.

This is the behavior of the audio player control in apps like Signal, Messenger, WhatsApp, Teams, YouTube web, and Music Speed Changer.

Proposed Behavior

However, some developers may wish to ignore onTap events or handle them differently than drag events. Here are some reasons:

  • Users might accidentally tap the progress bar and not want to seek to a new position.
  • Implement different behavior on a tap, for example, play/pause, collapsing the player, etc.

This is the behavior of YouTube mobile app, Netflix, and Spotify.

API

This could be implemented with an API like so:

onTap: (duration) {
  // handle tap event
},

If onTap is null then the behavior would default to the current behavior, that is, seek to the tap location.

Notes

This is a slight modification of the original proposal put forth by @thesensibledev. See the discussion in #44 and #49 for more details.

I'm writing this up to see how many developers need this feature. Give this issue a thumbs up if you are using the progress bar in your app and you want to handle onTap separately.

@BraveEvidence
Copy link

This will help https://www.youtube.com/watch?v=IMQdSTlTXjA

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

No branches or pull requests

2 participants