Reputation: 11
I try to embed YouTube video in iOS app with the iframe generated by YouTube, but I can't show the video in HD.
The iframe that I generate is without suggestions, player controls, and Best privacy. I try to put the parameter vq=hd1080
and vq=large
and not work.
The size of the iframe I apply the same size of the screen:
webView.loadHTMLString("<html><body style=\"(margin:0)\"><embed width=\"\(view.frame.width)\" height=\"\(view.frame.height)\" src=\"https://www.youtube.com/embed/*********?rel=0&showinfo=0\" frameborder=\"0\" allowfullscreen></embed></body></html>", baseURL: nil)
The size of the WebView is full screen.
Upvotes: 1
Views: 1788
Reputation: 42449
What you're seeing is a byproduct of the iFrame API on mobile.
According to discussion on this issue on YouTube's iOS Helper Class repo (which just loads the iFrame player in a UIWebView for you, rather than having to set everything up manually), YouTube does not allow developers to force high quality video to prevent excessive data usage on mobile devices.
Further discussion (and workarounds) can be found in these questions:
Youtube iFrame API setPlaybackQuality ignored on mobile device
Loading Youtube iFrame API video at a lower quality
Upvotes: 2