Support » Fixing WordPress » No sound in Youtube on Frontpage

  • I try to get volume control in a Youtube movie on the frontpage of my website. But I cannot figure it out. How to solve this”problem”?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator Marius L. J.

    (@clorith)

    Hi,

    Do you mean the video in the Twenty Seventeen theme header? If so there is no audio available, this is intentional as video headers are meant to be visual elements on a site, and not fully functional video players.

    You can extend the filter here and change this behavior, but it does require some code, I don’t know if this is what you are looking to do though?

    I am looking for this. What filter am I looking for. I can code.

    Moderator Marius L. J.

    (@clorith)

    The details about them are mostly outlined in https://make.wordpress.org/core/2016/11/26/video-headers-in-4-7/ which contains a list of all the new functions, hooks and filters it introduced, I’ve not dug into it my self yet but I believe the custom header markup ones might be what you are looking for.

    looks like it set in the JS file here: Line 279

    video.muted = 'muted';

    https://github.com/WordPress/WordPress/blob/5c86bfd20185dcd8ecbeb54bbf43533a84afd75d/wp-includes/js/wp-custom-header.js

    There is no filter or hook that I see that can override this.

    This would require copying this file into your theme and commenting out that line then adding this to your functions.php

    add_action( 'wp_enqueue_scripts', 'replace_scripts', 20 );
    
    function replace_scripts(){
        wp_dequeue_style( 'wp-custom-header' );
        wp_enqueue_script( 'wp-custom-header', get_template_directory_uri() . '/my/version/of/wp-custom-header.js');
    }

    Thanks. I am having the same issue, and would like specific steps (please) on how to “unmute” the audio on my YouTube URL for my Twenty-Seventeen Front Page Header. The video looks great, but I also want the hear the audio. Any ideas? I am not a coder. Thank you.

    It would be fantastic if there was an option in customizer to unmute audio on the homepage. There are plenty of reasons why you’d want to have audio with your video, especially if you are using a clip from youtube. This would make the theme a whole lot more useful.

    This is just an arrangement but it worked for me.
    I changed the contents of the header with javascript. Put it inside a widget or the page.

    
    <script>
    var x = document.getElementById("masthead").clientHeight - 52;
    document.getElementById("wp-custom-header").innerHTML = '<iframe width="100%" height="'+x+'" src="https://www.youtube.com/embed/VIDEOID?rel=0&controls=0&showinfo=0&autoplay=1" frameborder="0" allowfullscreen></iframe>';
    </script>
    

    Hi Kinrpg

    so i must put the following code into a widget or page right?

    <script>
    var x = document.getElementById(“masthead”).clientHeight – 52;
    document.getElementById(“wp-custom-header”).innerHTML = ‘<iframe width=”100%” height=”‘+x+'” src=”https://www.youtube.com/embed/VIDEOID?rel=0&controls=0&showinfo=0&autoplay=1&#8243; frameborder=”0″ allowfullscreen></iframe>’;
    </script>

    • This reply was modified 2 years, 3 months ago by  jkreukniet.
    • This reply was modified 2 years, 3 months ago by  jkreukniet.
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘No sound in Youtube on Frontpage’ is closed to new replies.