Flussonic Media Server documentation

Advertisement insertion

Description Anchor Anchor x2

Advertisement insertion to HLS sessions is available since version 4.6.19. The control is performed via the authorization backend.

It is possible to specify Pre-roll video and set an interval for inserting Mid-roll videos, and it is unique for each user/view.

Restrictions:

  • An advertising video must have the same set of audio and video tracks as the main stream
  • An Advertising video must have GOP equal to one second.

The mechanism of the insertion of advertising is an extension of the authorization system. Please read the main documentation.

Flussonic will show the file vod/ad1.mp4 as pre-roll and then will show midroll files every 3 minutes (180 seconds).

Warning! Names of the commercial files are Flussoniс Media Server names, so it is necessary to create a VOD location and place files in it.

Don't try to specify a path to the local filesystem or HTTP resource.

Lua example Anchor Anchor x2

Auth backend should return this structure:

user_ads = {["preroll"] = "vod/ad1.mp4", ["midroll_interval"] = 180, ["midroll"] = {"vod/ad2.mp4", "vod/ad3.mp4"}}
return true, {["ad_inject"] = user_ads}

Flussonic will show the file vod/ad1.mp4 as pre-roll and then will show midroll files every 3 minutes (180 seconds).

HTTP auth backend example Anchor Anchor x2

Example of PHP auth script with advertising inserting:

<?php

header('Content-type: application/json');

$user_ads = [
    "preroll" => "vod/ad1.mp4",
    "midroll_interval" => 180,
    "midroll" => ["vod/ad2.mp4", "vod/ad3.mp4"]
];

echo json_encode(array("ad_inject" => $user_ads));
?>

Flussonic Media Server will show the file vod/ad1.mp4 as pre-roll and then will show midroll files every 3 minutes (180 seconds).