I embedded YouTube iframe player into my ios application. Everything was working and loading fine then couple days ago when testing the app, I noticed that it no longer plays certain videos and I'm not sure what's causing it. I tested this with multiple videos that still work on the YouTube App but when will no longer play within my application. The thumbnail for the video is shown and as soon as I press play it shows, 'This video is unavailable' in the player window. Some videos still play normally which lets me know that the videoID and loading of the video is working.
Here is the code I'm using to load the video:
let playerVars: [AnyHashable: Any] = ["playsinline" : 1]
self.playerView.load(withVideoId: videoID, playerVars: playerVars)
Below are two images of what the YouTube Iframe player shows before and after play is pressed. Video Preview
I saw that some people were having similar issues and I've tried following their examples on how to fix the issue but nothing has worked for me so far. Can anyone help me fix this problem?
FIX
I was able to finally find a workaround for this issue by changing the first line of code above to this.
let playerVars: [AnyHashable: Any] = ["playsinline" : 1,
"origin": "https://www.youtube.com"]