How Does YouTube Fetch and Stream Data on the Client Side?

0
5
Asked By CleverCod3r92 On

As a web developer familiar with JSON for backend communication, I'm curious about how YouTube operates on the client side when it comes to fetching and streaming data. I noticed that in the network tab, things seem different compared to standard JSON requests. Can someone explain the process they use to fetch content on YouTube?

3 Answers

Answered By TechGuru88 On

YouTube definitely uses JSON, but the way they layer everything is more complex than most sites. You might be seeing a lot of wrapped responses and multiple calls that aren't immediately obvious.

DevDude42 -

I just see gibberish in the network tab, that's why I’m confused!

Answered By CodeNinjaX On

After checking out YouTube in my network tab, I did see some JSON responses. It would help if you could share an example of what you're seeing that you think isn't JSON.

Answered By StreamMaster99 On

When I use the network tab on YouTube, I spot POST requests to an endpoint like rr2---sn-cpux-gpme.googlevideo.com/videoplayback, which returns a custom format specifically for Google streaming. They likely extract MP4 fragments and use the browser's Media Source Extensions (MSE) API to play videos. Plus, it's interesting that they use QUIC for their data transfer since it's better suited for video streaming.

FilmFanatic21 -

Using UDP makes total sense for video delivery!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.