How do I link to snapshots of embedded flash videos instead of the actual flash videos to reduce loading times of a site?
+4
A:
Yes, and in fact this is a method that is often employed. You start with an image with a play button overlay. When it's clicked, the image element is replaced with a flash element that plays the video.
Perhaps something like the following:
<script>
$(function () {
$("img.thumbnail").click(function (e) {
$(e.parentNode).addClass("play");
});
});
</script>
<style>
.toggler .player { display: none; }
.toggler.play .player { display: block }
.toggler.play .thumbnail { display: none }
</style>
<div class="toggler">
<img class="thumbnail" src="thumbnail.jpg">
<div class="player">
<!-- embed your player here -->
</div>
</div>
Ates Goral
2009-09-15 16:12:26
Yes, what is the method for doing that? :)
Absolute0
2009-09-15 16:13:36
You could use ffmpeg to extract a single frame from the source video. I would use jQuery for DOM manipulation. Are you looking for code?
Ates Goral
2009-09-15 16:17:14
Yes a code example would be great.
Absolute0
2009-09-15 16:20:46
How do you make the screenshot be an actual frame from the video?Something mid-video would be great!
Absolute0
2009-09-15 16:28:55
With ffmpeg, you can use the arguments -ss 1 -vframes 1 -r 1 to extract the frame at the first second into the movie.
Ates Goral
2009-09-15 17:01:48
You can either generate the thumbnail manually, ahead of time, or by calling ffmpeg at the backend to generate it on demand. See http://github.com/atesgoral/instaflavor for a PHP example.
Ates Goral
2009-09-15 17:04:37