Using YTPlayerView to play embedded YouTube video in iOS failed with restriction error
By setting the origin
property in my playerVars
I was able to play the embedded video.
let playerVars = [
"playsinline" : 1,
"showinfo" : 0,
"rel" : 0,
"modestbranding" : 1,
"controls" : 1,
"origin" : "https://www.example.com"
]
Then call loadWithVideoId::
as you normally would.
NSDictionary *playerVars = @{
@"origin" : @"http://www.youtube.com",
};
[self.playerView loadWithVideoId:@"videoId" playerVars:playerVars];`
This Objective-C version works for me.