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.
Related
I want to use the YouTube API to check for a current livestream and get it's URL. The livestream is UNLISTED.
I can successfully get information on my PUBLIC livestream from my channel using this:
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=MyChannelId&type=video&eventType=live&key=MyApiKey
However it does not return any results when the livestream is UNLISTED.
What am I missing here?
EDIT:
I am using PHP if that matters.
It appears that this is probably what I am trying to implement: https://developers.google.com/api-client-library/php/auth/service-accounts
And perhaps I will need to use liveStream or liveBroadcast? https://developers.google.com/youtube/v3/live/getting-started
This is the intended feature for any UNLISTED videos/streams. They cannot be accessed like regular vids. UNLISTED vids can only be accessed through:
anyone who knows the video's unique video ID can retrieve the video
metadata.
as mentioned in Youtube properties.
Also Jeff Posnick of Youtube answered in this google forum:
The public videos feed doesn't contain any information about private
or unlisted videos, so they won't be returned in the results.
I have made a video private https://www.youtube.com/watch?v=mqKtBWC3RrU because i dont want everyone to see those video.
Is there a way to create youtube embed link with the API for private video so that I can share that link to anyone and they can view it using the link.
I have a youtube account with some private videos and I want to embed those private videos in my website. Only users who are registered with my website and are logged in to my website should be able to see/play those videos. Also, It is required that they should not be able to open the video using the link in another tab without logging into my website, thus keeping the videos as unlisted is not an option. Any ideas? Thanks in Advance!
It's not possible, when a video is private on YouTube, only you can see the video.
Plus once the video is private you cannot emebed the video.
The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.
https://developers.google.com/youtube/iframe_api_reference
The only solution you have is to not use YouTue service but upload directly the video on your server and use the default HTML5 player. This way you can manage that only connected user can view the videos.
I basically want to make a video "private", but then use some code to display it public on my site. Is that possible?
It seems like "unlisted" is what I want. According to this article:
An unlisted video is a different type of private video. "Unlisted" means that only people who know the link to the video can view it (such as friends or family to whom you send the link). An unlisted video will not appear in any of YouTube's public spaces (such as search results, your channel, or the Browse page). An unlisted video is different to a private video in these ways: you don't need a YouTube account to watch the video (you can see an unlisted video if someone sends you the video's link) there's no 25 person sharing limit
Still not sure if this is really going to help me keep prying eyes away from the video, but for now, it seems to do what I want.
How I can integrate Youtube with iOS? Mainly I want to play private videos without asking for login. Login should be hard coded in the app and will not ask user before playing the private video.
Some YouTube videos can be played back in a MPMoviePlayerController - some cannot. When you query a video through the YouTube Data API https://developers.google.com/youtube/2.0/reference#Videos_feed
you'll get back all the content types available for a particular videos, including the Flash player, 3GPP, MP4 (if available), etc. You can use these URLs to load up a MPMoviePlayerController.
This is perfectly fine, but as I've said - not all videos are available to embed this way. Some videos (mainly ones that require adverts to be displayed) can't be put into native controllers.