U
U
Urbansamurai2018-09-18 03:12:18
Audio
Urbansamurai, 2018-09-18 03:12:18

How is SoundCloud streaming architecturally designed?

All I understand so far is that a signed url is generated for a specific track and it looks like this:

https://cf-hls-media.sndcdn.com/media/9cfdVetE6Xak.128.mp3?{...Signed Url Credentials}

Next comes some magic. Streaming starts - alternate GET requests along the same path as in the signed url, but with a range of bytes in the form .../media/from/to/...
https://cf-hls-media.sndcdn.com/media/2075166/2234825/9cfdVetE6Xak.128.mp3?{...Signed Url Credentials}

At the same time, chunks from cloudfront can only be taken if Range is specified in the request headers. Lambda is unable to do this because it does not have the right to change the Range header. It is unprofitable to stream through your reverse proxy ... unless you use the Amazon API Gateway.
Please help me find a solution.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
Urbansamurai, 2018-09-24
@Urbansamurai

Well... after a lot of research, I can say that it is very complicated. Firstly, different formats are supported (hls, opus, chromecast, http). The data from the /media/from/to/ request is still converted on the amazon side into range headers. Audio data is carefully parsed according to codec standards. If it is MP3, then every frame is parsed and seamless playback is organized. Everything is cached on the client side.
I found only one such open-source solution and only for MP3 format: Phonograph.js

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question