0

I have added a poster image to a video, which is exactly the same dimensions as the video container itself:

Video file information

Video poster file information

My HTML looks like this (deliberately no width and height specified as I want the video to resize with the browser rather than remain fixed):

<video controls
       src="mov/MVI_1880.mp4" 
       poster="mov/MVI_1880_poster.JPG">
</video>

My CSS looks like this (width set to 100% to ensure the video uses the full width of the viewport, and resizes automatically when the browser is resized):

img, video{
        width: 100%;
}

However, when viewing this in either Chrome or Safari in iOS7 (iPhone 5S and iPad Mini), the poster image has black bars to the left and right:

Tried to post a link to an image here but it says I need a reputation of at least 10, to post more than 2 links - you'll just have to find the image on my Flickr site (see first two hyperlinks)

If I specifically set a width and height for the video element, then this problem goes away:

<video controls width="320" height="180"
       src="mov/MVI_1880.mp4" 
       poster="mov/MVI_1880_poster.JPG">
</video>

Tried to post a link to an image here but it says I need a reputation of at least 10, to post more than 2 links - you'll just have to find the image on my Flickr site (see first two hyperlinks)

but I want to avoid this, as the video then remains at a fixed size when resizing the viewport.

I have tried setting a height of auto in the css, but this made no change.

Also worth noting, that this works fine in Chrome on my desktop(i.e. I have no width or height specified in the HTML, and a width of 100% in the CSS), and the poster image correctly sizes to the full width of the viewport:

Tried to post a link to an image here but it says I need a reputation of at least 10, to post more than 2 links - you'll just have to find the image on my Flickr site (see first two hyperlinks)

Any help much appreciated.

Luke Twomey
  • 1,245
  • 1
  • 9
  • 18
  • It looks like your image has those black bars? – Kuzgun Feb 20 '14 at 14:26
  • No, the image has no black bars. If you look at the "Video poster file information" link, you should see a preview of the image at the bottom left of my folder. Maybe you're referring to the first link - of the .mp4 file itself? It does look like black bars there - but it's just what Windows does to the thumbnail to make it look like a movie reel. – Luke Twomey Feb 20 '14 at 14:30

0 Answers0