When running the Exoplayer demo application, the default control ui has SeekBar focusable
set as false
. I think this is not good for accessibility, so in my custom UI I changed focusable to true.
However, when using the arrows, the progress does not change. The SeekBar
gets updated, but goes back to the initial position once it is updated.
I also created another SeekBar
for testing purposes, and using arrows keys works fine.
Is there any reason that the Exoplayer developers set it to false, or is there a way to fix it?
It's likely the developers did not consider the SeekBar a suitable component for controlling the video using non-touch input or accessibility services like TalkBack.
You could definitely implement something which worked with the keyboard, at least for desktop modes. E.g. YouTube.com will allow the user to seek back/forward with the left/right arrow keys, even when the SeekBar is not focused.
The SeekBar can be focused too with the tab key, but on Android, the cursor keys are legitimate affordances to navigate between focusable components too, so it's harder to implement the same UX.
On the other hand, you have other accessibility considerations with the SeekBar control too. A key part of the control is the ability to drag - with TalkBack you need two fingers to drag. Since the SeekBar is a small control anyway, it's pretty hard to drag the playhead with two fingers, and even harder if you can't see the playhead.
Why didn't it react when you made the SeekBar focusable and were updating the progress with the keyboard? It checks for user touch input before treating it as a legit seek (I guess there's a couple reasons for this, inc. not constantly seeking while the user drags or so the programmatic SeekBar updates don't trigger further seeks).
Would recommend that you create your own UI using ExoPlayer to handle the media only. That way you'll have explicit control over the UX and UI for your player.
On the YouTube app for example, it displays a different UI if TalkBack is enabled (there are libraries which can aid with this), overlaying skip backwards/forwards buttons onto the screen.
Reference source code: