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 an option to disable prev/next track buttons on headsets #9745

Closed
6 tasks done
NyanCatTW1 opened this issue Feb 4, 2023 · 4 comments · Fixed by #9746
Closed
6 tasks done

Add an option to disable prev/next track buttons on headsets #9745

NyanCatTW1 opened this issue Feb 4, 2023 · 4 comments · Fixed by #9746
Labels
feature request Issue is related to a feature in the app player Issues related to any player (main, popup and background)

Comments

@NyanCatTW1
Copy link
Contributor

Checklist

  • I made sure that there are no existing issues - open or closed - which I could contribute my information to.
  • I have read the FAQ and my problem isn't listed.
  • I'm aware that this is a request for NewPipe itself and that requests for adding a new service need to be made at NewPipeExtractor.
  • I have taken the time to fill in all the required details. I understand that the feature request will be dismissed otherwise.
  • This issue contains only one feature request.
  • I have read and understood the contribution guidelines.

Feature description

My plan is to add a new option under Video and audio/Behavior, which would look like this:

Ignore headset media button presses  
Notice: In the case of a Bluetooth headset, all media button events will be ignored, which breaks the Media Control UI in the notification area

When the option is enabled, it should do precisely what its description states.
Because it is impossible to distinguish between events that come from a Bluetooth headset and the control UI, it will ignore events from both sides. However, this should only occur when a Bluetooth headset is detected.
See also: https://code.videolan.org/videolan/vlc-android/-/merge_requests/1633

Why do you want this feature?

I sleep with my headset on. However, I often press the prev/next track buttons on the headset by accident, which causes the video to rewind or skip. Needless to say, this is quite inconvenient.
Unfortunately, on Android, there is no way to disable media buttons globally without rooting the phone or physically blocking the pin (which also disables the mic). This means I need the option to make the player ignore those presses.
I'm planning to implement it myself today. But I would also like to know if someone else is interested in such a feature.

Additional information

No response

@NyanCatTW1 NyanCatTW1 added feature request Issue is related to a feature in the app needs triage Issue is not yet ready for PR authors to take up labels Feb 4, 2023
@SameenAhnaf
Copy link
Collaborator

This seems to be a nice feature. But combining with #7880 would be better.

there are two separate settings, one for NEXT and one for PREV, each button can be assigned to any of four functions:

PREV (Restart Episode / Video)
NEXT (Skip Episode / Next Video)
FFWD (Fast Forward)
REW (Rewind)

There should be a fifth option None.

@SameenAhnaf SameenAhnaf added player Issues related to any player (main, popup and background) and removed needs triage Issue is not yet ready for PR authors to take up labels Feb 4, 2023
@NyanCatTW1
Copy link
Contributor Author

NyanCatTW1 commented Feb 4, 2023

Not sure how to reassign buttons on Bluetooth headsets though. Oh yeah, and someone with a Bluetooth headset will have to test if the patch works
Almost done with the patch now, the experience with VLC made it quite straightforward. Give me maybe another half hour

Oh, great, I woke Checkstyle up. This is gonna take longer than what I expected...
Umm, the patch didn't work. Hofstadter's law is kicking in...

@NyanCatTW1
Copy link
Contributor Author

NyanCatTW1 commented Feb 4, 2023

Nailed it! https://github.com/NyanCatTW1/NewPipe/commit/f75003732c2639457d01638493d8f41072a59ed9
It turns out that I should've set the media button event handler of MediaButtonEventHandler. A good side effect is that this for some reason doesn't block actions from the media control UI, which means the UI should work even with a Bluetooth headset!

Making a PR right now
Also, once the PR gets merged, it should be fairly straightforward to implement #7880 inside MediaButtonEventHandler.java

@SameenAhnaf
Copy link
Collaborator

SameenAhnaf commented Feb 4, 2023

No problem, that could be done as well. I just suggested combining the options to avoid a bloated UI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issue is related to a feature in the app player Issues related to any player (main, popup and background)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants