Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Do I Play Video in ListView like Instagram and Vine?

I'm new to android development and I am trying to play multiple videos in a listview. Currently, each listview row item is a VideoView. This approach has not worked as the VideoViews act abnormally when I begin to scroll. I've researched here, here, here and discovered that VideoViews and TextureViews don't work well within ListViews and ScrollViews. How are apps like vine and instagram able to play videos in listviews? Any help is greatly appreciated?

like image 672
DollaBill Avatar asked Nov 20 '14 15:11

DollaBill


1 Answers

Although the answer is late but i think it might help someone searching for the same. There is a sample app from the github that has implementation for this requirement.:-

https://github.com/danylovolokh/VideoPlayerManager

For understanding of code refer to the following link it is really helpful for you:-

https://medium.com/@v.danylo/implementing-video-playback-in-a-scrolled-list-listview-recyclerview-d04bc2148429

The problem is that there are some limitations in VideoView in listview and handling playbacks so this library implement is the VideoView based on the TextureView. Here is it how it looks likeenter image description here

like image 63
Karan sharma Avatar answered Oct 23 '22 17:10

Karan sharma