I’m trying to implement ‘reset’-like functionality for video items loaded with JW Player (5.10).
When the item is displayed first, I store its ‘poster’ and ‘src’ attributes in some sort of cache. When ‘reset’ event handler is called, it retrieves this data – and calls JW Player’ JavaScript API load method:
var contentElement = retrieveCachedData('video', contentId);
// now contentElement looks like this:
// {
// file: '/path/to/videos/video.mp4',
// image: '/path/to/images/video_thumbnail.jpg'
// }
jwplayer(contentId).load(contentElement);
It all goes ok when image property does exist; the same method is used to edit the video, btw. Correct poster and video are displayed both in HTML5 and fallback flash mode.
But somehow things are not so rosy when I try to delete the poster image, assigning an empty string to the image property of contentElement (or dropping this property altogether).
It still works great in the HTML5 mode (when video is stopped, black screen is shown instead of the poster picture). But in the flash mode the existing poster of the video just stays there, as nothing happened.
Does someone have any ideas how to cope with that? I’ve already thought of feeding some already-made ‘blank screen’ URL as image value. But, frankly, this is ridiculous.
You can call
setupon your player instead ofload. This seems to do the trick.In this example you can see how after the video finishes, we force a new setup without the image attribute and the screen removes the older image preview and stays black.