3

I'm setting progress to a SeekBar programmatically using

    val arguments = Bundle()
    arguments.putFloat(
        AccessibilityNodeInfo.ACTION_ARGUMENT_PROGRESS_VALUE,
        seekPosition
    )
    seekBarNode?.performAction(
        AccessibilityNodeInfo.AccessibilityAction.ACTION_SET_PROGRESS.id,
        arguments
    )

Seek happens but the content does not change. However, clicking on the dotted handle manually starts playing at that sought position.

Now, I'd like to click on the SeekBar at the dotted handle (check the image)

Is there a way to get the coordinates for that? I have the SeekBar node with the Rect details but they do not correspond to the dotted handle to perform a click at that position. (I've enabled pointer location updates from Dev options)

enter image description here

Veeresh Charantimath
  • 4,641
  • 5
  • 27
  • 36
  • The seekbar only reflects some state. The video provides new values for the seekbar. The accessiblity action provides new values to the seekbar. Nowhere does it say that that changing seekbar's value changes the video position. The relationship is inverse: video is *model*, seekbar is *view*. View observes model. If you know the progress value you can calculate the new position in video, set the new position in video, and seekbar will observe the new position and update itself (I assume you already have that implemented). – Eugen Pechanec May 04 '20 at 09:19
  • @EugenPechanec the relationship you mentioned is correct. However, I'm controlling a 3rd party app here and the only mutable objects I see to change the video is the SeekBar. What are your thoughts on that – Veeresh Charantimath May 04 '20 at 09:33
  • Hmm, can you get the dimensions of the seekbar and its max value? From that you could compute exact location where to issue a click event. – Eugen Pechanec May 04 '20 at 09:46
  • I have the Rect values of the SeekBar and the max/current value of the range. But how do I issue a click event to the dotted handle? SeekBar coordinates mBoundsInParent = {Rect@12092} "Rect(0, 0 - 1958, 148)" mBoundsInScreen = {Rect@12093} "Rect(53, 768 - 2011, 916)" Range Values - mCurrent = 1078692.0 mMin = 0.0 mMax = 1.0189E7 I don't see any pattern which would lead me to click the dotted handle which is the current position – Veeresh Charantimath May 04 '20 at 09:56
  • Does `AccessibilityNodeInfo.ACTION_SCROLL_FORWARD` work for you? Check if that is working – Tarun Lalwani May 06 '20 at 17:10
  • @TarunLalwani it scrolls, but again I need to click the handle to resume it from that scrolled position – Veeresh Charantimath May 06 '20 at 17:21
  • https://stackoverflow.com/questions/50775698/how-can-i-reliably-simulate-touch-events-on-android-without-root-like-automate, how about you simulate a touch ? `(screenX + (val-min) * width/ (max -min), screenY + height/2)` – Tarun Lalwani May 06 '20 at 17:25
  • how does that correspond to the seek bar handle coordinates? – Veeresh Charantimath May 06 '20 at 17:27
  • @VeereshCharantimath, `screenX`, `screenY` is from `mBoundsInScreen` for the seekbar – Tarun Lalwani May 08 '20 at 03:03

0 Answers0