问题在Android videoView [英] Problem with videoView on Android

查看:357
本文介绍了问题在Android videoView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Android上使用2 VideoViews一个问题。

I had a problem using 2 VideoViews on Android.

我知道,我不能在同一时间使用2 VideoViews。

I know that I can't use 2 VideoViews at the same time.

这是我的工作流程。


  1. 创建2 videoViews。

  2. 其中隐藏1。

  3. prefetch第一videoView。

  4. 播放第一VideoView。

    • 在不同的线程我prefetch第二视频

我试图让当前时间和开关之前保存它,然后在第一视频查看回来然后使用seekTo(LastCurrenttime),但缓冲区已经一去不复返了(最后currentTime的前)。

I tried to get the current time and save it before the switch and then when the first video view comes back then I use seekTo(LastCurrenttime), but the buffer is gone (before last currentTime).

你还是知道,如果缓冲区是静若处vid​​eoViews只使用一个缓冲区?

do you know if the buffer is static or if the videoViews use only one buffer?

为什么videoView不保存videView的最后状态? ((currentTime的或缓冲区的状态?

Why does the videoView not save the last state of the videView? ((currentTime or the buffer state?

有没有办法做到这一点,而不做seekTo功能?

Is there a way to do this without doing the seekTo function?

推荐答案

我的理论是,因为第一个VideoView被隐藏,这意味着暂停()和resume()正在呼吁视图。如果你搜索暂停,并在<一个'简历' href=\"https://android.googlesource.com/platform/frameworks/base/+/4b9a8d75b8796ea07cadd61ceef135c173167c8e/core/java/android/widget/VideoView.java\"相对=nofollow>来源$ C ​​$ C为VideoView ,你可以看到的MediaPlayer实例被释放并重新分配。

My theory is that because the first VideoView is being hidden this means suspend() and resume() are being called on the view. If you search for 'suspend' and 'resume' in the source code for VideoView, you can see that the MediaPlayer instance is released and reallocated.

我的建议是,你创建一个定制的VideoView会修改这一行为。

My suggestion is that you create a customized VideoView that modifies this behavior.

我展示了如何在<一个定制VideoView href=\"http://stackoverflow.com/questions/7990784/videoview-not-playing-video-from-desired-position/11938019#11938019\">my回答7990784 。

使用为出发点,你可以重写简历()函数的避免调用openVideo()。

Using that as a starting point, you could rewrite the resume() function to avoid the call to openVideo().

这篇关于问题在Android videoView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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