How to stream/play a video or audio file on HTTP?

Hello,

can someone please share insights on how streaming of video or audio is done by popular sites like YouTube, Spotify, or Netflix? I did some research and here is my finding. Please correct me if I am wrong.

The HEAD method request to the API endpoint should return a response that contains the header "accept-ranges: bytes". This lets the client knows that the streaming endpoint supports partial content download. Usually, the files are sent via TCP with buffering to avoid latency. Why TCP and NOT UDP? TCP provides error-free streaming while with UDP some packets may be lost and are suitable for live streaming.

REQUEST /v1/videos?id=xyz767 method: GET range: 0-2999 host: youttttude-com RESPONSE: status code: 206 (partial content) accept-ranges:bytes access-control-allow-origin: Youtttude-com (stream file might be in CDN and avoid CORS problem) content-type: video/mp4 content-length:5000 content-ranges:bytes 0-2999/5000 

An alternative would be to use of "quic" protocol and use multiplex streaming (segregated GET requests for audio and video). This allows for saving bandwidth. The response status code would be 200 OK.

What are your thoughts?

submitted by /u/git_world
[link] [comments]

from Software Development – methodologies, techniques, and tools. Covering Agile, RUP, Waterfall + more! https://ift.tt/myUC7l1

Leave a comment

Design a site like this with WordPress.com
Get started
search previous next tag category expand menu location phone mail time cart zoom edit close