Problem/Motivation

My designer noticed a difference in the way that Video Filter displays embedded video from YouTube, compared to other sources like Vimeo. With YouTube videos, we can never get the YouTube viewport on the Drupal page to measure 640x360 for a video with a 16/9 ratio, even when specifying width and height manually, like this.

[video:http://www.youtube.com/watch?v=OE6Rg7xhTrQ width:640 height:360]

The attached screen shot shows how Video Filter appears to interpret YouTube and Vimeo embeds differently.

Digging Into the Code

Video Filter takes the control bar height from the player and sets the variable $control_bar_height.

This code is around line 197 of video_filter.module (7.x-3.x-dev version).

// Default value for control bar height.
$control_bar_height = 0;
if (isset($video['control_bar_height'])) {
  // Respect control_bar_height option if present.
  $control_bar_height = $video['control_bar_height'];
}
elseif (isset($video['codec']['control_bar_height'])) {
  // Respect setting provided by codec otherwise.
  $control_bar_height = $video['codec']['control_bar_height'];
}

Our video aspect ratio is set to 16/9. When I print out the $control_bar_height variable on my dev site, it shows 25 pixels.

Entering this syntax:

[video:http://www.youtube.com/watch?v=OE6Rg7xhTrQ width:640 height:360]

results in a viewport of width="640" height="385". Also, there's a small black stripe a.k.a. letterbox on either side of the video. By following along with the code, you can see how Video Filter calculates a height of 385 for this YouTube clip.

I think the module is causing the problem because:

  • If we manually enter the YouTube code in Full HTML mode, the page looks ok.
  • If I comment out the code above, the page looks ok.
  • We use the exact same code with Vimeo as the source, and the page looks ok.

It seems like YouTube is already accounting for the 25 pixels, and Video Filter is re-compensating for it. Can someone else confirm that they're seeing this behavior of black bars on the right and left sides of YouTube clips?

CommentFileSizeAuthor
video-embed-comparison.jpg157.71 KBjtherkel
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

minnur’s picture

Status: Active » Fixed

Thanks for reporting this. It does appear Youtube already accounting for 25px. I removed control bar height from youtube codec. This should be included in the next release.

  • minnur committed c923814 on 7.x-3.x
    Issue #2273421: YouTube filter causes letterboxing due to control bar
    

  • minnur committed 04d31da on 8.x-1.x
    Issue #2273421: YouTube filter causes letterboxing due to control bar
    
minnur’s picture

Status: Fixed » Closed (fixed)