Only load video scripts when button is pressed

I need help finding a good way to make youtube\vimeo videos only load scripts when a button I make is pressed?

My site I’m working on loads too many scripts without consent and its rubbing me the wrong way.


Here is my site Read-Only: LINK

No simple way (You should know a little JS) “lazy loading effect”.

buggy ui - “click twice” to play

Some solutions not working well (You need to click twice to play the video - this is because on first click chrome block the “autoplay by code” - because the video with sound. chrome auto play policy).

Anyway, in general youtube/viemo iframe (or by API) without autoplay - has a very small impact on the speed of the site .

1 Like

Hi!
I’ve made a small WordPress plugin for Youtube videos (not vimeo sorry). It loads the script and plays videos only after clicking on the play button.
If you want to give it a try and see a demo, it’s here http://thinksmall.me/
If you’re not on WordPress, you’ll still find useful pieces of code in the javascript.
I hope that helps!