I have a website that includes a lot of embedded YouTube videos; currently these are loaded simultaneously which, of course, causes the site to run extremely slowly when initially loaded.
What is the best way to load an image as a placeholder/splash screen instead of the video iframe?
The image will need to be replaced by the YouTube iframe only when clicked (this should only be loaded when requested), thus reducing the file size of the website dramatically. I have found some similar questions before but they seem to recommend using CSS and jQuery to alter the visibility of the video. This doesn't work in this instance because the video player will still load in the background.
I appreciate any help/suggestions.
Add a placeholder from your computerClick on the video file you have inserted in your PowerPoint. Then click on the 'Format'-menu that appears on top. Click on the 'Poster Frame' dropdown and choose 'Image from File' > 'From a File'. Now you can select the image you want to use and and click 'Insert'.
YouTube thumbnails let viewers see a quick snapshot of your video as they're browsing YouTube. Learn how to create an eye-catching YouTube thumbnail that boosts viewership and is good for YouTube SEO. Follow these YouTube Thumbnails best practices. Matthias Funk. June 12, 2022.
It should be pretty straight forward, try something like this:
<img src="placeholder.jpg" data-video="http://www.youtube.com/embed/zP_D_YKnwi0">
$('img').click(function(){
var video = '<iframe src="'+ $(this).attr('data-video') +'"></iframe>';
$(this).replaceWith(video);
});
Demo: http://jsfiddle.net/2fAxv/1/
For youtube videos, add &autoplay=1
to the URL if you want them to play when the image is clicked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With