[Resolved] Set Video Block Width and Height

  • Author
    Posts
  • #15482

    ememk
    Participant

    Is there a way to set the width and height of the video block in the page code editor? The size of the video (mp4) is too large and I would like to change the width and height. I know how to do it with Youtube embeds, but not in the code editor that looks like this:

    <!– wp:video {“id”:2945} –>
    <figure class=”wp-block-video”><video controls src=”http://websitename.com/wp-content/uploads/2021/03/videoname.mp4″></video></figure&gt;
    <!– /wp:video –>

    I want the video to be at most width=”560″ height=”315″

    Do I need to adjust it using CSS? I tried:

    .stackItem {
    width: 50%;
    height: 50%;
    }

    I tried:

    .stackItem {
    max-width: 560px;
    max-height: 315px;
    }

    Neither worked

    #15483

    Andrew Misplon
    Keymaster

    Hi, thanks for reaching out.

    I’m not sure about the Block Editor. It’s possible to set the width and height using the video shortcode as seen here https://www.ostraining.com/blog/wordpress/video-size/.

    #15484

    ememk
    Participant

    I used the shortcode block and input the information in the way recommended in the link you posted, but the video doesn’t display live. Here is what I put into both an HTML block and in a shortcode block and neither worked.

    [video width="560" height="315" http://websitename.com/wp-content/uploads/2021/03/videoname.mp4%5D

    We don’t want to embed a Youtube video (where I can set the size in the html) since it always shows ads and other video options we cannot control when the video completes.

    #15485

    ememk
    Participant

    The shortcode didn’t display right in my post above it actually ends .mp4] not 4%5D.

    #15486

    ememk
    Participant

    I’ve put the video block within column block and then used additional CSS in the column block to set the max width and max height to meet my criteria so now the video is the right size. However, I selected the video and chose to center it, but it isn’t centering it live. Any ideas on how to fix that?

    #15487

    ememk
    Participant
    This reply has been marked as private.
    #15489

    Andrew Misplon
    Keymaster

    Thanks. You can perhaps try in Appearance > Custom CSS or Customize > Additional CSS:

    .videocol {
    margin: 0 auto;
    }
    #15491

    ememk
    Participant

    That worked! Thank you!

    #15495

    Andrew Misplon
    Keymaster

    Glad to hear that helped 🙂

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘Set Video Block Width and Height’ is closed to new replies.

Scroll to top