问题
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
Is it possible to get the image for preview from video source in jwplayer ?
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