YoutubeKit icon indicating copy to clipboard operation
YoutubeKit copied to clipboard

Fix YouTube video playback errors by updating base URL to youtube-nocookie.com

Open davidgalarza opened this issue 5 months ago • 2 comments

🐛 Problem

YouTube recently changed their API policies, causing video playback to fail with Error 152 and Error 150 when using www.youtube.com as the base URL for embedded players.

✅ Solution

Updated the base URL from https://www.youtube.com to https://www.youtube-nocookie.com in YTSwiftyPlayer.swift.

🔧 Changes

  • Changed basePlayerURLString constant in YTSwiftyPlayer.swift
  • Uses YouTube's official privacy-focused domain for embedded content

�� Why this works

  • youtube-nocookie.com is Google's official domain for embedded YouTube content
  • Provides same functionality as youtube.com but with enhanced privacy
  • Resolves the recent API changes that broke video playback
  • Follows the same solution implemented in other YouTube libraries (e.g., youtube_player_flutter)

🧪 Testing

  • Video playback now works correctly
  • No more Error 152 or Error 150
  • Maintains all existing functionality

🔗 References

  • Related issue: #109
  • Similar fix: https://github.com/sarbagyastha/youtube_player_flutter/pull/1086

davidgalarza avatar Aug 07 '25 02:08 davidgalarza

Hi, we're using this package in our app, and this PR includes a fix for an issue we're currently facing. Could you please publish a new version with this update? Thanks a lot for your help and great work on the project! cc @rinov @Tibimac

gdncomm-elavarasan-m avatar Oct 28 '25 09:10 gdncomm-elavarasan-m

Hi, we're using this package in our app, and this PR includes a fix for an issue we're currently facing. Could you please publish a new version with this update? Thanks a lot for your help and great work on the project! cc @rinov @Tibimac

Hi @gdncomm-elavarasan-m, sorry for the late reply but it seems that the main and original maintainer is not anymore really involved in the project but I can't affirm it without a confirmation from him. Nevertheless for your request, I'll check it in order to create a new release in next days, hopefully before the end of this month but for sure before the end of the year ^^.

Tibimac avatar Nov 19 '25 17:11 Tibimac