Yatse Not Working with Android Media Keys Anymore

Be sure to read https://yatse.tv/wiki/debug-yatse-kodi-remote to provide necessary logs and information.

Issue description:
Hi, I’ve been using yaste for a while now, with a Moto Nexus 6 running Lineage, and with several Raspberry Pi’s, Fire TV’s and other devices running Kodi. I have a Bluetooth remote control, that I have paired to my phone, and used that to control yatse and in turn control Kodi. Mainly I’m just using the remote for a simple Play/Pause and FF RW commands. It’s been working fine for quite some time and now I’ve lost the recipe to get it to work with Yatse. The remote still works with other android based media players/music players, such as VLC for android, and HiFi cast, and even YouTube. Again the remote is paired to my phone and works just fine in other applications and media players. I’ve tried this setup and it works just fine with 2 other phones, just not with yatse. All the remote is doing is sending a MEDIA_PLAY_PAUSE command when I press the play/pause button on my remote. Was this feature somehow removed in yatse, or something, because this was working previously in a older version. (not sure what version). Anyway, please fix this if possible. This can be easily reproduced using a multimedia keyboard with yatse, if you don’t have a Bluetooth remote. Thanks in advance for your support, and thanks for creating such a great app!
Logs:

Screenshots:

Additional information:

Also, just in case you want/needdebug-20191006_204006.zip (6.5 KB) it here is a quick log.

The feature is tied to the option Lock Screen controls :slight_smile:

BTW if you love and use Yatse a lot you may want to support by purchasing unlocker :wink:

Tried that option, still not working. Any other ideas?

Does volume control works outside of Yatse via the volume buttons and have you of course also the notification option on?

Volume Control Works fine via the remote i am using, Volume Hardware Keys on the phone, and the volume controls on yatse itself. Also, the options i have turned on via general are
Lock Screen Controls = checked
Show Notification = Checked
Seek in Notification = Checked
Keep Notification = Checked

Also, as a side note, i just ordered and received a Samsung Galaxy watch, that has music player controls. When the watch is paired up to my phone, i am able to see the now playing screen on Yatse, from my watch, just not control it. Again if i try using another app, such as vlc controls work as expected. I assume this might be related. The now playing screen even shows the music, artist, and artwork, just when i click on any of the play/pause controls, or skip, rewind it does nothing. Just as with the remote, it works fine via other apps

Please provide new logs when trying to use the watch maybe there’s more details in those but it makes no sense.

I’m using all the latest libraries from Google that most of the other apps probably won’t until a long time, I fear there’s a bug in it with lineage not sure I’ll be able to do a lot :frowning:
If the tizen watch shows the media then the MediaSession is properly configured and work, if the commands never reach Yatse then it’s lost in the library internals :frowning:

I guess your device is rooted and you are able to provide logcats? Could help too in case the OS logs something.

ok, Here is my logcatLog_2019-10-08_15-11-46.txt (1009.5 KB) . this i tested while yatse debugging was on. Also, tested play pause commands with the remote and watch. Here is the yatse debug logdebug.log (175.3 KB) . Also, i don’t think this is a lineage specific bug, as i just tried another phone, non rooted, stock LG Stylo 4. I unpaired and paired the remote to the stylo 4 and, after confirming the notification screen was checked, I tried play pause on the remote and it did not work. Let me know if there’s anything else you want/need. Thanks

Does not makes any sense :frowning:

Yatse-playstore-arm64-v8a-final.zip (5.1 MB)

Please try attached APK and provide new logs.
In all your logs the media is currently paused, there’s a bug on some Android when speed is at 0 so added a workaround + tons of new logs.

Ok, well, here’s the latest log. This time I had media playing, and was pressing media buttons on both remote and the watch. Buttons didn’t appear to do anything. Let me know if there is anything else you want to tryLog_2019-10-09_17-29-49.txt (1.9 MB) debug-20191009_173013.zip (14.0 KB)

Let me know if this one provides any more info.Log_2019-10-09_22-20-44.txt (846.0 KB) debug-20191009_222107.zip (13.6 KB) I’m using Logcat Extreme to get and view my logs, just realized that it was set to info, and i just now changed it to verbose. let me know if that helps anything…

10-09 22:20:13.564 3099 3099 D NewAvrcpMediaPlayerList: Already have a controller for the player: org.leetzone.android.yatsewidgetfree, updating instead

