Flussonic Media Server documentation

Server-Side Playlists

Server-side playlists are created by the video service provider on the Flussonic server.

Server-side playlists have a number of disadvantages when used on the Internet on websites:

  • you cannot use targeted ads;
  • you cannot use stats for ads with adriver and other similar networks;
  • complexity of creating a multibitrate broadcasting: different files can contain different number of different bitrates;
  • rewinding is unreasonably difficult to create, while rewinding is one of the major advantages of online broadcasting compared to classic broadcasting;
  • the pause is very complex to implement.

The main disadvantage is no means to create an adequate system of ads control. But server-side playlist are OK to be used other than on websites. Besides, the practice proved that users are more willing to watch predefined shows and not to search for video manually.

Instead of server-side playlists, it's recommended to use client-side playlists today. The IPTV subscriber selects channels to form a playlist.

Usage of server-side playlists Anchor Anchor x2

Server-side playlists can be used for:

  • simultaneous broadcasting on multiple subscriber devices in a local network;
  • switching between streams from multiple cameras, for example, once per minute.

Creating server-side playlists Anchor Anchor x2

If you still want to use server-side playlists, Flussonic Media Server to create and use them.

First of all, create a playlist file, let it be in the directory /tmp/playlist.txt. It contains the list of video files to play:

vod/video1.mp4
vod/video2.mp4

The config file should contain the following lines:

http 80;
stream playlist1 {
 url playlist:///tmp/playlist.txt;
}
stream playlist2 {
 url playlist://http://host/playlist.txt;
}
file vod {
 path /var/movies;
}

If the directory /var/movies contains video1.mp4 and video2.mp4, their playback will start immediately and will be looped.

The playlist also includes control commands:

#EXT-X-MEDIA-SEQUENCE:20
#EXT-X-PROGRAM-DATE-TIME:2013-02-12T12:58:08Z
vod/video1.mp4
#EXTINF:64,
vod/video2.mp4

Control commands Anchor Anchor x2

Flussonic playlists support the following control commands:

  • #EXT-X-MEDIA-SEQUENCE The number of the first element in the playlist. You can use it for valid rotation and updating of a playlist;
  • #EXTINF The duration in seconds of playing a playlist element. You can use it for embedding live;
  • #EXT-X-UTC Unix Timestamp of the time when you need to start playing a playlist element;
  • #EXT-X-PROGRAM-DATE-TIME Start time for an element, in ISO 8601 format: 2013-02-12T12:58:38Z (GMT).

Each time after playback of a file in a playlist is finished, the playlist is re-read.

Consider the following rules for processing playlists:

  1. If the option EXT-X-MEDIA-SEQUENCE is specified, the playlist remembers the last played item, and playback continues from the next item after re-reading. The playlist will be synced from the next number. If the new playlist contain only numbers less than last number, playlist file will be rereaded every second, waiting for the correct number;
  2. If the option EXT-X-MEDIA-SEQUENCE is not specified and the playlist file was not changed, then the next element will be played. If the file is changed, playback starts from the beginning.

Using streams in a playlist Anchor Anchor x2

For example, you have two streams, cam1 and cam2, on your Flussonic server:

stream cam1 {
 url  rtsp://192.168.1.21:554/user=admin&password=&channel=0&stream=0;
}
stream cam2 {
 url  rtsp://192.168.1.22:554/user=admin&password=&channel=0&stream=0;
}

In playlist.txt write the stream names as follows:

#EXTINF: 60
cam1
#EXTINF: 60
cam2

Playlist status information Anchor Anchor x2

You can request information about the state of the playlist of the specified stream.

URL: /flussonic/api/playlist/STREAM_NAME

Example: http://example.flussonic.com:8080/flussonic/api/playlist/example_stream

Parameters: 

  • STREAM_NAME — the name of a stream that contains the playlist (required)

Response: JSON like

{
    "current_entry":"vod/ir.mp4",   //The currently played item
    "current_type":"file",   //The type of the currently played item
    "duration":null,   //Duration of the current item, in milliseconds('null' stands for 'undefined')
    "position":5.22e4   //Currently played position inside the current item, in milliseconds
}

About server-side playlists.