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

Iframe optimizations #96

Closed

Conversation

Wyatt-Lutz
Copy link
Contributor

@Wyatt-Lutz Wyatt-Lutz commented Jul 17, 2024

Lazy Loads iframes for youtube videos on home and news pages by creating the iframe element only after the thumbnails for the youtube vidoes are clicked.

@Wyatt-Lutz Wyatt-Lutz closed this Jul 17, 2024
@Wyatt-Lutz Wyatt-Lutz reopened this Jul 17, 2024
@Naviary2
Copy link
Member

Can you show a video of what this looks like, and interact with it?

First impression is this looks kind of looks like a personal preference thing.. what issue does this solve?

@Wyatt-Lutz
Copy link
Contributor Author

Wyatt-Lutz commented Jul 17, 2024

Its a performance boost on page load times, especially for those with poor internet speeds or devices with limited memory resources. Most users in any given site visit will not watch the youtube videos so its unnecessary to fetch them with they aren't required. It also allows you to keep adding youtube videos to the news page without hindering the performance with each video.

Lastly, say the iframe fails to fetch the youtube videos for some reason, it won't create any ui problems until someone wants to watch one of the video.

I do need to make it clearer to users that this is a video though. I can work on that.

unknown_2024.07.17-15.18.1.mp4

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is exactly the same as index.js, I would just combine them into something called like iframeLazyLoader.js, and have both pages request that.

@Naviary2
Copy link
Member

Naviary2 commented Jul 18, 2024

Okay! Seems nice! The only thing I'm worried about is it'll be annoying to have to add the thumbnail to the server files and link it with every new video. Youtube's share button gives you a copyable iframe element which all you need to do is paste, nothing else. Can the thumbnail stuff be automated? Does youtube have a url you can go to to download the thumbnail of a video?

The videos on the news page are a little large, could you also shrink their size?

@Wyatt-Lutz
Copy link
Contributor Author

Yes, I can automate the thumbnails.

@Naviary2 Naviary2 added enhancement New feature or request modification needed A change needs to be made labels Jul 20, 2024
@Naviary2
Copy link
Member

Hey just checking in, seeing if you were still working on this!

@Wyatt-Lutz
Copy link
Contributor Author

Yes, my bad, I have been busy lately.

@Naviary2
Copy link
Member

All good! No rush then

@NoobJsPerson
Copy link
Contributor

my site uses this strategy. i think this link https://img.youtube.com/vi/${videoId}/0.jpg automatically gives you the thumbnail from the video id. https://img.youtube.com/vi/${videoId}/1.jpg seems to give you a smaller version if thats needed

@Naviary2
Copy link
Member

Naviary2 commented Aug 5, 2024

Closing due to inactivity, if more progress is made on this feel free to open up another PR!

@Naviary2 Naviary2 closed this Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request modification needed A change needs to be made
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants