rRemix / APlayer

Android Music Player
GNU General Public License v3.0
1.32k stars 178 forks source link

Music is not paused when using my earphones #256

Open walrus543 opened 1 month ago

walrus543 commented 1 month ago

Hello, I have Jabra earphones and sometimes pressing on them doesn't pause the music. I don't have this issue with my other music player. Unfortunately I didn't find any useful log related to remix.myplayer when reproducing the issue.

Android 14 - LineageOS - OnePlus 8 Pro

App info: APPLICATION_ID: remix.myplayer VERSION_CODE: 16400 VERSION_NAME: 1.6.4.0 FLAVOR: nonGoogleWithUpdater BUILD_TYPE: release GITHUB_SHA: null

System info: DISPLAY: lineage_instantnoodlep-userdebug 14 AP2A.240705.005 8fcd721f7e SUPPORTED_ABIS: [arm64-v8a, armeabi-v7a, armeabi] MANUFACTURER: OnePlus MODEL: IN2020 RELEASE: 14 SDK_INT: 34

Henry-ZHR commented 1 month ago

https://github.com/rRemix/APlayer/blob/b6038563804485f884d8ab184761af11161ee367/app/src/main/java/remix/myplayer/misc/receiver/MediaButtonReceiver.kt#L38

Look for that in your log. It should appear almost immediately every time you press your earphone.

walrus543 commented 1 month ago

I took time to be able to reproduce the issue. Everything worked fine, I pressed on my earphones several times and it always worked. A few minutes ago, I tried again and I can no longer paused with the earphones. I recorded a log when trying to pause 3 times.

recorded.log device.txt

Disconnecting the earphones didn't help. I had to force close APlayer to be able to pause with the earphones.

Henry-ZHR commented 1 month ago
1723541771.230  1000  1781  2965 D MediaSessionService: Sending KeyEvent { action=ACTION_UP, keyCode=KEYCODE_MEDIA_PLAY, scanCode=0, metaState=0, flags=0x0, repeatCount=0, eventTime=0, downTime=0, deviceId=-1, source=0x0, displayId=-1 } to de.danoeh.antennapod/PlaybackService/55 (userId=0)

Seems that de.danoeh.antennapod is capturing the key event

Try disabling (pm disable) it when you encounter the issue again

walrus543 commented 1 month ago

I disabled de.danoeh.antennapod with Termux.

It seems the device is still trying to send the KeyEvent to AntennaPod app instead of APlayer.

PendingIntentHolder: Sending KeyEvent { action=ACTION_UP, keyCode=KEYCODE_MEDIA_PLAY, scanCode=0, metaState=0, flags=0x0, repeatCount=0, eventTime=0, downTime=0, deviceId=-1, source=0x0, displayId=-1 } to the last known PendingIntent PendingIntent{ecd98c3: PendingIntentRecord{9ce1019 de.danoeh.antennapod broadcastIntent}}

FWIW I don't have this issue with my previous music player.

recorded.log

Henry-ZHR commented 4 weeks ago
  1. Try uninstalling that app if it's acceptable for you
  2. uid, and if possible pid of APlayer
  3. The log when APlayer started may also be useful
  4. I really suggest debugging yourself as I am currently working on some other things and don't have much time. Related code: https://github.com/rRemix/APlayer/blob/88e40796467647072ed1f9cee83a8a7556427812/app/src/main/java/remix/myplayer/service/MusicService.kt#L589 and app/src/main/java/remix/myplayer/misc/receiver/MediaButtonReceiver.kt