Content Management

Livestream Setup recommendations

This page covers the developer side of livestreaming: what your encoder sends, how a livestream plays in the TargetVideo player, the webhook for recordings, and the API. Setting up livestreams, schedules and their options in the CMS is described in the Help Center:

Encoder and ingest

Livestreams take SRT input. Set your encoder (for example OBS Studio, vMix, Wirecast or a hardware encoder) to send SRT in caller mode to the livestream’s SRT URL, which the CMS shows when you create the stream and on its edit page.

  • The URL has the form srt://HOST:PORT?passphrase=PASSPHRASE. The passphrase encrypts the stream (AES-128), so keep the full URL private.

  • Send at least the resolution and frame rate of the stream’s Max Encoding Preset (540p to 1080p, each also at 60 fps). That is the highest quality the stream is encoded to for viewers.

  • If no stream arrives for the stream’s Maximum Inactivity Time (default 2 hours), the server stops. Start it again before your encoder connects, unless a scheduled event starts it for you.

Playing a livestream

A livestream is a video in your library, and the CMS gives you its embed code. It is a standard player embed, so everything on Embed a player and the JavaScript API reference applies. The player handles these cases on its own:

  • Stream offline: if the livestream has a playlist set for when it is inactive, the player plays that playlist on a loop while it waits for the stream.

  • Scheduled events: each scheduled event is its own video. The server starts 5 minutes before the start time. Until then the player shows a countdown, and at the start time it plays the stream. At the end time it shows “This stream has ended”, unless the schedule allows playback after the end time. In a playlist of scheduled events, the player moves on to the next event.

  • Secure Urls: with this option on, the stream’s HLS playback URL is protected and plays only through the TargetVideo player.

To change the player’s livestream messages, add these keys to the translate object of the player config (see Localization):

Parameter

Description

livestream_starts (string)

Text shown with the countdown before a scheduled event. Default “Livestream starts”.

livestream_starting (string)

Shown when the start time has passed but the stream isn’t playing yet. Default “Livestream is about to start...”.

livestream_ended (string)

Shown after the end time. Default “This stream has ended”.

Recordings and the record webhook

A livestream can be recorded automatically, or in segments started and stopped from the CMS or the API. When a recording has been saved as a video, the record webhook is sent, with the new video in response.Video (see Webhooks).

API

Livestreams and their schedules can be managed through API v3. The calls are in the API reference, under Livestream channel and LivestreamSchedule: creating a livestream (livestream/add_v2), its status and SRT URL (get_status_v2), starting and stopping the server (toggle_livestream), recording segments (startRecording, stopRecording), finding recorded videos (search_vods), and the schedule calls.

Setting up a new server takes 1–2 minutes: poll get_status_v2 until the status is completed before you read the SRT URL or start streaming. startRecording only works while a stream is coming in, and when stopRecording has saved the segment as a video, the record webhook follows.

Older livestream servers

Some accounts still use the older livestream servers, which take RTMP input (an RTMP URL and stream key) instead of SRT. Only those streams can be multicast to YouTube or Facebook and have ads pushed to viewers from the CMS.

Livestream Setup recommendations · TargetVideo Developer Docs