I need to create an auto slider of images and videos
where I have used viewpager with FragmentStatePagerAdapter for changing the fragments. Inside the fragments I have used exoplayer where I play video when the fragment is visible and release the resource once the video play is complete.
It is working as expected if there are more than 3 videos or images. But if there are only 2 videos then it shows black screen for the second video. How to clear the exoplayer instance before changing the fragment?