mpv-android / mpv-android

#mpv-android @ libera.chat
MIT License
1.81k stars 226 forks source link

How to jump to specific time ? #865

Closed KaKi87 closed 2 months ago

KaKi87 commented 3 months ago

Hi,

I'm looking for a way to jump playback position to a specific time with up-to-the-second precision.

Using ADB, I tried running input tap <x> <y> with x = width of is.xyz.mpv:id/playbackSeekbar × targeted position in seconds ÷ media duration in seconds but I end up 5.5 minutes behind.

Then, I noticed that the first and last 25 pixels of the bar actually don't count, but even considering this I'm still almost as far off.

What am I missing in my calculations and is there a better option ?

Additional information

Android version is 6.0.1 and MPV version is 2023-11-30.


Thanks

KaKi87 commented 2 months ago

@sfan5 Please ? :pray:

sfan5 commented 2 months ago

You want to do this from where exactly? adb, another app, termux, ...? Also what's your goal?

KaKi87 commented 2 months ago

You want to do this from where exactly?

ADB.

what's your goal?

Jump to a specific time, e.g. like Ctrl+T on desktop VLC.

Thanks

sfan5 commented 2 months ago

mpv-android does not provide a way to access the IPC so there's no way to do this.

KaKi87 commented 2 months ago

What about using my initial idea : clicking the is.xyz.mpv:id/playbackSeekbar element at the specific pixel position matching a specific time ?

Thanks

sfan5 commented 2 months ago

That's a terrible hack and if you want to do that I wish you good luck at finding out correct offsets.

KaKi87 commented 2 months ago

Well, I managed to do it on Spotify at ± 2 sec accuracy, which is perfect considering it's a much smaller seek bar :

So, I don't understand why doesn't the same calculation work on MPV.

Thanks

KaKi87 commented 2 months ago

Please ?

sfan5 commented 2 months ago

You are on your own to figure this out.