Search code examples
javascriptmp3m3u8hls.js

How to use hls with another type of format instead of m3u8


Background: Some time ago I implemented hls.js on the page to get a radio stream. The source of the stream was in m3u8 format -> https://xx.net/content/123/m3u8s/456.m3u8 but now a client is going to change it to the link https://xx.net/content/123/456.mp3

Problem: In this case hls doesn't work, because it expects m3u8 file.

Question: Is there a way to convert the link to m3u8 or implement a new library instead of hsl? Do you know how to handle it, maybe?


Solution

  • If it really is pointing at an MP3 stream, you no longer need HLS.js to handle it. A normal audio tag will work just fine.

    <audio src="https://example.com/content/123/456.mp3" preload="none"></audio>