Discard audio before certain time from Hls.js stream

Issue

I am using Hls.js to live stream an audio feed into an audio element in my HTML. In my custom audio controls I limit the user to only be able to scroll back to the most recent five minutes of audio in the stream. However the audio for any time beyond the most recent five minutes still exists.

Is there any way to discard/trim the audio source beyond the most recent five minutes? Given i only care about the most recent five minutes of audio and the livestream could be constantly playing for multiple hours on end, what is the best method discard any of the unneeded audio from the source?

Thanks!

Solution

Hls.js has a config property for it!

https://github.com/video-dev/hls.js/blob/master/docs/API.md#backbufferlength

Answered By – Tristan Thompson

Answer Checked By – Candace Johnson (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.