[Resolved] Show Video in Header on Mobile Devices

Home Forums Support [Resolved] Show Video in Header on Mobile Devices

Home Forums Support Show Video in Header on Mobile Devices

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1208658
    Mindy

    Hello, I see in the documentation that videos will not show in the header on mobile. I saw this website today that does still play a video header in mobile: https://www.belmond.com/

    Is there a workaround to get video to play? Thank you!

    #1208700
    Leo
    Staff
    Customer Support
    #1208740
    Mindy

    Okay, I thought I figured it out but not so much…

    #1208762
    Mindy

    So replacing the recommended code from GP:

    <video loop muted autoplay poster="#" class="background-video">
        <source src="videourl" type="video/mp4">
    
    </video>

    With this:

    <video playsinline autoplay muted loop poster="placeholder.jpg" id="bgvideo" width="100%" height="100%">
    <source src="videourl" type="video/mp4">
    </video>

    Along with this CSS:

    video#bgvideo {
    position: fixed;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    z-index: -100;
    -ms-transform: translateX(-50%) translateY(-50%);
    -moz-transform: translateX(-50%) translateY(-50%);
    -webkit-transform: translateX(-50%) translateY(-50%);
    transform: translateX(-50%) translateY(-50%);
    background: url(placeholder.jpg) no-repeat;
    background-size: cover;
    }

    Now the video shows on mobile, but it is no longer the background of the header. It is just a video playing under the title. Any ideas for getting it to be full screen / a full background video?

    Thank you!

    #1208799
    Leo
    Staff
    Customer Support

    Can you try giving the new HTML a class like background-video so you can use the same CSS here?
    https://docs.generatepress.com/article/page-hero-background-video/

    #1208816
    Mindy

    You are a genius! That simple change fixed it! I can’t thank you enough, Leo! You’re amazing!

    #1208820
    Leo
    Staff
    Customer Support

    Awesome to see that you are able to figure out with only little pointers from me 🙂

    Good job!!

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.