File Stream
File Stream
The File Stream service plays a local media file into SBN Media as a stream. It is used to play a video clip or an audio prompt into the system - for example an announcement into a call - so the file behaves like any other media source.
Overview
File Stream is the device-stream service for local files. It does not hold a fixed list of files - a file is identified by its URL, and a stream is created on demand when something opens it.
It is one of SBN Media's *device-stream* services, so it shares the on-demand creation, load-balancing, per-instance limits, and reconnect behaviour common to all of them - see Device Streams (SBN-Media/Devices/device-streams). This page covers only what is specific to files.
It plays files in two modes:
- Video - a container file such as MP4, AVI, or MPEG-TS, decoded to standard video and audio.
- Audio - a raw audio file (mulaw or alaw), used for prompts and tones, selected with an audio option on the URL.
The file is read from the local filesystem of the host that plays it. Because requests are shared across instances, a file must be present on every host that runs File Stream - or run File Stream only where the files are.
- Runs: When configured. Needed to play files into SBN Media.
- Required: Only if you play media files - for example announcements or test footage. Not needed otherwise.
- Depends on: NATS, and the files being present on the host's local filesystem.
Configuration
File Stream has no settings of its own beyond the shared devicestream configuration described on the Device Streams page (SBN-Media/Devices/device-streams) - stream limits, timeouts, reconnect, and load-balancing all apply to it.
A file is opened by its URL rather than configured here:
file:///path/to/clip.mp4- a video or container file (MP4, AVI, MPEG-TS, and similar).file:///path/to/prompt.ulaw?acaps=...- a raw mulaw/alaw audio file, used for a prompt or tone. Theacapsoption tells File Stream the audio format of the raw file.
The path is on the local filesystem of the host that plays the file. After changing any shared settings in sbn-media.local.yaml, apply them with ./sbn-media config reload.
FAQ
How do I play a file?
Open its URL - file:///path/to/clip.mp4 for a video, or file:///path/to/prompt.ulaw?acaps=... for a raw audio prompt. A File Stream instance reads the file from its local disk and plays it as a stream.
Which file types can it play?
Container files such as MP4, AVI, and MPEG-TS for video, and raw mulaw/alaw files for audio prompts.
A file plays sometimes but not others.
The file is read from the local disk of whichever instance handles the request, and requests are shared across instances. Make sure the file exists at the same path on every host that runs File Stream, or run File Stream only on the host that holds the files.
Where do the files live?
On the local filesystem of the host running File Stream - File Stream does not fetch them over the network.
Related pages
- SBN Media Overview (
SBN-Media/overview) - Device Streams (
SBN-Media/Devices/device-streams) - Installing and Configuring SBN Media (
SBN-Media/installation) - Watchdog (
SBN-Media/Platform/watchdog)