-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Responsive not working with posterImage.show() #1301
Comments
I'm not seeing any obvious issues with the jsbin example provided. Can you fill in the following details?
|
The example is correct (is the one you provided in another post). And what that example achieve is that, once the video is finished, it goes back to it's initial state (poster shown, play button shown, position=0). Like I said, the problem is the compatibility/integration between the attribute posterImage and responsive CSS. When this CSS is present, the poster image will not be shown even if This is a full example of what I am describing. If the wrong part is the CSS provided in my example, could you suggest some other CSS which would make the video responsive and at the same time do not loose the capability to show the posterImage? VideoJS 4.6.3. |
Ok so this makes sense. Really what I would suggest doing would be to restart the player using some of the built-in functionality rather than showing the poster, big play button, etc by hand. However, while debugging this we realized the poster image hasn't been updated to hide / show via CSS yet (pull requests welcome!), so that still needs to be fixed. In the meantime, you can do something like this: var video = videojs('my_video_1');
video.on('ended', function() {
video.trigger('loadstart');
video.posterImage.show(); // This shouldn't be necessary after the fix.
}); |
Changing the script from your code in the example I provided doesn't change anything. The first image is still not shown when the video ends. |
So the issue is that the poster is set to 100% height and width of the parent element, which has no height or width because of the responsive workaround you're using. You can get around this by absolutely positioning the poster image instead, like this: .vjs-poster {
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
} Fixed example. Note to self (and other contributors), this is probably going to be necessary if we implement #982. |
I'm going to close this as an issue and move the comment over to the thread on responsive sizing. Thanks for the catch! |
Like described in this thread, responsive CSS configuration is not working at the same time with the posterImage attribute.
A responsive configuration which works, is described here and the use of posterImage is exemplified here. But both things together do not work.
Is there some solution for it?
The text was updated successfully, but these errors were encountered: