doublesymmetry / react-native-track-player

A fully fledged audio module created for music apps. Provides audio playback, external media controls, background mode and more!
https://rntp.dev/
Apache License 2.0
3.25k stars 1.01k forks source link

[bug] KEYCODE_MEDIA_NEXT does not trigger with Capability.NEXT not set as notification capability on Android #2180

Closed lovegaoshi closed 8 months ago

lovegaoshi commented 11 months ago

Describe the Bug The bug is described here: https://github.com/podverse/podverse-rn/issues/1758 for ios, RNTP behaves as normal. for android Event.RemoteSkipNext will simply not fire (via bluetooth, as notification button is hidden) when Capability.next is not set as a notification capability, because MediaSessionConnector.QueueNavigator does not enable the next/previous actions then. This is fine for most apps but not for podverse, where the next/previous buttons should be replaced by forward/backward buttons.

Steps To Reproduce Take out Capability.Next in notifications and try next/previous with a bluetooth headset on android

Code To Reproduce like https://github.com/lovegaoshi/KotlinAudio/commit/43a23de5ad884471968547d762b0d0d62d12f40d#diff-aac2898870a901482661b6a0bfd73dbbab38fc17fc1f8591a6fce7ab31f9c76a

Replicable on Example App? yes.

Environment Info: not relevant

How I can Help I override onMediaButtonEvent for mediaSessionCompat.Callback (I think I wrote this part for the android auto PR?) to specifically handle skip next and previous events for podverse. unsure what the best practice is though. https://github.com/lovegaoshi/KotlinAudio/commit/43a23de5ad884471968547d762b0d0d62d12f40d#diff-9c7fc38508b88eca04e110589f9f3c473b526e10a0451c87796dc53f9a9f20f8

dcvz commented 11 months ago

Right, at the moment the capabilities are both used to determine what the notification shows /and/ media session actions. I have a PR in the works that reworks and separates those two: https://github.com/doublesymmetry/react-native-track-player/pull/2076

lovegaoshi commented 11 months ago

It's a bit more complicated; skip next and previous, if enabled, will always show buttons. This happens in both exoplayer2 and media3, and media3 has an option to disable certain action buttons, though poorly documented

I remember seeing commits of the capability revamp but then reverted too

On Fri, Oct 20, 2023, 11:37 PM David Chavez @.***> wrote:

Right, at the moment the capabilities are both used to determine what the notification shows /and/ media session actions. I have a PR in the works that reworks and separates those two: #2076 https://github.com/doublesymmetry/react-native-track-player/pull/2076

— Reply to this email directly, view it on GitHub https://github.com/doublesymmetry/react-native-track-player/issues/2180#issuecomment-1773693990, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZMOVVXXQTOL7CB5QC3YF7DYANUTZAVCNFSM6AAAAAA6J5APGCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZTGY4TGOJZGA . You are receiving this because you authored the thread.Message ID: @.*** com>

github-actions[bot] commented 8 months ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 8 months ago

This issue was closed because it has been stalled for 7 days with no activity.