Jump to content

Support "Rewind/Fast Forward" commands from remote devices


Recommended Posts

Use case: Some Bluetooth devices (headphones/speakers) have dedicated Rewind/Fast Forward buttons (to not confuse with Next/Previous buttons). Additionnally, apps like this (https://play.google.com/store/apps/details?id=flar2.homebutton) allow to assign Volume buttons or assistant buttons (Samsung Bixby or LG assistant buttons) to rewind/fast forward.

I always assumed that this only worked for Podcast/Audiobooks apps, but it works for many music players like Gonemad, Playerpro, Musicolet.

So adding this would be useful when listening to long audio tracks in Poweramp.

 

 

==================

20:27:56.023 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON KEYCODE_MEDIA_REWIND ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=35653104 playerState=1 ==================

20:27:56.026 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON KEYCODE_MEDIA_REWIND ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=35653104 playerState=1 ==================

20:27:56.029 PlayerService BEGIN_REWIND from PSMediaButtonReceiver  ==================

20:27:56.029 PlayerService END_FAST_FORWARD from PSMediaButtonReceiver  ==================

20:28:02.098 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON KEYCODE_MEDIA_REWIND ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=35659179 playerState=1 ==================

20:28:02.101 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON KEYCODE_MEDIA_REWIND ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=35659179 playerState=1 ==================

20:28:02.104 PlayerService BEGIN_REWIND from PSMediaButtonReceiver  ==================

20:28:02.104 PlayerService END_FAST_FORWARD from PSMediaButtonReceiver  ==================

20:28:04.804 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON KEYCODE_MEDIA_REWIND ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=35661885 playerState=1 ==================

20:28:04.807 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON KEYCODE_MEDIA_REWIND ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=35661885 playerState=1 ==================

20:28:04.808 PlayerService BEGIN_REWIND from PSMediaButtonReceiver  ==================

20:28:04.809 PlayerService END_FAST_FORWARD from PSMediaButtonReceiver  ==================

20:28:47.381 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON KEYCODE_MEDIA_REWIND ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=35704461 playerState=1 ==================

20:28:47.385 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON KEYCODE_MEDIA_REWIND ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=35704461 playerState=1 ==================

20:28:47.386 PlayerService BEGIN_REWIND from PSMediaButtonReceiver  ==================

20:28:47.387 PlayerService END_FAST_FORWARD from PSMediaButtonReceiver  ==================

20:28:51.003 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON KEYCODE_MEDIA_REWIND ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=35708084 playerState=1 ==================

20:28:51.006 PlayerService BEGIN_REWIND from PSMediaButtonReceiver  ==================

20:28:51.007 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON KEYCODE_MEDIA_REWIND ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=35708084 playerState=1 ==================

20:28:51.008 PlayerService END_FAST_FORWARD from PSMediaButtonReceiver  ==================

20:29:03.232 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON KEYCODE_MEDIA_REWIND ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=35720313 playerState=1 ==================

20:29:03.235 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON KEYCODE_MEDIA_REWIND ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=35720313 playerState=1 ==================

20:29:03.238 PlayerService BEGIN_REWIND from PSMediaButtonReceiver  ==================

20:29:03.238 PlayerService END_FAST_FORWARD from PSMediaButtonReceiver  ==================

20:29:06.531 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON KEYCODE_MEDIA_REWIND ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=35723612 playerState=1 ==================

20:29:06.533 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON KEYCODE_MEDIA_REWIND ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=35723612 playerState=1 ==================

20:29:06.535 PlayerService BEGIN_REWIND from PSMediaButtonReceiver  ==================

20:29:06.535 PlayerService END_FAST_FORWARD from PSMediaButtonReceiver  ==================

20:29:10.326 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON KEYCODE_MEDIA_REWIND ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=35727408 playerState=1 ==================

20:29:10.328 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON KEYCODE_MEDIA_REWIND ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=35727408 playerState=1 ==================

20:29:10.331 PlayerService BEGIN_REWIND from PSMediaButtonReceiver  ==================

20:29:10.332 PlayerService END_FAST_FORWARD from PSMediaButtonReceiver 

The problem is that your button activity is generating a momentary click action - ACTION DOWN is immediately followed by ACTION_UP.

FFwd and Rewind need the button to provide a press-and-hold action, and the fwd/rew activity will then continue until the button is released again.

Andre

Right, seems @Chrisubuntu device sends short presses. What is the device in question?

I guess for these some pre-defined seek jump may be defined (e.g. 10 sec). Unfortunately all my test BT devices with seek buttons sends long clicks (seek starts and continues while button is pressed and ends when button is released), so I need to get the device which sends short commands for the testing.

@maxmp. I'm using a Samsung Galaxy Note 9 on Android 10 and I remapped the Bixby button (using the app I linked in the original post) to rewind. I also remapped the volume button (double press) to rewind with same results, so you could test using that if you don't have a phone with the Bixby button.

As I said, Rewind is a press-and-hold feature, it is designed to continue to wind backwards for as long as the button is held (it also increases in speed the longer the button is held down by the way). Your app seems to be sending the effect of a single-press (i.e. click or tap) on a KEYCODE_MEDIA_REWIND button, which won't do anything useful as it would stop winding as soon as it starts.

@maxmp I wonder if it might be worth interpreting single-click KEYCODE_MEDIA_REWIND and KEYCODE_MEDIA_FAST_FORWARD events as 10-second jumps?

Andre

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...