Show Jwplayer preview image from video without image
Asked Answered
B

3

3

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

Benne answered 12/11, 2014 at 13:16 Comment(0)
M
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

Mealie answered 12/11, 2014 at 14:6 Comment(3)
Google for "php ffmpeg" (without the quote marks, of course) - lots of information out there.Mealie
Thanks @Mealie : found this : blog.amnuts.com/2007/06/22/…Benne
@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 blog.amnuts.com/2014/10/18/…Gaelic
P
2

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

Premillennialism answered 12/11, 2014 at 15:16 Comment(4)
Tricky. I like it! Won't work on a mobile device, alas, since there's no autostart there.Mealie
Yeah, no mobile support, and also might be bad for bandwidth.Premillennialism
but after video finishes and replay button is shown ... screen has a black preview imageBenne
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.Premillennialism
P
2

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>
Premillennialism answered 13/11, 2014 at 20:25 Comment(2)
it doesn't stop streaming and video start loading.Trudy
Please explain further what you mean, and, at the very least, provide a link to where this isn't working, instead of bumping up an old thread.Premillennialism

© 2022 - 2024 — McMap. All rights reserved.