Flussonic Media Server documentation

Server-Side Playlists

Server-side playlists are created by the video service provider on the Flussonic server. They allow you to launch your custom TV channel where you choose which files and streams to broadcast.

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

  • You cannot use targeted ads;
  • You cannot use stats for ads with adriver and other similar networks;
  • Complexity of creating a multi-bitrate 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 function is very complex to implement.

The main disadvantage is that they offer no means to create an adequate system of ads control. Instead of server-side playlists, it's recommended to use client-side playlists today, where an IPTV subscriber selects channels to form a playlist.

However, server-side playlists 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.

The 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

Here we give a brief overview of the process of creating a playlist in Flussonic Media Server.

First of all, place video files to the server and set up a corresponding VOD location (see below).

Then create a playlist file, let it be in the directory /tmp/playlist.txt. The playlist file can also be located at a remote host. It contains the list of video files to play:

vod/video1.mp4
vod/video2.mp4

The configuration file must have settings for VOD location and a stream that will play back the playlist:

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

A full example of how to create a server-side playlist, with overlaying a logo and sending by multicast, see in Provider's custom channels.

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 a server-side 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
}