r/howdidtheycodeit • u/MikeLumos • Oct 08 '21
Question I've just learned that there's a custom video player for embedding youtube videos on your site, which removes youtube logo, titles, ads, etc. How is that possible?
I didn't realize that it was possible to do this kind of thing. I've always assumed that youtube videos are embedded with the iframe, so you can't customize the player.
How did they do that? Is there an article/tutorial that can help me to figure out how to do something like this?
Is there an open source project that does something similar which I could learn from?
45
Upvotes
14
u/michaelfiber Oct 08 '21
I had to reload their example page a few times before it would clear out CORS and other errors and work. So I'm guessing they're doing some shady stuff to get to the URL of the video file and then embed it directly in the page. The example they post doesn't even need any kind of special player, it just embeds an MP4 in a video tag. The secret sauce is the shady stuff to get around Google's obfuscation of the video file path.
7
u/ReverseTuringTest Oct 09 '21
As a quick aside, YouTube does actually allow some customization of the player when embedding. Not a full brand removal, but something. I think u/qoning is probably right. Why bother reverse-engineering it yourself when you can just use youtube-dl.
1
u/amartyapc Nov 25 '24
hey can anyone guide me how to do this, because the people who seem to know how to do this digress and dont talk about it. can anyone share how to do this without paying for anything i know basics of js and feel with the help of gpt i can recreate your suggestion.
1
u/nig8mare Feb 14 '25
you could do the same with a custom youtube front end
1
u/dev_senpai Oct 09 '21 edited Oct 09 '21
Nice try on marketing ? If not YouTube leverages html 5 player and uses the video as a source but there is customization going on as they have playback.js files and of course custom chrome code as well to get it working more efficient. There are libraries that you could get mp4 file which have been around since like 2000s. I remember as a kid downloading YouTube videos so this I think wouldn’t be difficult to figure out if you did a bit of research or looked at examples on GitHub.
Edit: You could literally make your own custom html 5 player controls(play, next, custom progress bar, add new buttons..etc) very easily as you do have access to the html5 video elements and api on your browser.