Home / How to play m3u8

How to play an m3u8 stream in a browser

HLS was designed by Apple, so Safari and iOS play .m3u8 URLs natively. Chrome, Firefox and Edge do not. On those browsers you need a JavaScript library — most commonly hls.js — that parses the playlist and feeds the video segments into a <video> element through Media Source Extensions (MSE).

Browser support at a glance

BrowserNative HLSWhat you need
Safari (macOS / iOS)YesSet video.src directly
Chrome / EdgeNohls.js or similar
FirefoxNohls.js or similar
Android ChromePartialhls.js is more predictable

Minimal hls.js example

<script src="https://cdn.jsdelivr.net/npm/hls.js@1/dist/hls.min.js"></script>
<video id="video" controls></video>
<script>
  const video = document.getElementById('video');
  const url = 'https://your-own-cdn.example.com/master.m3u8';
  if (Hls.isSupported()) {
    const hls = new Hls();
    hls.loadSource(url);
    hls.attachMedia(video);
  } else if (video.canPlayType('application/vnd.apple.mpegurl')) {
    video.src = url;   // native HLS (Safari)
  }
</script>

You can also paste a URL into the free player tester on the home page instead of writing code.

Server requirements

Troubleshooting

SymptomLikely cause
Nothing happens, console shows CORS errorMissing Access-Control-Allow-Origin on the playlist or segments
MANIFEST_LOAD_ERRORWrong URL, 403/404, expired token, or mixed content
MANIFEST_PARSING_ERRORThe URL returns HTML (a login or error page) instead of a playlist
Video stalls every few secondsSegments too large, slow origin, or missing #EXT-X-TARGETDURATION alignment
Live stream freezesThe playlist is no longer being refreshed, or #EXT-X-ENDLIST was added by mistake

Related reading