I have an mp3 file, and my application should look for some selected time of this mp3 file, and then start playing from there.
I convert my string time with this method to int value
private static int convert(String time) { int quoteInd = time.indexOf(":"); int pointInd = time.indexOf("."); int min = Integer.valueOf(time.substring(0, quoteInd)); int sec = Integer.valueOf(time.substring(++quoteInd, pointInd)); int mil = Integer.valueOf(time.substring(++pointInd, time.length())); return (((min * 60) + sec) * 1000) + mil; }
Note: my bites are like this 5:12.201 , which means 5 minutes and 12 seconds and 201 milliseconds.
I got these times from the MP3 Audio Editor application (this is for windows) and I checked the theme with the KMPlayer application (this is for windows). And these times were right for both of them.
But in my application, when I search for my MediaPlayer , by this time the sound does not start from the position I have chosen. (The time is right, but the sound is different.)
I thought MediaPlayer not right at this time. So I checked the current position by calling getCurrentPosition() before playing, but the return value and the sought value were the same.
I have no idea about this.
Edit:
My problem is not time conversion.
I convert and search there correctly, but he plays what was not expected at this time.
This means that the time is different in KMPlayer and Android.
My question is the way? and how can this be solved?