Building a robust audio-streaming solution utilizing AWS Elemental Media Convert, CloudFront, and Lambda@Edge.
We were given a task to create an audio-streaming platform. This included ingesting audio files in various formats from differing sources. Additionally, the audio needed to be encrypted as the audio content was copyrighted and required to be accessible by paying customers.
Given the business's requirements, we had three obligatory requirements that had to be addressed:
Building an easy way for content editors to upload audio files into the CMS, meaning there would need to be some form of audio ingestion pipeline.
Creating a service that encodes audio tracks based on a chosen DRM and outputs the audio in a streamable format.
Dynamically adjust the audio compression quality of a stream to match bandwidth availability.
Above all else, this service must be seamlessly integrated with the current infrastructure.
After exploring multiple services, we decided to settle on using AWS Elemental MediaConvert. The service is mainly advertised as a way to create video-on-demand (VOD) content, but the service does support audio-only outputs.
We set up a couple of S3 buckets, one for input files and the second for output audio output. The content editors would create their content in the CMS. The audio tracks are then pushed to the input S3 bucket via an API.
Elemental Media is configured to output HLS-encoded AAC streams. AES-128 encryption was used to meet the DRM requirements. Multiple bitrate outputs were configured to address the adaptive bitrate requirement based on the user's bandwidth.
We used CloudFront as the CDN to serve the audio content to users. It was a challenge figuring out the best way to secure the tracks and only have them available to users entitled to play the audio content. Users would authenticate via Cognito, so we needed to validate the user's JWT token and determine if they were allowed access to the audio track. This is where Lamda@Edge came in handy. We used the lambda trigger to validate users’ access tokens and check if they had access to the content.
SNS was used to send a notification email informing the content editor whether a track was successfully processed or if the task has failed.
Using AWS Elemental MediaConvert has allowed us to get the project off the ground quickly, the service took care of the bulk of the work. Surprisingly matching all the business requirements. Elemental MediaConvert is the core component of this architecture, and it fits in nicely with all the other services.
We were able to create an automated audio pipeline, where audio tracks are available in seconds after being uploaded. The CloudFront CDN is highly optimized for media workloads. Audio load and response times exceed expectations. further enhancements will be made over time, such as generating one-time consumable URLs for audio playlists using CloudFront signed URLs
By using this site, you agree to thePrivacy Policy.