10-09 22:20:13.564 3099 3099 D NewAvrcpMediaPlayerWrapper: org.leetzone.android.yatsewidgetfree: Controller for org.leetzone.android.yatsewidgetfree maybe is not activated.

Maybe you have some settings somewhere to enable the remote for each apps?

It also seems VLC keeps getting an active player state at the same moment and get the buttons.

In all cases the issue is somewhere before reaching Yatse code :frowning: Either a bug in Google lib that does not register in some cases or something on your device / remote or conflict from another app.

Maybe try without VLC installed?

Tried uninstalling vlc, remote or watch still does not work with yatse.

Not 100% sure what you mean by that. there are no settings for the remote, per say. I just paired the remote via Bluetooth and it works. There isn’t really any settings more than that. As i said before the remote simply does a MEDIA_PLAY_PAUSE Command as described here and here. This works fine in various other apps, VLC, Pulsar, HiFi Cast. I’m not sure what else to try. Let me know if the links i posted are correct, or of any value to you. Thanks

The links are correct in theory and that’s what I use. And it does work perfectly fine here and for other users, the media key reach Yatse.

In your case they don’t and the logcat shows strange things that happens outside of Yatse :frowning:

Please provide new logcat without VLC installed maybe there will be something else.

And as said I do use the very latest Google libraries that none of those do use yet.

I’m referring to the log that says:

NewAvrcpMediaPlayerWrapper: org.leetzone.android.yatsewidgetfree: Controller for org.leetzone.android.yatsewidgetfree maybe is not activated.

Looking at that logcat messages on Google does not return anything so I don’t really understand here and error does not reach Yatse so it’s impossible to do a lot without being able to reproduce :frowning:

ok, here are the logs when running VLCLog_2019-10-12_19-10-21.txt (1.5 MB) . Tested Pause Play Skip and Replay. Anyway, are you not able to reproduce this? You don’t necessarily need a Bluetooth remote, like the one I’m using (i’m just using a older fire tv remote, works fine :laughing:) Any device that has media controls should help you in reproducing this issue. Just checked with a USB Media Keyboard I had lying around, and with a usb otg adapter, it worked fine with VLC, again not with yatse. THe keyboard just has buttons for play pause skip and replay, all which work fine. I just tested and confirmed yatse on yet another stock phone, running android 9, and that also failed testing with yatse with the usb keyboard method I mentioned. Let me know if the logs from VLC are helpful to determine what exactly is going on. Thanks.

Actually I asked about logs without VLC installed :slight_smile: To see where the buttons goes.

And can you please test version 9.2.5a that is the last version before the Google library update.
Then 9.2.7 that is the first with those.

AH, ok, my bad. Here are the logs, without vlc debug-20191013_163833.zip (3.5 KB) Log_2019-10-13_16-38-11.txt (1.1 MB) installed, and me testing both the keyboard, and the Bluetooth remote. Don’t know if it will help, but is there any way you could test out this issue to see if it is reproduceable for you, and maybe debug further? IDK :grey_question::grey_question::grey_question:
Anyway, i also tried version 9.25, and 8.90, via apkmirror, just to see if it fixed anything. It did not. Let me know if you want/need anything else. Hopefully these vlc-less logs will be of assistance.

Well you said it worked before and even with 8.9 it does not this is strange, and maybe confirm there’s something else changed somewhere.

Anyway your logs:

10-13 16:36:54.374  1350 21970 D MediaSessionService: Sending KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_MEDIA_PREVIOUS, scanCode=165, metaState=0, flags=0x8, repeatCount=0, eventTime=148946525, downTime=148946525, deviceId=22, source=0x101 } to the last known PendingIntent PendingIntent{1f2f0e5: PendingIntentRecord{ff487ba com.google.android.youtube broadcastIntent}}
10-13 16:36:54.378  1350 21970 D MediaSessionService: Sending KeyEvent { action=ACTION_UP, keyCode=KEYCODE_MEDIA_PREVIOUS, scanCode=165, metaState=0, flags=0x8, repeatCount=0, eventTime=148946525, downTime=148946525, deviceId=22, source=0x101 } to the last known PendingIntent PendingIntent{1f2f0e5: PendingIntentRecord{ff487ba com.google.android.youtube broadcastIntent}}
10-13 16:36:54.398  1350  1482 I ActivityManager: Start proc 30828:com.google.android.youtube/u0a186 for broadcast com.google.android.youtube/com.google.android.libraries.youtube.player.ui.mediasession.MediaButtonIntentReceiverProvider$DefaultMediaButtonIntentReceiver

