Skip to main content

HLS Playing

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

Quick Link: Learn How to Publish Live Streams

1. Navigate to the video player

Under the application, you can use play.html. Please go to https://AMS-domain-name:5443/WebRTCAppEE/play.html. If you have Ant Media Server installed on your computer, you may also go to http://localhost:5080/WebRTCAppEE/play.html.

To play an HLS stream, provide streamId as the name and hls as the playOrder parameters in the URL shown below.

https://AMS-domain-name:5443/WebRTCAppEE/play.html?name=test&playOrder=hls

2. Playback starts automatically

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

Autoplay is enabled by default in a player but it may not be activated for some policies in Chrome and Firefox. So you may need to click the player button to get it started. Look at the following links:

Chrome policy

Firefox policy

Congrats. You're playing with HLS.

More Details About HLS

Make sure HLS muxing is enabled in your application. You may confirm this by clicking the Create HLS Streaming checkbox in the app's settings on the web management panel.

Assume HLS muxing is enabled and a stream is published to Ant Media Server.

  • Default HLS (.m3u8) URL: http://AMS-domain-or-IP:5080/LiveApp/streams/StreamId.m3u8
  • If adaptive bit rates are enabled in the application (Enterprise Edition), the HLS (.m3u8) URL will be as follows: http://AMS-domain-or-IP:5080/LiveApp/streams/StreamId_adaptive.m3u8

Note: Beginning with version 2.4.1, the filename structure included the bitrate in the name. For example, 480p ABR is enabled on the server and you want to play it. In prior versions, the HLS filename was streamId_480p.m3u8, but now it is stream1_480p1000kbps.m3u8, as we enabled the same resolution with multiple bitrates.

If you would like to use the old structure, check the following post.

Save HLS Records

HLS streaming is a more cost-effective and secure method of streaming than video-on-demand assets. Furthermore, you can also record your live streams with HLS:

  • To enable HLS recording for your live streams and store all the HLS files (.ts and .m3u8), just log in to your AMS Web Panel, Navigate to the Application Setting -> Advanced, and configure the setting below:

Screenshot 2023-09-25 153916

settings.hlsPlayListType=event

To store HLS files permanently after the stream is ended.

settings.deleteHLSFilesOnEnded=false

To prevent overwriting of old HLS files in case the same streamId is used again, use the below property.

settings.hlsflags=+append_list

If uploading the files to S3, you can enable the date and time for the HLS files to prevent them from getting overwritten.

settings.addDateTimeToHlsFileName=true

After making the changes, you can scroll down and save the settings.

Now, your streams will be recorded as HLS.

Quick Link: App Configurations

Quick Link: FFmpeg Configurations