I have a website that has a draft mode. Someone can login and see what the site looks like to approve it before the public can see it. I have YouTube videos on an account that I put on private because I don't want the world to see them.
However, I do want the people who login to 开发者_运维百科the draft mode to be able to watch the private embeds.
Is there a way I can use the YouTube API and do it so the people can only see the videos and not really be logged in as that person (so they cannot modify the video settings) and not be able to stay signed in after leaving my webpage?
Mark your videos as unlisted, not private.
Sometimes, security is about compromise. At one end of the spectrum, you can lock things down completely so that no one can access the data. At the other end, the most usable and accessible data will not be secure.
With that said, you are asking for functionality for N users when the security model you seek is too restrictive and only allows 25 users.
Security and accessibility consists of a balance between an acceptable standard for accessibility while also meeting an acceptable standard for security.
In your situation, marking your YouTube videos as unlisted may provide you with the balance you seek since a 25 user limitation is a show stopper.
http://www.google.com/support/youtube/bin/answer.py?answer=181547
Your videos can be accessed by anyone who has the link, which would only be the users who have access to your system. The link is not public, so it's very unlikely that someone will guess or find your YouTube videos, as the URL's themselves consist of random characters.
The only way other people could access the videos is if your logged-in users go into the browser source, after logging in, and email the URLs to their friends.
- Your users don't need YouTube accounts.
- Videos are only accessible to users who login OR users who login, view source, and give the URL to other users.
- Security could be mitigated by periodically changing the urls for the videos.
Steps to mark your video as unlisted:
- Click on your video to load it in YouTube.
- At the top left, click "Edit Video Detail"
- Scroll down to where it says "This video is" and in the drop down list, select "Unlisted".
First of all, you can't retrieve the video itself via the api.
All you'll get is an link to embed or redirect your user.
So ultimately, your user will watch the video himself, without you as the man in the middle.
Therefore you will be looking for something like password protection of your video.
A quick google search brought up this.
You can change the broadcast privacy option to private. Then your "specific users" will need YouTube accounts and will need to "friend" you (or vice versa). You then edit the broadcast privacy option of the video to add the friends (up to 25) to the video. They will automatically be sent a "shared with you message". They sign into their YouTube account and they are able to watch the video.
When authenticating with the user who uploaded the video in the API you should be able to retrieve those private videos too (see Developers Guide: Retrieving Uploades).
Disclaimer: I don't do youtube api def, I couldn't test it.
If YouTube isn't working for you for security of your videos, you could consider using FlowPlayer Free to host the videos on your own network and then use the free flash player on your website. This would allow you to make all URLS accessible only by authenticated users.
http://flowplayer.org/download/index.html
Here is an example of their demo running on my local webserver, with the video hosted on a local Apache server.
精彩评论