Reputation: 9848
Is there any workaround where I can use a long or double to seek a position in an audio file in Android? Currently seekTo takes only ints a parameters. I would like to be more precise (like within a tenth of a second)
int resID = getResources().getIdentifier("music_file", "raw", getPackageName());
MediaPlayer mp = MediaPlayer.create(this, resID);
Currently:
mp.seekTo(5);
What I want is more precision:
mp.seekTo(5.2);
Upvotes: 1
Views: 1576
Reputation: 1795
MediaPlayer.seekTo(int)
looks like it uses milliseconds as the parameter.
You need more precision than milliseconds? Or MediaPlayer.seekTo(int)
is going to seconds instead of milliseconds?
From the docs:
public void seekTo (int msec)
Seeks to specified time position. Parameters msec the offset in milliseconds from the start to seek to
Upvotes: 3