Reputation: 4254
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?
Upvotes: 11
Views: 7779
Reputation: 464
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.
Upvotes: 3
Reputation: 167
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.
Upvotes: 4