Support » Fixing WordPress » Background Video not playing when first on site

  • Resolved bfarrell4036

    (@bfarrell4036)



    My video when you first visit the site is not playing. If you refresh the page too it doesnt work, but as soon you click the logo and it refreshes the page it works.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Go Huskies!
    Video playing onload for me in Firefox but not chrome.
    What code are you using to embed?

    bfarrell4036

    (@bfarrell4036)

    import { $ } from ‘../../js/src/helpers’;

    export default function init_herovideo() {

    if ($(‘.page__hero’).attr(‘data-herovideo’) ) {
    const $container = $(‘.page__hero’);

    const videoSrc = $container.data(‘herovideo’);

    var $video = ‘<video class=”bigvideo-player” loop autoplay preload=”auto”><source src=”‘ + videoSrc + ‘” type=”video/mp4″></video>’;

    $container.append(<div class="video__player">${$video}</div>);
    }

    }

    To be honest, I am not a coder at all, I am learning as I go as the new Web Assistant.

    _Y_Power

    (@_y_power)

    Hey @bfarrell4036,

    you might want to have a look at this article: I think you should mute the video. Chrome has been putting the policy in place since a while and I think most of the other browser are following or going to follow it…

    • This reply was modified 1 month ago by  _Y_Power. Reason: added user handle
    bfarrell4036

    (@bfarrell4036)

    Anyone have any idea what I need to add to the code to mute it?

    Thanks @_y_power for the tip! I didnt think it would be that as it doesnt even have sound on it anyways.

    I see that I could add

    <video id=”video” muted autoplay>

    But not sure where to add it.

    _Y_Power

    (@_y_power)

    @bfarrell4036,

    I believe you should just add it to your tag.
    Try changing your $video variable to:
    var $video = ‘<video class=”bigvideo-player” loop autoplay muted preload=”auto”><source src=”‘ + videoSrc + ‘” type=”video/mp4″></video>’;

    • This reply was modified 1 month ago by  _Y_Power.
    bfarrell4036

    (@bfarrell4036)

    Hey @_y_power it worked! Now just to figure out how to make that file writeable on the live site. Thank you so much! We just launched today and the problem just came up!

    _Y_Power

    (@_y_power)

    Cool, @bfarrell4036! 😉
    Then please mark this topic as solved and open another topic in case you’ll have other problems.

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