views:

337

answers:

1

I use tumblr to share videos and, unfortunately, when re-posting a video to your tumblelog it uses the embed code at 400x336px. This is neither widescreen nor very large.

So I'm trying to set the player to better size and I'm finding that the youtube player really comes in many sizes. For example, when copying the embed code for and HD video I get the sizes 560x340, 640x385, and 853x505. Then when I look at the embed code for a SD video I get the sizes 425x344, 480x385, and 640x505.

I was having the best luck with setting the player to 640 x 505 as it was large enough for HD and perfect for SD.

print str_replace( array('400', '336'), array('640', '505'), $video_player_html); 

Has anyone dealt with trying to find a good standard embed size for a site? One thing that would make this a lot easier is to know whether the video was HD or not - however, that info is not provided in the embed code.

I guess I am actually more interested in knowing the right ratio (or specific size) to use that works the best for youtube's mixed content.

Update

Since HD seems to be .5625 ratio (16/9) I'm thinking that I can just decide on a hight and multiply it by the ratio to get the proper width each time (plus 23px for youtube bar).

+1  A: 

You don't have to worry about the sizes youtube offers. When you copy the embed code, paste it into a text editor and you'll see it contains width and height parameters in two places. You can change those values to anything at all and the player will resize. So grab your JRuler, figure out what size would be ideal for your tumblelog, and just edit the player code each time.

It's kind of a pain, but it gets you the result you want.

Syntax Error
Since I'm using PHP to import the videos to my real blog I'm just going to create a filter that does what you stated. Seems to work with vimeo also which are the two I was worried about.
Xeoncross