My iOS app is going to have private and public videos, and users can purchase private ones. Right now I'm using YouTube and the youtube-ios-player-helper library for video hosting. Loading a public video is extremely easy:
playerView.loadWithVideoId("M7lc1UVf-VE")
but how do you do it in the most simplistic way for private videos? Is there something as simple as:
let playerVars = [
"username": username,
"password": password,
]
playerView.loadWithVideoId("M7lc1UVf-VE", playerVars: playerVars)
or something equally as simple?
If you look at the YouTube Embedded Players and Player Parameters API Documentation, you will see that there is no way to pass in a user's credentials.
The only way to play private videos in a web view like the YTPlayerView
helper class is to take control of the web view and have the user log into their YouTube account, and then play back the Private video in that specific web view session only. YouTube suggests marking videos as Unlisted rather than Private for playback on mobile devices.
Related discussion can be found in this similar question about the Android player and this Google Groups post.