• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Muted AutoPlay YouTube Video Playlist

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Muted AutoPlay YouTube Video Playlist

This topic is: not resolved

Tagged: youtube

  • This topic has 2 replies, 2 voices, and was last updated 11 years, 1 month ago by Kimberly Coleman.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • May 16, 2015 at 5:41 pm #152433
    Kimberly Coleman
    Member

    Does anyone know of a good plugin that automatically plays a muted YouTube playlist when a visitor comes to a page.
    (Do you Ginger Coolidge/ @gscoolidge ?)

    I thought that I had it solved but I can only do a muted autoplay for an individual video (not a playlist). In case anyone needs to do that, below is the code:

    1. Place this code in header.php (Just substitute your desired height, width and video id):
    <script>
    // 2. This code loads the IFrame Player API code asynchronously.
    var tag = document.createElement('script');

    tag.src = "https://www.youtube.com/iframe_api";
    var firstScriptTag = document.getElementsByTagName('script')[0];
    firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

    // 3. This function creates an <iframe> (and YouTube player)
    // after the API code downloads.
    var player;
    function onYouTubeIframeAPIReady() {
    player = new YT.Player('player', {
    height: '195',
    width: '260',
    videoId: '5sh3WENk7l8',
    events: {
    'onReady': onPlayerReady,
    'onStateChange': onPlayerStateChange
    }
    });
    }

    // 4. The API will call this function when the video player is ready.
    function onPlayerReady(event) {
    event.target.setVolume(0);
    event.target.playVideo();
    }

    // 5. The API calls this function when the player's state changes.
    // The function indicates that when playing a video (state=1),
    // the player should play for six seconds and then stop.
    var done = false;
    function onPlayerStateChange(event) {
    if (event.data == YT.PlayerState.PLAYING && !done) {
    // setTimeout(stopVideo, 6000);
    done = true;
    }
    event.target.setVolume(0);
    }
    </script>

    2. Place the following code where you want the video to play (i.e. in a sidebar text widget):
    <div id="player"></div>

    Take care,
    Kimberly

    http://selfishmom.com/
    May 21, 2015 at 8:15 pm #153181
    Brad West
    Member

    This guys code is working for me: http://stackoverflow.com/questions/13369406/attempting-to-mute-sound-on-youtube-video-playlist-autoplay

    May 26, 2015 at 10:33 am #153660
    Kimberly Coleman
    Member

    Thank you @Brad West. I will try it.

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble