Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Custom Secure Video Viewer

Hello Treehouse!

I want to make a custom HTML5 Video Player that does not allow the user to gather the source of the video.

So when they right click on it playing, they won't see a "copy video url" or "go to video source" or "open video elsewhere" or anything like that.

How would I be able to make a player like this, and what technology (preferable free) could I use to host the videos? They range in size from 10mb to 750mb.

(Youtube is not an option, unless you know of a way to make it more secure that it already is.)

Thank you!

1 Answer

Sue Dough
Sue Dough
35,800 Points

Anyone who is determined to get your videos will. They can view the source code. You can't disable people from viewing source. Disabling this only make people more determined. I suggest water marking instead.

It's to thwart the average teenager from sharing my videos. Watermarks are an option but won't work for my scenario.

The video should only be viewable from a website that I host, and users have to login to be able to see the videos. Therefore I just want to prevent non-logged in users from being able to access the video anywhere else, and prevent logged in users from being able to share those videos; Basically the type of system that treehouse uses to show us videos.

Sue Dough
Sue Dough
35,800 Points

You could use wordpress. You can user the is user logged in function from wordpress.

if ( is_user_logged_in() ) {
    echo 'check out this awesome video!';
} else {
    echo 'You are not a user and can not access this content!';

Or you can use a variety of different plugins that will restrict content based on users being logged in, user roles, etc.

Disabling those options you originally mentioned seems to me security through obscurity. Trying to hide your videos from getting out is not possible if some teenager is determined. However do what you think is best for your situation. I hope the answer above helps.

As a teenager, I know anybody determined enough can get it. Because I know if I'm determined enough, I could get it.

Similarly, I am determined to make this as secure as possible. Thank you for the help!