2

I am using jwplayer 6.10, I am having multiple video getting uploaded dynamically.

To show image preview for jwplayer I need to use below in setup

image: "myimage.jpg",

Is there any way to make jwplayer preview images without using this image: "myimage.jpg",

I am trying to avoid creating preview image from server side using video but if that is last option let me know how to do that

So I have two questions

  1. Is it possible to get the image for preview from video source in jwplayer ?

  2. If its not possible, How do you create thumbnails from video

Hitesh
  • 3,592
  • 9
  • 36
  • 77

3 Answers3

3

The answer to question number one is "no." JW Player is a steering script - it doesn't touch the video file at all, nor does it include any utilities for manipulating it.

Probably your best bet for extracting thumbnails server-side is with ffmpeg:

https://trac.ffmpeg.org/wiki/Create%20a%20thumbnail%20image%20every%20X%20seconds%20of%20the%20video

MisterNeutron
  • 3,361
  • 3
  • 15
  • 20
  • Google for "php ffmpeg" (without the quote marks, of course) - lots of information out there. – MisterNeutron Nov 13 '14 at 12:28
  • Thanks @MisterNeutron : found this : http://blog.amnuts.com/2007/06/22/create-a-random-thumbnail-of-a-video-file/ – Hitesh Nov 13 '14 at 12:36
  • @hitesh If it were the preview thumbnails you wanted to create (rather than just the single poster image) then you may also like to check out http://blog.amnuts.com/2014/10/18/create-video-thumbnail-previews-for-jw-player/ – Andy Nov 28 '14 at 23:29
2

You could also fake a preview image like this - http://support.jwplayer.com/customer/portal/articles/1439795-example-a-poster-less-preview

emaxsaun
  • 4,086
  • 2
  • 11
  • 13
  • Tricky. I like it! Won't work on a mobile device, alas, since there's no autostart there. – MisterNeutron Nov 12 '14 at 16:31
  • 1
    Yeah, no mobile support, and also might be bad for bandwidth. – emaxsaun Nov 12 '14 at 17:35
  • but after video finishes and replay button is shown ... screen has a black preview image – Hitesh Nov 13 '14 at 08:28
  • 1
    Yes, because it is going into a stopped state. However, I have a fix for that, you can stop one second before the end. I am going to make an answer below with the updated example code. – emaxsaun Nov 13 '14 at 20:21
1

Here is how to do this, sample code:

<!DOCTYPE html>
<html>
<head>
    <title>Fake Image</title>
</head>
<body>
    <script src="http://p.jwpcdn.com/6/10/jwplayer.js" type="text/javascript"></script>
    <div id="container"></div>
    <script>
    jwplayer("container").setup({
      file: "http://content.bitsontherun.com/videos/bkaovAYt-kNspJqnJ.mp4",
      autostart: true,
      mute: true,
      controls: false
    });

    setTimeout(function() { 
      jwplayer().pause();
      jwplayer().setMute(false);
      jwplayer().setControls(true);
    },3000);

    jwplayer().onTime(function(object) {
        if (object.position > object.duration - 1) {
            jwplayer().pause();
        }
    });
    </script>
</body>
</html>
emaxsaun
  • 4,086
  • 2
  • 11
  • 13