Android:MediaPlayer getCurrentPosition()陷入困境

我正在根据MediaPlayer更新SeekBar。 它会不时停下来更新进度,卡住了,我得到的值相同。 (然而,声音没有发生抖动。)这些是我的logcat消息,我打印出进度,你可以看到它在2048年前一直很顺利,然后它停下来,过了一段时间它会继续更新。 这是为什么? (我注意到,自从Android 4.0以来,我的另一部手机与android 2.2没有这样的问题)

01-28 16:41:21.446: D/MyMediaPlayer(10342): progress:  56 / 10472
01-28 16:41:21.501: D/MyMediaPlayer(10342): progress:  107 / 10472
01-28 16:41:21.556: D/MyMediaPlayer(10342): progress:  158 / 10472
01-28 16:41:21.610: D/MyMediaPlayer(10342): progress:  209 / 10472
01-28 16:41:21.657: D/MyMediaPlayer(10342): progress:  261 / 10472
01-28 16:41:21.704: D/MyMediaPlayer(10342): progress:  311 / 10472
01-28 16:41:21.759: D/MyMediaPlayer(10342): progress:  362 / 10472
01-28 16:41:21.806: D/MyMediaPlayer(10342): progress:  413 / 10472
01-28 16:41:21.837: D/dalvikvm(307): GC_CONCURRENT freed 1835K, 16% free 19932K/23495K, paused 3ms+12ms, total 101ms
01-28 16:41:21.860: D/MyMediaPlayer(10342): progress:  458 / 10472
01-28 16:41:21.907: D/MyMediaPlayer(10342): progress:  514 / 10472
01-28 16:41:21.962: D/MyMediaPlayer(10342): progress:  565 / 10472
01-28 16:41:22.009: D/MyMediaPlayer(10342): progress:  616 / 10472
01-28 16:41:22.063: D/MyMediaPlayer(10342): progress:  667 / 10472
01-28 16:41:22.118: D/MyMediaPlayer(10342): progress:  718 / 10472
01-28 16:41:22.165: D/MyMediaPlayer(10342): progress:  770 / 10472
01-28 16:41:22.212: D/MyMediaPlayer(10342): progress:  820 / 10472
01-28 16:41:22.267: D/MyMediaPlayer(10342): progress:  2048 / 10472
01-28 16:41:22.313: D/MyMediaPlayer(10342): progress:  2048 / 10472
01-28 16:41:22.368: D/MyMediaPlayer(10342): progress:  2048 / 10472
01-28 16:41:22.415: D/MyMediaPlayer(10342): progress:  2048 / 10472
01-28 16:41:22.470: D/MyMediaPlayer(10342): progress:  2048 / 10472
01-28 16:41:22.524: D/MyMediaPlayer(10342): progress:  2048 / 10472
01-28 16:41:22.571: D/MyMediaPlayer(10342): progress:  2048 / 10472
01-28 16:41:22.626: D/MyMediaPlayer(10342): progress:  2048 / 10472
01-28 16:41:22.673: D/MyMediaPlayer(10342): progress:  2048 / 10472
01-28 16:41:22.727: D/MyMediaPlayer(10342): progress:  2048 / 10472
01-28 16:41:22.774: D/MyMediaPlayer(10342): progress:  2048 / 10472
01-28 16:41:22.829: D/MyMediaPlayer(10342): progress:  2048 / 10472
01-28 16:41:22.884: D/MyMediaPlayer(10342): progress:  2048 / 10472
01-28 16:41:22.931: D/MyMediaPlayer(10342): progress:  2048 / 10472
01-28 16:41:22.985: D/MyMediaPlayer(10342): progress:  2048 / 10472
01-28 16:41:23.032: D/MyMediaPlayer(10342): progress:  2048 / 10472
01-28 16:41:23.087: D/MyMediaPlayer(10342): progress:  2048 / 10472
01-28 16:41:23.142: D/MyMediaPlayer(10342): progress:  2048 / 10472
01-28 16:41:23.188: D/MyMediaPlayer(10342): progress:  2048 / 10472
01-28 16:41:23.243: D/MyMediaPlayer(10342): progress:  2048 / 10472
01-28 16:41:23.290: D/MyMediaPlayer(10342): progress:  2048 / 10472
01-28 16:41:23.345: D/MyMediaPlayer(10342): progress:  2048 / 10472
01-28 16:41:23.392: D/MyMediaPlayer(10342): progress:  2048 / 10472
01-28 16:41:23.454: D/MyMediaPlayer(10342): progress:  2054 / 10472
01-28 16:41:23.501: D/MyMediaPlayer(10342): progress:  2105 / 10472
01-28 16:41:23.556: D/MyMediaPlayer(10342): progress:  2155 / 10472
01-28 16:41:23.602: D/MyMediaPlayer(10342): progress:  2207 / 10472
01-28 16:41:23.657: D/MyMediaPlayer(10342): progress:  2258 / 10472
01-28 16:41:23.712: D/MyMediaPlayer(10342): progress:  2309 / 10472
01-28 16:41:23.751: D/MyMediaPlayer(10342): progress:  2360 / 10472
01-28 16:41:23.813: D/MyMediaPlayer(10342): progress:  2411 / 10472

我曾经注意到getCurrentPosition()没有返回正确值的类似问题。

请参阅此处:Acer Iconia A200上的VideoView getCurrentPosition()不规则

我从来没有发现是什么导致它返回错误的位置。 然而,我采用的解决方法只是简单地通过存储时间戳来记录时间,我开始播放视频并引用该时间戳来确定视频播放的时间。 似乎多余,但这至少给内部方法没有正确的价值。

链接地址: http://www.djcxy.com/p/88593.html

上一篇: Android: MediaPlayer getCurrentPosition() gets stuck

下一篇: When seekBar updating Android's MediaPlayer video is not smooth