我正在根据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
答案 0 :(得分:3)
我曾经注意到getCurrentPosition()
没有返回正确值的类似问题。
见这里:VideoView getCurrentPosition() irregularity on Acer Iconia A200
我从未发现导致它返回错误位置的原因。然而,我采用的解决方法只是通过存储我启动视频的时间戳并参考该时间戳来确定视频播放的时间来跟踪自己的时间。似乎是多余的,但是当内置方法没有时,这至少给了我正确的值。