Playlist
This guide describes how to use the Playlist feature on Ant Media Server. You can use this feature in both Community Edition and Enterprise Edition of Ant Media Server.
What is Linear Live Streaming?
Linear Live Streaming, or pre-recorded live streaming as its sometimes referred to is a technique that involves live streaming a pre-recording video.
This method is widely used and involves recording a video of yourself in a way that simulates a live stream. The recorded video is then scheduled to be broadcasted as if it were a live stream, creating the illusion that you are streaming in real-time.
It's quite common to use this method to enable a 24/7 live stream across different social platforms like YouTube.
So, Linear Live Streams have some programs which have a start and end date streams in the program. Furthermore, Linear Live Streaming is a live event in which all viewers are watching the same live event at the same time. This means you don’t get any spoiler before viewing.
Live linear streaming is a “passive” video viewing experience, meaning viewers don’t “search and click” (except to change the program). The experience of linear streaming is that video content comes to you and while you can change the channel, you don’t have to select an entire collection of videos to watch like you do with a playlist.
How to create a Playlist?
You can create a playlist in Ant Media Server Dashboard. Your playlist is ready in 3 steps. Here are the steps 🙂
Click New Live Stream > Playlist
as shown above.
If you have your mp4 files on your local system before creating the playlist, you can upload them to Ant Media Server from the VoD section, as shown below.
The uploaded mp4 files are saved in the applications streams folder by default, and we must provide that path as a file URL when creating the playlist.
Simply enter the Playlist name, Stream Id, and Playlist URL into the appropriate fields and click the Create
button. You can add more Playlist Items based on the number of files or URLs in your playlist.
Note: Furthermore, uploading mp4 files to your Ant Media Server is optional. Ant Media Server can retrieve mp4 files from any location. You simply need to ensure that the file URL is accessible to AMS.
After you've created your playlist, you can start it by clicking the Start Broadcast
button.
Rest API can also be used to start and stop a playlist. Check out the APIs for start broadcast and stop broadcast.
How can I use Playlist API?
Here is the sample create Playlist CURL command:
curl -X POST -H "Content-Type: application/json" "https://AMS-domain:port/Application-Name/rest/v2/broadcasts/create" -d
'{
"name": "your-streamName",
"streamId": "your-streamId",
"type":"playlist",
"playListItemList": [
{
"streamUrl": "http://sample-stream-URL.com/sample.mp4",
"type": "VoD"
}
]}'
You can use the update Broadcast Rest API to update the playlist on the fly.
How to play Linear Live Streaming?
You can play the playlist in HLS and WebRTC.
Here is HLS player documentation
Here is WebRTC play documentation
Check out the following discussion for some tweaks to improve playlist playback.