Best sizes for Youtube embedded players?

I use tumblr to share the video and unfortunately when re-sending the video to your tumblelog it uses the code to embed 400x336px. It is not widescreen and not very large.

So, I'm trying to tune the player to a higher size, and I find that the youtube player does come in many sizes. For example, when I copy embed code and HD video, I get sizes 560x340, 640x385 and 853x505 . Then, when I watch the insert code for the SD video, I get the sizes 425x344, 480x385 and 640x505 .

I was lucky to set the player to 640 x 505 as it was big enough for HD and perfect for SD.

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

Has anyone tried to find a good standard embed size for the site? One thing that will simplify this is to find out if the video was HD or not, however this information is not listed in the embed code.

I think I'm more interested in knowing the correct ratio (or specific size) to use, which is best for youtube mixed content.

Refresh

Since HD seems to be .5625 (16/9), I think I can just select the height and multiply it by a factor to get the correct width each time (plus 23px for the youtube panel).

+4
source share
1 answer

You do not need to worry about the sizes that youtube offers. When you copy the embed code, paste it into a text editor and you will see that it contains the width and height parameters in two places. You can change these values ​​to anything and the player will resize. So, grab a JRuler , find out what size would be ideal for your paper magazine, and just edit the player code every time.

This is some kind of pain, but it gives you the result you want.

+3
source

Source: https://habr.com/ru/post/1306623/


All Articles