Skip to content

⚠️ Remove duplicate YouTube iframe API script load #101

@mather

Description

@mather

The YouTube iframe API script is loaded twice:

  1. Line 263: <script src="https://www.youtube.com/iframe_api"></script>
  2. Lines 269-271: Manual script tag creation

Remove one of the script loads to prevent potential issues:

-  <script src="https://www.youtube.com/iframe_api"></script>
   <script>
     const elem = document.getElementById("yt-player");
     const ytWidth = Math.min(elem.parentNode.clientWidth, 1024);
     const ytHeight = (ytWidth / 16) * 9;

     const tag = document.createElement("script");
     tag.src = "https://www.youtube.com/iframe_api";
     const firstScriptTag = document.getElementsByTagName("script")[0];
     firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

  <script>
    const elem = document.getElementById("yt-player");
    const ytWidth = Math.min(elem.parentNode.clientWidth, 1024);
    const ytHeight = (ytWidth / 16) * 9;

    const tag = document.createElement("script");
    tag.src = "https://www.youtube.com/iframe_api";
    const firstScriptTag = document.getElementsByTagName("script")[0];

Originally posted by @coderabbitai[bot] in #97 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions