40

On sites where you convert a YouTube link to an embedded player (which apparently doesn't include MSO, so I can't put an example directly in this post), can you use 16:9 aspect ratio instead of 4:3? It's much more common these days. Here's an example


How it is today

Example of 16:9 YouTube video embedded in 4:3 player.


How it could be

Example of 16:9 YouTube video embedded in 16:9 player.

5
  • 7
    so... why all the downvotes?
    – Kip
    May 30, 2011 at 16:02
  • 1
    Downvotes here usually mean disagreement, so people probably don't like your proposal.
    – Kevin Ji
    May 30, 2011 at 16:58
  • 7
    Yeah.... not sure about the downvotes on this one? Could someone explain? (+1 so it gets back on the homepage)
    – Jon Seigel
    May 30, 2011 at 17:27
  • 4
    Maybe they don't care for widescreen. Maybe you didn't provide a good enough reason. Maybe there's no point. Maybe widescreen isn't as common as you think for those things that are illustrated via YouTube videos.
    – random
    May 31, 2011 at 19:39
  • The YouTube API will actually give the video ratio, so SE shouldn't have to decide which ratio to use: it should ask YouTube.
    – TRiG
    Feb 18, 2015 at 14:43

2 Answers 2

16
+500

Starting with the next build, youtube embeds will be 640x385px (25px for the player), a 16:9 ratio.

This won't affect existing posts, since the conversion is done at the time of a save/edit. If you want a post to switch to the new format, simply edit it.

0
19
+400

For anyone who would like this, I wrote a Grease Monkey script to fix it. You can find it over on StackApps.

Edit: That StackApps link is dead, unless you have enough rep to view deleted posts. I deleted it because there's no need for it anymore; as noted in accepted answer, they made this change in the StackExchange code.

For anyone interested in the code from a purely academic perspective, here it is:

// ==UserScript==
// @name           StackExchange embedded YouTube in 16:9
// @namespace      stackexchange
// @description    Changes YouTube videos embedded in StackExchange pages to use widescreen format.
// @include       http://stackoverflow.com/*
// @include       http://meta.stackoverflow.com/*
// @include       http://superuser.com/*
// @include       http://meta.superuser.com/*
// @include       http://serverfault.com/*
// @include       http://meta.serverfault.com/*
// @include       http://*.stackexchange.com/*
// @author         Kip Robinson - http://stackoverflow.com/users/18511/kip
// ==/UserScript==

(function() {

  function with_jquery(f) {
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.textContent = "(" + f.toString() + ")(jQuery)";
    document.body.appendChild(script);
  }; 

  with_jquery(function($) {
      var attrs = {width: 640, height: 360};
      if($.browser.webkit)
        attrs.height = 390; //for some reason, embedded YouTube player uses different settings in Chrome
      $('embed[src*="youtube"],embed[src*="youtu.be"]').attr(attrs).parent().css(attrs);
    }
  );
})();
3
  • 1
    Thank you for this, +1 for the script
    – Maverik
    Aug 1, 2011 at 10:54
  • That URL has been removed. The link is broken. Feb 18, 2015 at 0:17
  • 1
    @DenilsonSá updated with the source code. Although you don't need a browser extension anymore to do this.
    – Kip
    Feb 18, 2015 at 14:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .