Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
Need help with Keymap for Next / SkipNext / PageUp
#1
I had been trying to get the fastforward/rewind buttons on my firetv remote to skip to the next/previous video. When mapping to Next/Previous or SkipNext/SkipPrevious, it seems to ignore the assignment and default to fastforward/rewind. When I connect a keyboard, pageup/pagedown does exactly what I want but mapping the remote buttons to pageup/pagedown still result in fastforward/rewind.

I also have the fastforward/rewind buttons mapped to pageup/pagedown in globally and that works fine to pageup/down lists, but they just don't behave as expected during full screen video.

Below is my keymap. Some entries seems redundant or unnecessary, but I'm still explorer a way to make it work.

xml:
<keymap>
  <global>
    <keyboard>            
      <fastforward>PageDown</fastforward>
      <rewind>PageUp</rewind>
      <PageUp>PageUp</PageUp>
      <PageDown>PageDown</PageDown>
    </keyboard>
  </global>
  <FullscreenVideo>
    <keyboard>
      <PageUp>PageUp</PageUp>
      <PageDown>PageDown</PageDown>
      <fastforward>PageUp</fastforward>
      <rewind>PageDown</rewind>
    </keyboard>
  </FullscreenVideo>
</keymap>

So I'm not sure if this is a general kodi issue or something specific to the android build.
Reply
#2
Updated 18.1 to 18.2 and it kind of seems worse: PageUp and PageDown on a real keyboard now no longer jump to the next/previous video. So now i don't know if I should still try to troubleshoot the keymap if the desired function may not even work anymore.

Also, this page doesn't even show commands SkipNext or SkipPrevious so maybe sometime during the life of kodi these commands were replaced by simply Next and Previous?
Reply
#3
I think this may be a specific bug with the android version where SkipNext and SkipPrevious don't work.

To test this, I load the following on both windows and my firetv, both running 18.2.
xml:
<FullscreenVideo>
    <keyboard>
      <PageUp>SkipNext</PageUp>
      <PageDown>SkipPrevious</PageDown>
    </keyboard>
</FullscreenVideo>
When viewing music videos, windows is able to skip to previous and next video.
On android, SkipNext does nothing and SkipPrevious goes to the start of the current video.
Reply
#4
(2019-04-23, 08:07)badbob001 Wrote: I think this may be a specific bug with the android version where SkipNext and SkipPrevious don't work.

To test this, I load the following on both windows and my firetv, both running 18.2.
xml:
<FullscreenVideo>
    <keyboard>
      <PageUp>SkipNext</PageUp>
      <PageDown>SkipPrevious</PageDown>
    </keyboard>
</FullscreenVideo>
When viewing music videos, windows is able to skip to previous and next video.
On android, SkipNext does nothing and SkipPrevious goes to the start of the current video.
What happens if you use PlayerControl(next) and PlayerControl(previous)?

scott s.
.
Reply
#5
I've tested with three android devices: firetv cube, firetv 4k stick, and pixel xl (phone). Both firetv devices are fire os6, which is equivalent to Android Nougat (Android 7.1.2, level 25). The pixel phone is on Android Pie (API level 28). I pair a bluetooth keyboard to each and use the following keymap:

xml:
<keymap>
  <FullscreenVideo>
    <keyboard>
      <home>SkipPrevious</home>
      <end>SkipNext</end>
      <PageUp>Previous</PageUp>
      <PageDown>Next</PageDown>
      <rewind>PlayerControl(Previous)</rewind>
      <fastforward>PlayerControl(Next)</fastforward>
    </keyboard>
  </FullscreenVideo>
</keymap>

On the pixel phone, all three button combinations work as expected in kodi.

On the firetv devices, Next is ignored and Previous results in a rewind to the start of the video. But if I open up youtube, which is simply the youtube running on the silk browser, and open a video playlist, the rewind and fastforward buttons on the keyboard will youtube to jump to the previous or next video. So the os itself can recognize those buttons.

Was the android version of kodi built for a particular android api level? This posting mentions that start with api 26, android's handling of the media button event is different: https://stackoverflow.com/questions/4596...tons-issue
Quote:In Android 8.0 (API level 26) the handling of media button events is different:
  1. The handling of media buttons in a UI activity has not changed: foreground activities still get priority in handling media button events.
  2. If the foreground activity does not handle the media button event, the system routes the event to the app that most recently played audio locally. The active status, flags, and playback state of a media session are not considered when determining which app receives media button events.
  3. If the app's media session has been released, the system sends the media button event to the app's MediaButtonReceiver if it has one.
  4. For every other case, the system discards the media button event.
 

