title: Embedding a Youtube/Vimeo video with the correct aspect ratio
body: <p>So I have a video page where I embed a vimeo video. The trouble is, the aspect ratio is often wrong because I don't set the width and height. Leaving me with black bars on the video. I only pass in the vimeo ID dynamically, so I don't set a width and height per video. </p>
  
  <p>Dynamic video ID like this:</p>
  
  <pre><code>&lt;iframe src="http://player.vimeo.com/video/&lt;?php echo $videoID; ?&gt;?title=0&amp;amp;byline=0&amp;amp;portrait=0" width="400" height="225" frameborder="0"&gt;&lt;/iframe&gt;
  </code></pre>
  
  <p>So, my question is, is there a way I can detect what the aspect ratio of the video should be?</p>
  
  <p>I know there are lots of plugins that can help you maintain an aspect ratio for fluid widths, such as;
  -<a href="http://fitvidsjs.com/">http://fitvidsjs.com/</a></p>
  
  <p>and you can achieve it with javascript as described on css-tricks:
  -<a href="http://css-tricks.com/NetMag/FluidWidthVideo/Article-FluidWidthVideo.php">http://css-tricks.com/NetMag/FluidWidthVideo/Article-FluidWidthVideo.php</a></p>
  
  <p>-- but these only work if you set the correct aspect ratio to begin with using the width and height attributes. </p>
  
  <p>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. </p>
  
  <p>It is these black pipes that I'm trying to remove on every video.</p>
  
  <p>Appreciate any suggestions,</p>
  
  <p>Alsweet</p>