Reputation: 33745
I am interested in using YouTube as my video backend service, where all the videos uploaded to my app are stored in (and played on) YouTube's infrastructure.
The issue is, I don't want my users to be able to easily share them outside of the app.
How do I "lock down" the videos, such that if they wanted to share them they have to do it within the confines of the app functionality and not getting access to the Embed code or just sharing the URL of the video?
Ideally, I would like to be able to do this in a programmatic way via the API.
I know that I can manually upload "Private videos" that I would share with people via their email address, within YouTube's normal interface, but how would that work in an app scenario?
Say I have a class of user (say Coaches
) where every coach that signs up should be able to see all of my videos.
Would I have to programmatically alter the list of users that I add to the 'private parameters' of each video in my database every single time a new coach is added? Then again, the more I think about it, that wouldn't make much sense because it would be my app that is pinging the API (on behalf of that newly registered user) each time, right?
So what would be the best way to approach this, such that all my users that should have access to the video do, but even those users can't share this video outside of my app?
Upvotes: 2
Views: 1763
Reputation: 6791
You can do it using Youtube API.
- The privacy status of the video. The default behavior is for an uploaded video to be publicly visible (
public
). When uploading test videos, you may want to specify a--privacyStatus
argument value to ensure that those videos are private or unlisted. Valid values arepublic
,private
, andunlisted
.
Part of a sample code for Java :
// Set the video to be publicly visible. This is the default // setting. Other supporting settings are "unlisted" and "private." VideoStatus status = new VideoStatus(); status.setPrivacyStatus("public"); videoObjectDefiningMetadata.setStatus(status);
Difference between Private and Unlisted
A private video can only be seen by you and the users you select. The video won't appear on your channel or search results and will be invisible to other users. You can manage the users you want to share a private video with.
Making a video unlisted means that anyone who has the link to the video can view it. Unlisted videos don't show to viewers in the Videos tab of your channel page. Unlisted videos don't show up in YouTube's search results unless someone adds your unlisted video to a public playlist.
To share an unlisted video: Share the link with the people who want to have access to it, and they’ll be able to see it.
Upvotes: 2