

If your website is responsive then there are plugins to help maintain the aspect ratio when resizing as you suggested. OEmbed provides you with the width and height so you can simply set your width and height as required. This API provides a standard way of accessing embedded content and it's supported by lots of popular services, here are just a few:

#Change aspect ratio youtube video full
You can read the full documentation at the oEmbed website. "author_url": "http:\/\/"author_name": "GoogleTechTalks", You make a HTTP request to the service endpoint, for example:Īnd you recieve a JSON response with the video dimensions (among other useful information). oEmbed is an API for displaying embedded content. It is these black pipes that I'm trying to remove on every video. Most new vimeo videos seem to be width="400" height="225", but my website deals with some older videos that don't share this ratio, so you get black pipes either along the top and bottom of the video or down the sides. but these only work if you set the correct aspect ratio to begin with using the width and height attributes.

I know there are lots of plugins that can help you maintain an aspect ratio for fluid widths, such as Īnd you can achieve it with javascript as described on css-tricks: So, my question is, is there a way I can detect what the aspect ratio of the video should be? I only pass in the vimeo ID dynamically, so I don't set a width and height per video.ĭynamic video ID like this: ?title=0&byline=0&portrait=0" width="400" height="225" frameborder="0"> The trouble is, the aspect ratio is often wrong because I don't set the width and height. So I have a video page where I embed a vimeo video.
