Skip to content

HLS Playing

Murat Ugur Eminoglu edited this page May 17, 2022 · 12 revisions

Attention: We have migrated our documentation to our new platform, Ant Media Resources. Please follow this link for the latest and up-to-date documentation.

HLS Playing is available in both Community and Enterprise Editions. Before playing a stream, make sure that stream is broadcasting in the server.

Quick Link: Learn How to Publish Live Streams


Announcement for v2.4.1:

After version 2.4.1 filename structure has added also bitrate on the name. So for previous versions, the filename was "stream1_240p0001.ts", now it is "stream1_240p_300kbps0001.ts" , this change was needed because we enabled the same resolution with different bitrates


  1. You can use play.html under the Application. Visit https://your_domain_name:5443/WebRTCAppEE/play.html. If you're running Ant Media Server on your local computer, you can also visit http://localhost:5080/WebRTCAppEE/play.html

    You will encounter Stream ID doesn't exist popup error.

  1. Write the stream ID & HLS play order parameters in URL as below.

https://your_domain_name:5443/WebRTCAppEE/play.html?name=stream1&playOrder=hls

Go to the play.html

  1. The HLS stream will start to play automatically when it becomes live.

Press Start Playing Button

Autoplay may not be activated for some policies by Chrome & Firefox. So you may need to click the player to get it started button. Look at below links:

https://developers.google.com/web/updates/2017/09/autoplay-policy-changes https://hacks.mozilla.org/2019/02/firefox-66-to-block-automatically-playing-audible-video-and-audio/

Congrats. You're playing with HLS.

More Details About HLS

Make sure that HLS muxing is enabled in your application. You can check it on web management panel and check the HLS Muxing box in Settings of the app.

Assume that HLS Muxing is enabled and there is a stream publishing to Ant Media Server with an RTMP URL in this format: rtmp://<SERVER_NAME>/LiveApp/<STREAM_ID>

  • HLS URL is in this format: http://<SERVER_NAME>:5080/LiveApp/streams/<STREAM_ID>.m3u8

  • If there are adaptive streams enabled in Enterprise Edition, HLS Master URL is in this format: http://<SERVER_NAME>:5080/LiveApp/streams/<STREAM_ID>_adaptive.m3u8

Save HLS Records

HLS streaming is a more cost-effective and secure method instead of VOD streaming. You can record your HLS streams. You just need to change your application HLS settings as below:

  • Open your apps red5-web.properties and change settings.hlsPlayListType property to that file. red5-web.properties file is under webapps/<app_name>/WEB-INF folder. You can change settings.hlsPlayListType event or vod.
settings.hlsPlayListType=vod

or

settings.hlsPlayListType=event
  • Restart the server on the command line.

sudo service antmedia restart

Now, your HLS streams will record.

Quick Link: App Configurations Quick Link: FFmpeg Configurations

User Guide

Reference

Troubleshooting

Draft

Proposals

Clone this wiki locally