Here is more info on android's guideline on handling media buttons: https://developer.android.com/guide/topi...diabuttons
Quote:Handling media buttons in an active media session
On Android 5.0 (API level 21) and higher, Android automatically dispatches media button events to your active media session by calling onMediaButtonEvent(). By default this callback translates the KeyEvent into the appropriate media session Callback method that matches the key code.

Prior to Android 5.0 (API level 21), Android handles media button events by broadcasting an intent with the 
ACTION_MEDIA_BUTTON action. Your app must register a BroadcastReceiver to intercept these intents. The MediaButtonReceiver class was designed specifically for this purpose. It is a convenience class in the Android media-compat library that handles ACTION_MEDIA_BUTTON and translates the incoming Intents into the appropriate MediaSessionCompat.Callback method calls.

A MediaButtonReceiver is a short-lived BroadcastReceiver. It forwards incoming intents to the service that is managing your media session. If you want to use media buttons in systems earlier than Android 5.0 you must include the MediaButtonReceiver in your manifest with a MEDIA_BUTTON intent filter.:
xml:
<receiver android:name="android.support.v4.media.session.MediaButtonReceiver" >
   <intent-filter>
     <action android:name="android.intent.action.MEDIA_BUTTON" />
   </intent-filter>
 </receiver>
In kodi's log, I see entries like this:
Quote:2019-04-26 00:52:32.825 T:12170   DEBUG: CXBMCApp::onReceive - Got intent. Action: android.intent.action.MEDIA_BUTTON
2019-04-26 00:52:32.826 T:12170    INFO: Got MEDIA_BUTTON intent: 88, up:false
2019-04-26 00:52:32.830 T:12288   DEBUG: GetAlbumsByWhereJSON - query took 49 ms
2019-04-26 00:52:32.850 T:12190   DEBUG: Keyboard: scancode: 0x58, sym: 0x00b1, unicode: 0x0000, modifier: 0x0
2019-04-26 00:52:32.850 T:12190   DEBUG: HandleKey: prev_track (0xf0bb) pressed, action is SkipPrevious
2019-04-26 00:52:32.892 T:12270   DEBUG: CVideoPlayer::SetCaching - caching state 2
2019-04-26 00:52:32.892 T:12270   DEBUG: CDVDClock::SetSpeedAdjust - adjusted:0.000000
2019-04-26 00:52:32.892 T:12282   DEBUG: CDVDAudio::Pause - pausing audio stream
2019-04-26 00:52:32.893 T:12270   DEBUG: demuxer seek to: 0.000000
2019-04-26 00:52:32.893 T:12270   DEBUG: SeekTime - unknown position after seek
2019-04-26 00:52:32.893 T:12270   DEBUG: demuxer seek to: 0.000000, success
and
Quote:2019-04-26 00:53:01.863 T:12170    INFO: Got MEDIA_BUTTON intent: 87, up:false
2019-04-26 00:53:01.878 T:12190   DEBUG: Keyboard: scancode: 0x57, sym: 0x00b0, unicode: 0x0000, modifier: 0x0
2019-04-26 00:53:01.878 T:12190   DEBUG: HandleKey: next_track (0xf0ba) pressed, action is SkipNext
2019-04-26 00:53:02.100 T:12170   DEBUG: CXBMCApp::onReceive - Got intent. Action: android.intent.action.MEDIA_BUTTON
The use of android.intent.action.MEDIA_BUTTON seems to indicate that kodi's media button code is from at most android 5.0 api 21. Perhaps some logic is needed to handle different android versions? But it works on android 9's api 28 so maybe the newest api fixes a compatibility issue in an earlier api?

But I'm not sure why the same issue occurs when mapping to non-media buttons like pageup or home. The underlying code for next/previous may also be affected by different android api levels.

Full debug logs here: https://paste.kodi.tv/kecifubide.kodi
In this session, I navigate to my Music Videos, view a video, and use each of the six assigned keys three times.
Reply
#6
Just tried the same test on my retired FireTV 1 device, which is Fire OS 5 - Android 5.1 (API Level 22). Exact same problems, so perhaps the next/previous issue has never worked on firetv devices? I guess it could be an issue with Leia so I'll try a downgrade later.

I see some threads that say this issue is new with Leia:
https://forum.kodi.tv/showthread.php?tid=339375
https://forum.kodi.tv/showthread.php?tid=331475

So this could be two issues:
  • fastforward/rewind buttons remapping issue under leia
  • next/skipnext/previous/skipprevious not working under leia
Reply

Logout Mark Read Team Forum Stats Members Help
Need help with Keymap for Next / SkipNext / PageUp0