educative.io

Streaming from CDN

the API for streaming (streamVideo(api_dev_key, video_id, offset, codec, resolution)) dictates it returns a Stream to the client app (presumably making use of HTTP 2.0?).

It’s unclear to me how introducing a CDN would work given this API. If the server is no longer serving the content, and instead relying on the client to stream from the CDN, then the return type of this contract appears to be broken.

Is the assumption that the client would first check the CDN, and if the video is not found, it would then hit the stream() endpoint?

1 Like

Dear Oliver,

Thanks for reaching out to us. We have contacted the author of this course. Soon you will be reached out for your query by the author.

Happy learning !!

If you have any further concerns/questions/comments, please let us know.

Best Regards,
Technical Content Development Team

Any update? A lot of questions are in “we will get back to you mode” with no answers even after months. Would have expected better response from a paid service.

1 Like

In Netflix case, they serve all traffic from their CDN called Open Connect. The Netflix client will always stream from the closest Open Connect box. When a user hit play a video, the request goes to the server and the server returns a few closest CDN end-points to the client. The client then cherry picks which of these end-points will it load the video from. Take a look at this post:

Aslso this interview: https://scaleyourcode.com/interviews/interview/11

2 Likes

Yeah, but does this work for Youtube? Netflix has a small collection of fixed video while Youtube has so much more videos that just can’t be store in every CDN. I’m sure that CDN for youtube would required some sort of popular algorithm which dictate which video will be store in each CDN based on location. If someone searches for a video that isn’t popular enough to be in the CDN then it would hit the server.

5 Likes

Actually it does not stream. Browser keeps sending request for next chunk cdn url from video serving service, once recieved it loads next chunk from cdn. Also not all chunks are supposed to be of same length these chunks are created based on audio silencea. Check this out youtu.be/nzJ4wLPxcNg.