fix: resolve YouTube Error 153 by adding origin param and removing no-referrer
YouTube's embed API requires knowing the embedding origin to authorize playback. The referrerPolicy="no-referrer" was stripping the Referer header, and the missing origin param meant youtube-nocookie.com couldn't verify the embed source, causing Error 153 (video player configuration error). Fix: pass origin param explicitly and let the browser send the default referrer.
This commit is contained in:
@@ -34,11 +34,10 @@ export function VideoEmbed({ embed }: VideoEmbedProps) {
|
|||||||
{isPlaying && embed.embedUrl ? (
|
{isPlaying && embed.embedUrl ? (
|
||||||
<iframe
|
<iframe
|
||||||
className="absolute inset-0 w-full h-full"
|
className="absolute inset-0 w-full h-full"
|
||||||
src={`${embed.embedUrl}?autoplay=1`}
|
src={`${embed.embedUrl}?autoplay=1&origin=${encodeURIComponent(window.location.origin)}`}
|
||||||
title={embed.title ?? 'Video'}
|
title={embed.title ?? 'Video'}
|
||||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
allowFullScreen
|
allowFullScreen
|
||||||
referrerPolicy="no-referrer"
|
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<button
|
<button
|
||||||
|
|||||||
Reference in New Issue
Block a user