-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
The YouTube iframe API script is loaded twice:
- Line 263:
<script src="https://www.youtube.com/iframe_api"></script> - 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
Labels
No labels