Search code examples
javascriptreactjshttp-live-streaminghls.js

HLs.js stuttering audio stream on Safari only


I am using Hls.js to stream live audio for radio, and it works well on chrome but the audio is stuttering on Safari only.

Here is the code sandbox example(kindly, open with Safari): https://codesandbox.io/s/pensive-mendel-0xgecl?file=/src/App.tsx

Do I have to do anything special for it to work well on Safari?


Solution

  • I have figured out that Safari has built-in HLS by default. So instead of using hls.js I am just checking if a browser has built-in one, if yes, i am just doing audio.src = mySrc otherwise use new Hls() of hls.js