Add poster fallback quality
guilhermeleite-hotmart opened this issue ยท 5 comments
Problem
If maxresdefault or sddefault poster quality doesn`t exist the video gets no thumbnail.
Suggestion
Add fallback poster quality if the originally selected one is not available.
If the api call return a 404 the component could try again using the fallback quality.
@guilhermeleite-hotmart Could you please provide some links that doesn't have maxresdefault or sddefault in order to test a patch?
Thanks!
Sure thing. Here's an example of a video that doens't have maxresdefault but has hqdefault thumbnail.
I think this issue could be a little easier, but as turns out, is a little more complex:
- The request for the image returns 404, but I just call the formatted URL for any specific image, I don't do this trough any form of API call, is a static request to the image
- BUT, it returns an image (the placeholder one): https://i.ytimg.com/vi/jB20NKw3c6I/maxresdefault.jpg, and we return and display it, maybe I should check for an specific size (I found a thread on Stack Overflow), but I don't know if is error prone or not
- If I tried to fetch it directly, I'm making another call likely doubling the number of requests.
The purpose of this lib is always trying to be as fast and as little resource wise on requests. I'll have to think a little more on that but in the meanwhile if have any kind of ideas, please let me know.
Thanks for analyzing the issue and going through all the work to get back to me.
I'll check the code and I'll try to come up with something if possible, even if just a suggestion.
@ibrahimcesar Wouldn't it be possible to only use fetch
and then use the resulting response (if successful) by putting it as a base64 encoded image as a thumbnail?