Início / Conhecimento / Ferramentas

Embed an HLS Player on Your Website

Este artigo está disponível em chinês e inglês; a tradução para português está a caminho.

Want playback on your own blog or site? The easiest route is embedding an existing player page.

Basic usage

Most online players give you a snippet like <iframe src=".../player.html?url=your-m3u8-url"></iframe>. URL-encode the stream address and drop it into the parameter.

Things to watch

  • The source must allow cross-origin access, or embedding won't help playback;
  • Browsers may block autoplay, so let the user click to start;
  • Mind the iframe's aspect ratio and mobile adaptation;
  • If a third-party player carries ads or a watermark, decide whether that fits your site.
If experience and branding matter, build your own player with hls.js — full control and no third-party watermark.
← How Buffer Size Affects Playback SmoothnessMaster Playlist vs Media Playlist: HLS's Two Levels →