Show Jwplayer preview image from video without image

二次信任 提交于 2019-12-20 03:23:11

问题


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


回答1:


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




回答2:


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




回答3:


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>


来源:https://stackoverflow.com/questions/26887917/show-jwplayer-preview-image-from-video-without-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!