Acer Iconia A200上的VideoView getCurrentPosition()不规则 [英] VideoView getCurrentPosition() irregularity on Acer Iconia A200

查看:91
本文介绍了Acer Iconia A200上的VideoView getCurrentPosition()不规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有VideoView的应用程序,我设置了要在VideoView中播放的视频.在播放视频的某个时候,它会暂停.然后,在暂停了一段时间后,它将再次开始播放视频,但请继续尝试,直到视频没有暂停时处于该位置.例如

I have an application with a VideoView in it, I set a video to play in the VideoView. At some point while the video is playing it will get paused. Then after it is paused for some time it will begin to play the video again, but seek forward to the point that the video would be at if it had not been paused. So for instance

视频开始播放

视频在6秒处暂停

视频保持暂停10秒

视频再次开始播放< ---此时,我希望视频在16秒标记处开始播放.

Video starts playing again <--- at this point I want the video to start playing at the 16 second mark.

为了达到这种效果,我已经设置了时间戳以执行所需的数学运算,因此我知道视频被暂停了多长时间,然后当我再次启动它时,我调用了 mVideoView.seekTo(timePlayed+ timePaused);

In order to achieve this effect I have set up time stamps to do the required math so I know how long the video was paused for, and then when I start it up again, I call mVideoView.seekTo(timePlayed + timePaused);

所有这些都可以在Toshiba Thrive和Motorola Xoom上正常使用.但是在Acer Iconia A200上,从我向前调用seekTo()的角度来看,当我调用 getCurrentPosition()时,VideoView总是返回相同的时间.为了说明这一点,我设置了一个可运行的设备,该设备大约每记录1000毫秒触发一次,记录当前位置.这是其中的一些输出:

This all works as intended on Toshiba Thrive, and Motorola Xoom. However on Acer Iconia A200 It seems that from the point that I call seekTo() forward the VideoView will always return the same time when I call getCurrentPosition(). To illustrate this I set up a runnable that fires roughly every 1000ms that logs the current position. Here is some of the output from that:

/****************
* These are from before it is paused/resumed
* you can see that the current time is functioning
* as expected.
******************/
Current Position = 0
Current Position = 734
Current Position = 1735
Current Position = 2703
Current Position = 3737
Current Position = 4738
Current Position = 5739
Current Position = 6740
Current Position = 7741
Current Position = 8742
Current Position = 9743


/**********************************
* These are from the exact same runnable
* after the video has been paused, and
* started again after seekTo().
* The position is no longer increasing.
* Note that the video is playing correctly on the screen
* while these logs happen.
**********************************/
Current Position = 23410
Current Position = 23410
Current Position = 23410
Current Position = 23410

23410是我传递给seekTo()的准确时间,因此看来,在我执行此调用之后,无论它实际是否仍在播放以及位置,VideoView都会始终返回我传递给它的任何内容正在前进.

23410 is the exact time that I am passing in to seekTo(), so it seems that after I make this call the VideoView will always return whatever I pass in to it, no matter if it is actually still playing and the position is advancing.

其他任何人以前都经历过此VideoView/MediaPlayer错误吗?我在已知问题组上看到了一些有关MediaPlayer为getCurrentPosition()返回错误值的事情,但没有发现它会像这样停止增长.我确实看到的大多数影片,也都在尝试播放音频而不是视频.

Has anyone else experienced this VideoView/MediaPlayer bug before? I saw some things on the known issues group that were talking about MediaPlayer returning incorrect values for getCurrentPosition(), but didn't find any where it would just stop increasing like this. Most of the ones that I did see, were also trying to play audio rather than video.

推荐答案

也许这是超载主UI线程的问题.由于视频是高数据元素,而宏cer图标并不是很好的设备,因此可能会导致数据不足,异常甚至崩溃.尝试使用AsyncTask添加视频.

Maybe it is a problem with overloading the main UI thread. Since video is a high data element and the acer iconia not being a great device, it could cause some data shortage, abnormalities and possibly even crashing. Try adding the video using AsyncTask.

这篇关于Acer Iconia A200上的VideoView getCurrentPosition()不规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