简体   繁体   English

android mediaplayer错误seekTo

[英]android mediaplayer wrong seekTo


I use MediaPlayer in my project and have troubles with seek. 我在项目中使用MediaPlayer,但在查找时遇到了麻烦。 For example, I seek forward on 10 mins, but real position in the file is about 1 min from start. 例如,我向前搜索10分钟,但是文件中的实际位置距离开始大约1分钟。 Get GetPosition returns value that I've set but not the real position. Get GetPosition返回我设置的值,而不是实际位置。 Also, If I set position to the end of the file it will not be the end and getPosition returns bigger value than getDuration: 另外,如果我将position设置到文件的末尾,它将不会是end,并且getPosition返回的值大于getDuration:

Log.i(TAG, String.format("%d / %d", mediaPlayer.getCurrentPosition(), mediaPlayer.getDuration() ));

And I got the next: 我得到了下一个:

12-28 19:22:35.452    1344-1429/ru.darklogic.mds I/Player﹕ 3028611 / 2804689
12-28 19:22:35.784    1344-1429/ru.darklogic.mds I/Player﹕ 3028950 / 2804689
12-28 19:22:36.120    1344-1429/ru.darklogic.mds I/Player﹕ 3029290 / 2804689
12-28 19:22:36.452    1344-1429/ru.darklogic.mds I/Player﹕ 3029629 / 2804689
12-28 19:22:36.784    1344-1429/ru.darklogic.mds I/Player﹕ 3029969 / 2804689
12-28 19:22:37.120    1344-1429/ru.darklogic.mds I/Player﹕ 3030282 / 2804689

How can it be and how can I solve it? 怎么可能,我该如何解决?
Thanks. 谢谢。

I got it: it's a trouble with the file. 我知道了:文件有问题。 If same one is interested in figure out what's wrong with the file, it's here: http://mds.kallisto.ru/kallisto/from_rudn/Robert_Shekley_Specialist_Energy.mp3 如果同一个人有兴趣找出文件中的问题,请访问: http : //mds.kallisto.ru/kallisto/from_rudn/Robert_Shekley_Specialist_Energy.mp3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM