Streaming (HLS) vs progressive download
In the context of audiobook streaming platform
Search for a command to run...
In the context of audiobook streaming platform
No comments yet. Be the first to comment.
In this series I discuss the issues that I encountered while working on audiobook streaming platform.
with Ruby SDK for AWS MediaConvert
If you have been working on a multi-tenant application for a long time, there is a high chance that your Tenant model has grown to an enormous size. You probably started with id, name, and subdomain columns. Later there were things that had to be con...
Today, I came across the following method in my old code. (This comes from an application supporting calculations in the construction of concrete floors). def l_factor ((bending_stiffness * 10000000000) / k) ** 0.25 end This big number looks ...
Last weekend I went to the dynamIT conference that took place in Kraków. In his presentation, Andrzej Krzywda was speaking about DDD as Low-Code. He distilled 11 bounded contexts that are common in the different business applications. One of them is ...
Today's post is a continuation of what I wrote yesterday about securing Cloudfront stream with signed cookie. I encourage you to open this post especially to look at the UML diagram. There are some things you need to keep in mind to access a stream ...
In the context of audiobook streaming platform
Recently I was faced with the challenge of implementing a platform for audiobook streaming. "Streaming" seemed to be a very overused word in colloquial speech to me (same as "Artificial Intelligence"). So first I had to figure out what streaming really is and how does it differ from simply embedding the mp3 file on the webpage.
Real streaming requires file conversion. After conversion, which will be a topic of another blog post, there is no longer one mp3 file. The conversion generates .m3u8 playlist file which the player requests once at the start of the streaming session and a bunch of .aac files that are short segments of the audio track.
The segments of converted audio track are being fetched one by one and when the user clicks pause on the video player, then the segments stop being downloaded. What is more, the user can start playback from any point. How crucial it is if we are talking about audiobook chapters that can last tens of minutes or even hours! The standard progressive download doesn't have such features, so streaming is the only economically viable option if you expect heavy traffic. Services like AWS Cloudfront charge you for the data transfer.
Standard mp3 files can be easily downloaded using third-party browser plugins like Video Downloader. It is not so trivial with the streams. Again, this is very important when it comes to audiobooks, the intellectual property that is highly vulnerable to piracy. Furthermore, as the stream is downloading files incrementally you can prevent access to further listening if, for example, someone else starts using the same account.
Granting access to a stream with a signed cookie with AWS Cloudfront is a topic of another blog post in this series.
You can convert your input file to many bitrates. All this data is stored in the mentioned .m3u8 playlist file. Depending on the available bandwidth the player will automatically choose a segment from an appropriate bitrate. If the user enters the area of a poor Internet connection he can still listen to his audiobook even if the audio quality is a little bit worse. Transitioning between bitrates is seamless.