0

I'd like to display a thumbnail of a WebM file without generating image with ffmpeg.

  • HTML5 Video Player can download and run WebM files
  • WebM files are video files indexed and ordered
  • Some webserver handle chunks to return part of a file

Is there a trick to display a still image of a webm in an or a light player ?

Jean-Philippe Encausse
  • 1,491
  • 2
  • 22
  • 40

1 Answers1

0

You can just put the video in the document, with no controls and no autoplay, and set video.currentTime to whatever frame you want to show.

(I haven't tried this on every browser... there might be situations where you would need to tell the video to play first just to force it to load. Then you'd have to wait for the "playing" or "canplay" event, pause it, and set currentTime.)

Depending on the browser and server, it might or might not download the whole video file. Once you've got it to the frame you need, you could potentially prevent it from continuing to download the rest of the file by copying from the video to a canvas, and discarding the video. This wouldn't be guaranteed to work, though.

No matter what, this is, of cours, really inefficient if you're going to show the same thumbnail many times on different pageloads. In that case you really should generate an image once and use that.

aldel
  • 6,489
  • 1
  • 27
  • 32