Shows that now the events are sent to Youtube …

The only suspicious thing from your logs is:

10-13 16:36:54.269  3384  3384 D SAMediaEventCommander: onPlaybackStateChanged(1)
10-13 16:36:54.269  3384  3384 D SAMediaAppResponseHandler: verifyWaitResponse(org.leetzone.android.yatsewidgetfree, 3): '' ---> false

But I have no idea what SAMediaAppResponseHandler is and can’t find any single link when Googling that, so it’s definitively not something standard.

Normal logs on any of my devices, event are send to Yatse.

2019-10-14 09:10:03.237 2051-3194/? D/MediaSessionService: Sending KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_MEDIA_PLAY_PAUSE, scanCode=0, metaState=0, flags=0x0, repeatCount=0, eventTime=162750620, downTime=162750620, deviceId=-1, source=0x0, displayId=-1 } to org.leetzone.android.yatsewidgetfree.debug/PlayerService (userId=0)
2019-10-14 09:10:03.237 2051-3194/? D/MediaSessionService: Sending KeyEvent { action=ACTION_UP, keyCode=KEYCODE_MEDIA_PLAY_PAUSE, scanCode=0, metaState=0, flags=0x0, repeatCount=0, eventTime=162750620, downTime=162750620, deviceId=-1, source=0x0, displayId=-1 } to org.leetzone.android.yatsewidgetfree.debug/PlayerService (userId=0)
2019-10-14 09:10:03.238 28082-28082/org.leetzone.android.yatsewidgetfree.debug V/PlayerService: P[email protected]134: onMediaButton: Intent { act=android.intent.action.MEDIA_BUTTON (has extras) } - KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_MEDIA_PLAY_PAUSE, scanCode=0, metaState=0, flags=0x0, repeatCount=0, eventTime=162750620, downTime=162750620, deviceId=-1, source=0x0, displayId=-1 }
2019-10-14 09:10:03.239 28082-28082/org.leetzone.android.yatsewidgetfree.debug V/PlayerService: P[email protected]134: onMediaButton: Intent { act=android.intent.action.MEDIA_BUTTON (has extras) } - KeyEvent { action=ACTION_UP, keyCode=KEYCODE_MEDIA_PLAY_PAUSE, scanCode=0, metaState=0, flags=0x0, repeatCount=0, eventTime=162750620, downTime=162750620, deviceId=-1, source=0x0, displayId=-1 }
2019-10-14 09:10:03.540 28082-28082/org.leetzone.android.yatsewidgetfree.debug V/PlayerService: [email protected]: onPlay

Now the game would be to try to find the last version that worked but 8.9 is 8 months old already, or what else you change or use on all your devices that could prevent normal behavior.

Hmm, well that’s weird, so you are not able to reproduce this??? The other thing that is weird is that I just now removed the youtube app, and still am seeing youtube debug logs, whenever i press the playpause button on my remote. Here are the logs for that Log_2019-10-16_15-40-37.txt (767.2 KB) . Also, going back to the samsung galaxy watch, i still cannot get that working, and has yet again different results, in the logs. Also, a side question, is there any chance you will maybe make/port an app for the galaxy watch? I know there is already an app for android wear, but not one for tienzin. I much prefer the galaxy watch, over android wear. Anyway, would be interested to know either way. Let me know if these new logs are of any value Log_2019-10-16_15-41-39.txt (1010.9 KB)debug-20191016_154156.zip (539.5 KB) . Also, another question, what device are you testing yatse with? I would, also, like to know what external device you are using to do the MEDIA_PLAY_PAUSE Command. Thanks. I really hope to get to the bottom of this. Thanks for your suppport

I know you want to help but I kinda know how things works :wink: I tried with many different ways and it does work for other users and this is not the issue here.

The issue is that the OS does not forward the command to Yatse but to other apps, the command is perfectly received by the OS.

The Watch logs are the exact same the media button is not sent to Yatse. (And no there’s no plan for Tizen)

As I said if it’s due to some Yatse change the only way to progress is that you find out the last version of Yatse that works since you said it worked before. If no version works anymore then it’s not a Yatse change but something else that is yet to be found.