Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add poster fallback quality #28

Open
guilhermeleite-hotmart opened this issue Sep 16, 2021 · 5 comments
Open

Add poster fallback quality #28

guilhermeleite-hotmart opened this issue Sep 16, 2021 · 5 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@guilhermeleite-hotmart
Copy link

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.

@ibrahimcesar ibrahimcesar added the enhancement New feature or request label Sep 17, 2021
@ibrahimcesar ibrahimcesar self-assigned this Sep 17, 2021
@ibrahimcesar
Copy link
Owner

@guilhermeleite-hotmart Could you please provide some links that doesn't have maxresdefault or sddefault in order to test a patch?

Thanks!

@guilhermeleite-hotmart
Copy link
Author

Sure thing. Here's an example of a video that doens't have maxresdefault but has hqdefault thumbnail.

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

@ibrahimcesar ibrahimcesar added the help wanted Extra attention is needed label Sep 18, 2021
@ibrahimcesar
Copy link
Owner

ibrahimcesar commented Sep 18, 2021

@guilhermeleite-hotmart

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.

@ibrahimcesar ibrahimcesar added the good first issue Good for newcomers label Sep 18, 2021
@guilhermeleite-hotmart
Copy link
Author

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.

@FunctionDJ
Copy link
Contributor

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants