Closed anvesh523 closed 8 years ago
@anvesh523 If you know the size of video based on item position or view type, then simply set view size in onBindViewHolder like the following.
if (position == 0) {
holder.mVideoView.getLayoutParams().width = 500;
holder.mVideoView.getLayoutParams().height = 500;
}
If you dont know the size and wanna use the video size, then u may need to wait for OnPreparedListener callback to get the video size. So do something like the following in onPrepared.
videoView.getLayoutParams().width = videoView.getVideoWidth();
videoView.getLayoutParams().height = videoView.getVideoHeight();
videoView.requestLayout();
However, I believe this is not good practice as an item of recyclerview since u need to wait some time to get the size of video. This causes non-smooth scroll.
Still, thank you for some solution..
Right now in sample project FrameLayout height is 300dp. If I changed to match_parent / wrap_content the video is not playing. So, height & width of the video should be set to video view. Can you add this in your library itself or please let me know how can I do my self !