Open Iwaslazkis opened 2 years ago
It seems that i.ytimg.com returns a 404 status code along with a grey box image when the corresponding thumbnail resolution doesn't exist; perhaps we can have the browser query the each possible resolution in descending order and take whichever one return a 200 status code first?
From this short article, it seems that these are all the available resoltutions for the thumbnail:
https://i.ytimg.com/vi/<video_id>/default.jpg
Dimensions: 120x90
This is the default resolution (lowest available).
https://i.ytimg.com/vi/<video_id>/mqdefault.jpg
Dimensions: 320x180
This is called a medium size thumbnail.
https://i.ytimg.com/vi/<video_id>/hqdefault.jpg
Dimensions: 480x360
This is called a high size thumbnail.
https://i.ytimg.com/vi/<video_id>/sddefault.jpg
Dimensions: 640x480
This is called a standard size thumbnail.
https://i.ytimg.com/vi/<video_id>/maxresdefault.jpg
Dimensions: 1280x720
This is the maximum resolution available.
Currently, the extension only looks for the HQ quality thumbnail:
https://github.com/Iwaslazkis/browser-playerctl/blob/ac63dc7cf586868b8e8f5a5c28d7d26e6bb36cd2/extension/providers/youtube.js#L56
Some videos don't have a thumbnail at that quality, and others have better quality thumbnails. It'd be nice to pick out the highest quality one possible.