Acer Iconia A200 上的 VideoView getCurrentPosition() 不规则

发布于 2025-01-08 13:13:51 字数 1610 浏览 3 评论 0原文

我有一个带有 VideoView 的应用程序,我设置了一个要在 VideoView 中播放的视频。视频播放时的某个时刻,它会暂停。然后,在暂停一段时间后,它将再次开始播放视频,但会向前播放到视频没有暂停时的位置。例如,

视频开始播放

视频在 6 秒处暂停

视频暂停 10 秒

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

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

这一切都在 Toshiba Thrive 和 Motorola Xoom 上按预期运行。然而,在 Acer Iconia A200 上,似乎从我向前调用 seeTo() 开始,当我调用 getCurrentPosition() 时,VideoView 将始终返回同一时间。为了说明这一点,我设置了一个可运行程序,大约每 1000 毫秒触发一次,记录当前位置。以下是其中的一些输出:

/****************
* 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 是我传递给eekTo()的确切时间,因此看来在我进行此调用之后,VideoView将始终返回我传递给它的任何内容,无论它是实际上仍在比赛中并且位置正在前进。

以前有其他人经历过这个 VideoView/MediaPlayer 错误吗?我在已知问题组上看到一些内容,讨论 MediaPlayer 返回 getCurrentPosition() 的错误值,但没有找到任何地方会像这样停止增加。我看到的大多数也都在尝试播放音频而不是视频。

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

Video starts playing

Video paused at 6 seconds

video stays paused for 10 seconds

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

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);

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 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.

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

如果没有 2025-01-15 13:13:51

这可能与设备的可用内存量有关。如果内存较低,后台活动可能会与您的计数器一起重新启动。

It may have to do with the amount of free memory of the device. if the ram is low the background activity may restart along with your counter.

年少掌心 2025-01-15 13:13:51

在 Activity 的 onpause 方法中释放并重置视频播放器,并在 Activity 的 onstart mtd 中再次设置。对于eekto,您必须使用计时器来包含用户 videoview 的计时。将eekto 中的计时设置为计时器时间。

release and reset the videoplayer in onpause method of activity and set again in onstart mtd of an activity.for seekto u must use chronometer to contain timing of user videoview.set timing in seekto to the chronometer time.

陌路黄昏 2025-01-15 13:13:51

也许是主 UI 线程超载的问题。由于视频是一个高数据元素,而 acer iconia 不是一个很好的设备,它可能会导致一些数据短缺、异常,甚至可能崩溃。尝试使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文