From de83c6bb24d184e6cc221255e7c645ba866920ee Mon Sep 17 00:00:00 2001 From: Mohit Dubey <86982446+Mohit-3196@users.noreply.github.com> Date: Sun, 22 Sep 2024 10:12:52 +0530 Subject: [PATCH 1/5] Update webrtc-playback.md --- docs/guides/playing-live-stream/webrtc-playback.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/playing-live-stream/webrtc-playback.md b/docs/guides/playing-live-stream/webrtc-playback.md index 0275632c..e9e25c00 100644 --- a/docs/guides/playing-live-stream/webrtc-playback.md +++ b/docs/guides/playing-live-stream/webrtc-playback.md @@ -1,6 +1,6 @@ --- title: WebRTC Playback -description: Achive Sub-second latency with WebRTC Playback with Ant Media Server. +description: Achieve Sub-second latency with WebRTC Playback with Ant Media Server. keywords: [WebRTC playback, WebRTC playback with Ant Media Server, Ant Media Server Documentation, Ant Media Server Tutorials] sidebar_position: 1 --- From ce0599d26bfcc51fc770197079f9e10be6d12c6e Mon Sep 17 00:00:00 2001 From: Mohit Dubey <86982446+Mohit-3196@users.noreply.github.com> Date: Sun, 22 Sep 2024 10:13:33 +0530 Subject: [PATCH 2/5] Update embedded-web-player.md --- docs/guides/playing-live-stream/embedded-web-player.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/playing-live-stream/embedded-web-player.md b/docs/guides/playing-live-stream/embedded-web-player.md index d1b9011e..62f62efc 100644 --- a/docs/guides/playing-live-stream/embedded-web-player.md +++ b/docs/guides/playing-live-stream/embedded-web-player.md @@ -2,7 +2,7 @@ title: Embedded Web Player description: Embed AMS Web Player to your webpage keywords: [Embedded Web Player, Embedded Player using iFrame, Ant Media Server Documentation, Ant Media Server Tutorials, play streams, play on separate websites] -sidebar_position: 4 +sidebar_position: 5 --- # Embedded Web Player From a9c9b19e7daf820ae64c027025f78dd337162837 Mon Sep 17 00:00:00 2001 From: Mohit Dubey <86982446+Mohit-3196@users.noreply.github.com> Date: Sun, 22 Sep 2024 10:13:49 +0530 Subject: [PATCH 3/5] Update dash-playing-cmaf.md --- docs/guides/playing-live-stream/dash-playing-cmaf.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/playing-live-stream/dash-playing-cmaf.md b/docs/guides/playing-live-stream/dash-playing-cmaf.md index f4908df7..46a7d5fc 100644 --- a/docs/guides/playing-live-stream/dash-playing-cmaf.md +++ b/docs/guides/playing-live-stream/dash-playing-cmaf.md @@ -2,7 +2,7 @@ title: Dash playing (CMAF) description: Common Media Application Format (CMAF) is essentially a new format to reduce HTTP delivery latency, as it aims to reduce the cost, complexity, and latency of streaming. keywords: [Dash playing, Common Media Application Format, Ant Media Server Documentation, Ant Media Server Tutorials] -sidebar_position: 3 +sidebar_position: 4 --- # Dash Playback with CMAF From 1fa4e3a3700b0995e21345a6759934e73052835c Mon Sep 17 00:00:00 2001 From: Mohit Dubey <86982446+Mohit-3196@users.noreply.github.com> Date: Sun, 22 Sep 2024 10:15:35 +0530 Subject: [PATCH 4/5] Create ll-hls.md --- docs/guides/playing-live-stream/ll-hls.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 docs/guides/playing-live-stream/ll-hls.md diff --git a/docs/guides/playing-live-stream/ll-hls.md b/docs/guides/playing-live-stream/ll-hls.md new file mode 100644 index 00000000..322ba8ae --- /dev/null +++ b/docs/guides/playing-live-stream/ll-hls.md @@ -0,0 +1,6 @@ +--- +title: WebRTC Playback +description: Achive Sub-second latency with WebRTC Playback with Ant Media Server. +keywords: [WebRTC playback, WebRTC playback with Ant Media Server, Ant Media Server Documentation, Ant Media Server Tutorials] +sidebar_position: 3 +--- From 70f64e081d585306797c614519ab5d8d054d0db7 Mon Sep 17 00:00:00 2001 From: Mohit Dubey <86982446+Mohit-3196@users.noreply.github.com> Date: Mon, 23 Sep 2024 13:16:32 +0530 Subject: [PATCH 5/5] LL-HLS document creation --- docs/guides/playing-live-stream/ll-hls.md | 182 +++++++++++++++++++++- 1 file changed, 179 insertions(+), 3 deletions(-) diff --git a/docs/guides/playing-live-stream/ll-hls.md b/docs/guides/playing-live-stream/ll-hls.md index 322ba8ae..e8041246 100644 --- a/docs/guides/playing-live-stream/ll-hls.md +++ b/docs/guides/playing-live-stream/ll-hls.md @@ -1,6 +1,182 @@ --- -title: WebRTC Playback -description: Achive Sub-second latency with WebRTC Playback with Ant Media Server. -keywords: [WebRTC playback, WebRTC playback with Ant Media Server, Ant Media Server Documentation, Ant Media Server Tutorials] +title: LL-HLS Playback +description: Achieve 2-5 seconds of latency with LL-HLS Playback with Ant Media Server. +keywords: [LL-HLS playback, LL-HLS playback with Ant Media Server, Ant Media Server Documentation, Ant Media Server Tutorials] sidebar_position: 3 --- + +# Introduction +Low-latency HLS (LL-HLS) playback feature has been introduced in Ant Media Server version 2.11 and above. It allows you to stream with minimal latency (around 2-5 seconds), making it ideal for near real-time streaming applications. + +## What is LL-HLS? +**Low Latency HLS (LL-HLS)** is a streaming protocol designed to minimize latency in live streaming. Traditional HLS can have latency ranging from 20-30 seconds, while LL-HLS reduces this to around **2-5 seconds**. + +LL-HLS achieves this by using smaller video segments (called "parts") that allow the video player to start playback before an entire segment is completed. + +### Key Differences: HLS vs. LL-HLS +| Standard HLS | Low Latency HLS (LL-HLS) | +| ------------ | ------------------------ | +|Latency: ~20-30 secs | Latency: ~2-5 secs | +| Segment-based | Part-based (smaller chunks) | +| Larger file sizes | Smaller, more frequent parts | + + +## How to Enable LL-HLS in Ant Media Server +LL-HLS is a **paid plugin** offered by the Ant Media Server. So before using LL-HLS, you need to purchase and install the plugin on your Ant Media Server. For more information about plugin structure in Ant Media Server, take a look at the [Ant Media Server Plugins](https://antmedia.io/plugins-will-make-ant-media-server-more-powerful/) + +### Step 1: Purchase and Install the LL-HLS Plugin +1. **Purchase the Plugin** +- Email contact@antmedia.io to purchase the LL-HLS plugin. +- Alternatively, you can also [get it directly](https://antmedia.io/product/low-latency-hls-plugin/) from the website based on a monthly subscription basis. + +2. **Install the Plugin** +- Upload/copy the plugin file to your instance running the Ant Media Server. +- Run the following commands to install: + +```js +unzip low-latency-hls-plugin.zip +cd low-latency-hls-plugin +sudo ./install_low-latency-hls-plugin.sh +sudo service antmedia restart +``` + +### Step 2: Publish a Stream +Ant Media Server provides LL-HLS endpoints for all ingested streams. You can check the [publish live streams](https://antmedia.io/docs/category/publish-live-stream/) section to learn how to publish streams using different protocols with Ant Media Server. For this example, let's [publish with WebRTC](https://antmedia.io/docs/guides/publish-live-stream/webrtc/). + +1. **Access the WebRTC Publish Page** +Open the following URL in your browser: + +https://yourserver.com:5443/live/?streamId=stream1 + +- Replace yourserver.com with your Ant Media server's domain. +- You can use stream1 or any custom stream ID. + +2. **Start Publishing the Stream** + +Click the **Start Publishing** button on the page. + +![Screenshot 2024-09-23 130823](https://github.com/user-attachments/assets/ce967db5-640a-4ddb-b584-7a7b9eb03883) + +### Step 3: Play the Stream with LL-HLS +1. **Open a Video Player** + +Use a player that supports LL-HLS, like **THEOPlayer**, Safari, or others. + +- For this example, we are going to use [THEOPlayer test page](https://www.theoplayer.com/test-your-stream-hls-dash-hesp) + +2. **Enter the LL-HLS URL** + +In the player, enter the following URL to play the stream: + +https://yourserver.com:5443/live/streams/ll-hls/stream1/stream1__master.m3u8 + +![Screenshot 2024-09-23 131202](https://github.com/user-attachments/assets/63bca3f6-0c71-4ba8-a8f7-5b8d8f56c24f) + + +- Ensure two underscores (__) exist between the stream ID and `master.m3u8`. +- The URL pattern: ```https://{YOUR_SERVER}:{PORT}/{APP}/streams/ll-hls/{STREAM_ID}/{STREAM_ID}__master.m3u8``` + +## Customizing LL-HLS +You can fine-tune LL-HLS settings in the [Advanced section of the application settings](https://antmedia.io/docs/guides/configuration-and-testing/ams-application-configuration/#management-panel-settings) of the Ant Media Server web panel. These settings allow you to adjust the behavior of LL-HLS to meet specific needs, like controlling segment durations or playlist updates. + +### Customization Parameters + +1. **partTargetDurationMs** + +The maximum duration of partial segments in milliseconds (recommended: **1002 ms**). +```js +"partTargetDurationMs": 1002 +``` + +2. **targetDuration** + +Target duration for media files (default: **10 seconds**). Lower values provide faster response times but increase server load. +```js +"targetDuration": 10 +``` + +3. **slidingWindowEntries** + +Number of media segments retained in the playlist (default: **5**). Increasing this value can improve stability but may consume more resources. +```js +"slidingWindowEntries": 5 +``` + +4. **deleteFiles** + +Determines whether old media files are deleted after being removed from the playlist (default: **true**). It is set to **false** if you want to keep old segments. +```js +"deleteFiles": true +``` + +5. **program** + +Indicates if a VOD-style program is being captured, which means all segments are retained in the playlist (default: **false**). +```js +"program": false +``` + +6. **addDateTime** + +Controls whether the date and time are added to media file names (default: **true**) +```js +"addDateTime": true +``` + +7. **receiveDataTimeout** + +Timeout duration in seconds after which the segmenter pauses if no data is received (default: **0**, meaning no timeout). +```js +"receiveDataTimeout": 0 +``` + +8. **exitOnReceiveDataTimeout** + +If set to **true**, the segmenter will exit when the receiveDataTimeout is reached. Otherwise, it will just pause (default: **false**). +```js +"exitOnReceiveDataTimeout": false +``` + +9. **fileCompleteCommand** + +Command executed when a media or index file is completed. You can use `%P` for the full path and `%F` for the file name. +```js +"fileCompleteCommand": "/path/to/script %P %F" +``` + +10. **fileDeleteCommand** + +Command executed when a media or index file is deleted after being removed from the playlist. +```js +"fileDeleteCommand": "/path/to/delete_script %P %F" +``` + +11. **quiet** + +If set to **true**, only error messages will be displayed in the logs (default: **false**). +```js +"quiet": false +``` + +### Applying Customization +To apply the above settings, add them under the **customSettings** section in the Ant Media Server application advanced settings: + +```js +"customSettings": { + "plugin.ll-hls": { + "partTargetDurationMs": 1002, + "targetDuration": 10, + "slidingWindowEntries": 5, + "deleteFiles": true, + "program": false, + "addDateTime": true, + "receiveDataTimeout": 0, + "exitOnReceiveDataTimeout": false, + "fileCompleteCommand": "/path/to/script %P %F", + "fileDeleteCommand": "/path/to/delete_script %P %F", + "quiet": false + } +} +``` + +- You can easily enable Low-Latency HLS (LL-HLS) on Ant Media Server with this guide. For a more detailed explanation of the LL-HLS and its related properties, check the [Low-latency HLS blogpost](https://antmedia.io/low-latency-hls-or-ll-hls/).