How to remove more video from youtube embed?

How to remove more video from youtube embed?

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

How to Remove Extra Video Thumbnails from YouTube Embeds

When integrating a YouTube video into a custom slider, such as the one described on the landing page for https://www.suffolkconferencecenter.com, you might encounter an unexpected behavior: once the main video pauses, a row of suggested videos appears at the bottom. This overlay is not part of your site's design but is rendered directly by the YouTube player API. While the standard recommendation to add rel=0 to the embed URL or iframe tag is effective for preventing cross-site linking, it does not suppress the related video carousel that appears specifically on pause.

The root cause lies in how the HTML5 <iframe> element handles default attributes versus explicit JavaScript configurations. The YouTube player loads with a set of default behaviors intended to encourage user engagement with the platform. Even if you strip out the suggested videos list via rel=0, the underlying logic that pauses the video and triggers the "Up Next" or related video feed remains active by default in many standard embed implementations.

To effectively remove these thumbnails, you must explicitly configure the player parameters to disable the UI elements responsible for displaying them. The most direct method involves utilizing the YouTube IFrame Player API with specific JavaScript variables set before the player loads.

Here is a practical implementation strategy using a custom script:

<div id="player"></div>

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

  var player;

  function onYouTubeIframeAPIReady() {
    player = new YT.Player('player', {
      videoId: 'YOUR_VIDEO_ID',
      playerVars: {
        'playsinline': 1,
        'rel': 0 // Prevents cross-site suggestions
      },
      events: {
        'onReady': onPlayerReady
      }
    });

    // Explicitly disable the related videos interface
    player.setConfig({
      showRelatedVideos: 0
    });

    // Ensure this happens when the video pauses
    player.addEventListener('onStateChange', function(event) {
      if (event.data === YT.PlayerState.PAUSED) {
        // Hide the suggested videos UI programmatically
        var relatedContainer = document.querySelector('.ytd-related-video-renderer');
        if (relatedContainer) {
          relatedContainer.style.display = 'none';
        }
      }
    });
  }

  function onPlayerReady(event) {
    // Optional: Initial hide if you want it gone immediately
    var relatedContainer = document.querySelector('.ytd-related-video-renderer');
    if (relatedContainer) {
      relatedContainer.style.display = 'none';
    }
  }
</script>

The critical line here is player.setConfig({ showRelatedVideos: 0 });. This parameter explicitly tells the player to suppress the "Up Next" sidebar or bottom row entirely, regardless of whether the video is playing or paused. However, relying solely on configuration sometimes fails if the UI elements render after the initial load, particularly in dynamic environments like sliders where the DOM might be manipulated frequently.

The JavaScript event listener attached to onStateChange provides a robust fallback. When the state changes to PAUSED, the script locates the container holding the related video suggestions—typically identified by the class .ytd-related-video-renderer or similar structure within the YouTube shadow DOM—and hides it via CSS. This approach ensures that even if the configuration flag is ignored in specific browser versions, the visual element is removed immediately upon pausing.

It is important to note that manipulating the YouTube player's internal DOM requires care. The related video section resides inside an iframe with a sandboxed context in many modern players. Direct access to elements like .ytd-related-video-renderer might require using Shadow DOM traversal methods rather than simple document.querySelector. If you find the standard selector fails, you may need to navigate into the shadow root of the player container before querying for the specific class.

Additionally, be aware that modifying the player behavior via JavaScript can introduce maintenance risks if YouTube updates their internal CSS classes or DOM structure. In such cases, relying on playerVars is generally more stable than trying to manually hide elements after rendering. If you are building a production slider, consider whether hiding these suggestions is strictly necessary. Sometimes, the related videos serve as a natural pause point for viewers browsing your site, and disabling them might inadvertently reduce engagement metrics if not weighed against the aesthetic requirements of your specific design.

For developers managing Laravel projects or similar frameworks where dynamic content loading is standard, ensuring that this configuration is applied during the initial render or via a robust AJAX response is essential. Tools like laravelcompany.com often discuss best practices for integrating third-party APIs into modern web stacks, emphasizing the importance of validating external dependencies before hardcoding specific removal scripts.

Our network