<!--

Source - https://stackoverflow.com/a

Posted by Bart

Retrieved 2025-12-18, License - CC BY-SA 4.0

-->


<!doctype html>

<html lang="en">

<head>

  <meta charset="utf-8" />

  <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />

  <meta name="referrer" content="strict-origin-when-cross-origin" />

  <title>YouTube Embed Relay</title>

  <style>

    html, body { height: 100%; margin: 0; background: #000; }

    iframe { width: 100%; height: 100%; border: 0; display: block; }

  </style>

</head>

<body>

  <iframe

    id="player"

    allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen"

    allowfullscreen

    referrerpolicy="strict-origin-when-cross-origin"

  ></iframe>

  

  <script>

    const u = new URL(location.href);

    const v = u.searchParams.get('v');

    const base = 'https://www.youtube-nocookie.com/embed/' + encodeURIComponent(v || '');

    const params = new URLSearchParams({

      enablejsapi: '1',

      rel: '0',

      modestbranding: '1',

      playsinline: u.searchParams.get('playsinline') || '1',

      autoplay: u.searchParams.get('autoplay') || '0',

      origin: location.origin

    });

    if (!v) document.body.textContent = 'Missing ?v=VIDEO_ID';

    else document.getElementById('player').src = `${base}?${params}`;

  </script>

</body>

</html>