Maximum height for Facebook video embed

Viewed 614

If I use Facebook's recommended way of embedding videos, I can set a width in pixels. However, as far as the documentation specifies, I can't set the height. I want to display a video so that all of it is visible on the screen, allowing a landscape video to stretch all the way to the edges of the screen, but if I do that with a portrait video, it gets a 100% width, only the top chunk is visible, and the rest spills off the bottom of the screen. I don't know what videos are going to be pulled in, so they could have any orientation; I don't know how wide the embed ought to be until after I've already loaded it.

All I've been able to think of to handle this is to either fetch the video with the Graph API first to get its height and width and then calculate a width to set based on the aspect ratio, or to grab the height of the embed after it loads and then resize it. This is incredibly clunky for a very reasonable feature. Is there any better way?

0 Answers
Related