Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does youtube prevent video from being downloaded from their HTML5 player?

I'm writing a video player in HTML5. I tried to see what Youtube was doing to prevent somebody from just grabbing the source (ie: the .src URL) and then downloading the video file, but it does not seem to be visible.

  • So how do they do it?

  • Have people found a way around it?

  • Is it some complicated DRM implementation?

like image 710
pratikm Avatar asked Jul 08 '14 15:07

pratikm


People also ask

How do I stop an HTML video from being downloaded?

Just add controlsList="nodownload" in your video tag.

Is YouTube an HTML5 video?

YouTube now defaults to HTML5 <video> Over the last four years, we've worked with browser vendors and the broader community to close those gaps, and now, YouTube uses HTML5 <video> by default in Chrome, IE 11, Safari 8 and in beta versions of Firefox.

Can I make my YouTube videos not downloadable?

there is no way to prevent illegal downloads. also if you are referring to the youtube premium download feature, you cannot prevent that either, but since people can only view videos they have downloaded on the youtube app, you still get paid for downloaded views.

Can anyone download my YouTube video?

YouTube does not allow you to download videos directly from their site. You need to use a third-party service, install software, or get a YouTube subscription service to download a YouTube video.


2 Answers

First and foremost Youtube videos are downloadable There are browser extensions, 3rd party websites and more for downloading from youtube. In fact, any video that can be played on a browser via Internet is downloadable.

However, embedding a video directly using a HTML5 video tag is super easy to download.

Take the e example code from w3schools

<video width="320" height="240" controls>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>

You can just Right click >Save as the video to download it.

There are other aspects too, which makes this approach of directly embedding video unusable in a service like Youtube. Features like video track selection, used for allowing multiple resolution, streaming the video rather than downloading the whole video before even playing, live streaming are just not possible with this direct approach.

Buffer approach Using this approach, the video element just points to a buffer, where data is pushed dynamically using Javascript. Using this approach allows the features mentioned above which are not possible with the direct approach.

Check out this article on medium to understand about building your own media streaming HTML5 player.

If you use this approach, then users of your website can not Right click> Save on your video to download it. They can, however use a browser plugin to do so.

like image 95
Rituraj Borpujari Avatar answered Oct 24 '22 23:10

Rituraj Borpujari


As I found on Quora:

The videos posted on YouTube are first encrypted with 128- bit SSL encryption, which is very tough to crack. Also, for longer clips the software breaks up each file into many URLs with unique addresses, which makes it impossible to download the video in one go.This also helps the software to better detect when the video is being downloaded and the identity of the person downloading the video since each URL is uniquely generated.

Also to get to know more about how to break the video into parts check for adaptive streaming formats such as HLS and DASH. Also recommend you to check for HLS Streaming with the file extension of .m3u8.

Also there are companies has services that known as Video on Demand(VoD) that would help you.

If you need a player for your videos I recommend VideoJs which is open source and in my opinion very powerful.

like image 22
Mehdi Shahamirian Avatar answered Oct 24 '22 22:10

Mehdi Shahamirian