How to load thumbnail of YouTube video from Url with and without Glide

To load thumbnail of video from Youtube we need internet permission. It is necessary declare INTERNET permission in AndroidManifest. 

AndroidManifest.xml file

Here is our design layout activity_main.xml

To load thumb from YouTube video we need Video Id and Url.

For example this video. We have url

https://www.youtube.com/watch?v=KpbGMxmOZDQ

Copy the video id from url after v= i.e KpbGMxmOZDQ.

Now to load Medium quality image use mqdefault.jpg and for High quality image mqdefault.jpg  with the url https://img.youtube.com/vi/KpbGMxmOZDQ/hqdefault.jpg 

Our Kotlin code to load thumb from YouTube video with Glide and without Glide.

MainActivity.kt


Leave a Comment

Your email address will not be published. Required fields are marked *