Support

Account

Home Forums General Issues How to get exact dimensions for video

Solving

How to get exact dimensions for video

  • Hi all,

    The oEmbed feature in ACF is wonderfull.
    But, there is always a ‘but’…
    How can I make sure my video files (from vimeo) are scaled proportionately.
    Somehow I always end up with a black bar above and beneath the video file.
    And I don’t want that. If the video is 1280×720 I want it to appear relative to these dimensions, meaning that if I DIV with a width of, say, 800 px to show the video, the height must be 450 (this corresponds to the 16:9 rule).

    How can I do that?

  • I found a workaround with the ‘Fluid Video Embeds’ plugin.
    This plugin also uses shortcodes, so I’ve put the shortcode in my template:

    
    $row_video = $select_row['movie'];
    if (!empty($row_video)):
    echo '<div class="video-container">';
    echo do_shortcode('[fve]'. $row_video .'[/fve]');
    echo '</div>';
    endif;
    

    This works, but I would like to see it working directly from ACF without the use of an extra plugin.
    Any suggestions?

  • Hi @woohoo,

    Thanks for the post.

    For some oEmbed providers such as YouTube, you can create an <iFrame> and append player parameters directly to the end of the URL.

    The code would look like so:

    <iframe id="ytplayer" type="text/html" width="640" height="390"
      src="http://www.youtube.com/embed/M7lc1UVf-VE?autoplay=1&origin=http://example.com"
      frameborder="0"/>
Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘How to get exact dimensions for video’ is closed to new replies.