paulirish / lite-youtube-embed

A faster youtube embed.
https://paulirish.github.io/lite-youtube-embed/
Other
5.6k stars 259 forks source link

does not work on mobile #163

Closed i1li closed 4 months ago

i1li commented 4 months ago

it just loads the thumbnail and no video on mobile

edit: fixed https://github.com/i1li/lightest-youtube-embed

page200 commented 4 months ago

Have you tried tapping on the thumbnail twice as per https://github.com/paulirish/lite-youtube-embed/issues/149?

Does https://github.com/i1li/lightest-youtube-embed perform well in a comparison like this one?

i1li commented 4 months ago

I just went back and looked at the deploy where this happened, it was actually caused by CSP blocking youtube.com/iframe_api (“script-src”), because I only had youtube-nocookie.com added to the CSP. My fault, but i'll leave this in case someone else is searching with that problem.

The comparison with thumbnail loading is going to be the same, but lightest-youtube-embed eliminates the need for thumbnails, enabling an infinite amount of embeds on a page with no connections at all until clicked. With autoplay turned on there is no thumbnail loaded even after the user clicks to show the video. Ultimately I was less concerned about thumbnails and more about removing the need for the Youtube API altogether. lightest-youtube-embed enables more dynamic placement, including embeds to be inline along text in a paragraph just like a hyperlink. its also more responsive than lite-youtube-embed, and in under 100 lines of code total.

I appreciate Paul sharing his work, and the similar projects, like lazyframe. i'll look at making a companion script that fetches and saves titles and thumbnails locally once, as a final way to minimize all unnecessary user connections