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?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
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 like
For playing videos in Listview, you need to open Video on Item Click of ListView then you can retrieve your video url in String like:
Now pass this myUrl to next Activity and just set this String as a
Now in your next Activity retrieve it as a
In some case, for setting VideoView,you can use:
as from Android Scrollview having videoview is giving problem
Instead of VideoView you can also try using TextureView for reference you can see number 2 reference:
For more reference for video streaming ... you can check the following url: 1>http://developer.samsung.com/android/technical-docs/Android-Media-Streaming-Tutorial
2>http://developer.android.com/reference/android/view/TextureView.html