VideoView with a ListView

三世轮回 提交于 2019-12-11 09:53:32

问题


I am relative new to Android development. I am working on an app where it is a specific client requirement that I have a scrollable list of videos. These videos must be playable within the scrolling list as embedded views.

My first thought was to use VideoViews in a ListView and use a custom ArrayAdapter to instantiate the VideoViews. After running this I get all kinds of errors, such as:

  • E/MediaPlayer﹕ error (100, 0)
  • E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.IllegalStateException at android.media.MediaPlayer.prepareAsync(Native Method)
  • I/MediaPlayer﹕ path is null
  • D/MediaPlayer﹕ Couldn't open file on client side, trying server side

Upon further research I found many posts suggesting the VideoViews and ListViews do not play well together because of the way ListView recycles views. Most of these posts are quite old though (circa 2011-2013). My question is, has this issue been fixed or is it a fact that VideoViews should not be embedded within a ListView? If not, is there some other acceptable way of having a scrolling list of embedded video players?

I would have thought this was a fairly common requirement of Android apps. I'm only supporting Android 4.0+. Cheers

来源:https://stackoverflow.com/questions/25235712/videoview-with-a-listview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!