From ec2367589d3c8f9987a5bdf6565bc9fc97eab67d Mon Sep 17 00:00:00 2001 From: Ed Date: Sat, 14 Feb 2026 14:43:39 -0500 Subject: [PATCH] fix(youtubeplayer): use youtube-nocookie.com origin to fix error 152 on iOS YouTube tightened embed verification in 2025, causing error 152-4 for all WKWebView-based YouTube iframe embeds that set origin to 'https://www.youtube.com'. The WKWebView does not send proper HTTP Referer headers for loadHTMLString content, so YouTube rejects the mismatched origin. Change origin to 'https://www.youtube-nocookie.com/embed/' which is the confirmed fix adopted by Flutter (youtube_player_flutter#1087), React Native (react-native-webview#3889), and iOS WKWebView (YoutubePlayer-in-WKWebView#43) communities. --- packages/nativescript-youtubeplayer/index.ios.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nativescript-youtubeplayer/index.ios.ts b/packages/nativescript-youtubeplayer/index.ios.ts index 5c6feae8..fe1c9629 100644 --- a/packages/nativescript-youtubeplayer/index.ios.ts +++ b/packages/nativescript-youtubeplayer/index.ios.ts @@ -41,7 +41,7 @@ export class YoutubePlayer extends YoutubePlayerBase { #state: YoutubePlayerState = YoutubePlayerState.Unstarted; createNativeView() { - this.#origin = 'https://www.youtube.com'; + this.#origin = 'https://www.youtube-nocookie.com/embed/'; const jScript = `var meta = document.createElement('meta'); meta.setAttribute('name', 'viewport'); meta.setAttribute('content', 'width=device-width, shrink-to-fit=YES');