I'm working on an Android app where I need to load an image into an ImageView as a placeholder until a video starts playing. I'm using Glide for image loading and a VideoView for playing the video. The video plays fine, but the image does not load as expected.It seems that the video load faster than the image. I only see a black background and after 1/2 sec the video starts.
fun setBackgroundVideo(videoUrl: String, imageUrl: String){
Glide.with(this)
.load(imageUrl)
.into(binding.thumbnailImage)
..
..
}
I tried also tried without using an imageView but it didn’t work. I tried to pause and start the video to the first frame by using seekTo but I still see the black background. I did some research and I found that: Glide uses the UI thread Glide image loading is asynchronous.
The result I want should be this one: When I go the the page which has the image view i see the first frame of the video and when it’s all loaded it starts. I don’t want to see the black background but the first frame which is passed as an image url.
Thank you for the help.