Table of Contents

Common Publishing Point Use-Cases

This page covers the six most common ways to create publishing points in the MultiProtoServer sample. Each use-case creates a publishing point with a single call to one of the CreatePublishingPoint overloads on StreamingServer.

CreatePublishingPoint Overloads

Overload Description
CreatePublishingPoint(string, string, PublishingPointParameters) Create from a remote URI (live pull)
CreatePublishingPoint(string, string, StreamingMode, PublishingPointParameters) Create from a URI with explicit streaming mode (live or VOD)
CreatePublishingPoint(string, IMediaSource, PublishingPointParameters) Create from a user-provided IMediaSource
CreatePublishingPoint(string, IMediaSource, StreamingMode, PublishingPointParameters) Create from a user-provided source with explicit streaming mode

All overloads return a Guid — the unique identifier of the created publishing point.

1. Pull Source

Create a publishing point that pulls a live stream from a remote server and redistributes it to connected clients via all enabled protocols.

this.server.CreatePublishingPoint("camera1", "rtsp://192.168.0.101/stream");

The source URI can be any protocol supported by VASTreaming: rtsp://, rtmp://, srt://, rtp://, etc. The server connects to the remote source immediately and keeps the stream running for as long as the publishing point exists.

Important

The publishing point does not automatically re-connect to the specified URI if the connection fails, e.g. due to a network error. User code must track the Disconnected event and re-create the publishing point if necessary. This is intentional to allow higher flexibility in server logic — for example, switching to a fallback source or applying a custom retry policy.

Access URLs

Once created, clients can access the stream via any enabled protocol:

Protocol URL
RTSP rtsp://server/camera1
RTMP rtmp://server/live/camera1
SRT srt://server:21330?streamid=camera1
HLS http://server:8888/hls/camera1
MPEG-DASH http://server:8888/dash/camera1
WebRTC ws://server:8888/rtc (select camera1)

With Additional Parameters

this.server.CreatePublishingPoint("camera1", "rtsp://192.168.0.101/stream",
    new VAST.Network.PublishingPointParameters
    {
        Title = "Front door camera",
        IsTemporary = false,
    });

2. VOD Single File

Serve a single MP4 file as video-on-demand. VOD publishing points support seeking, pause, and playback rate control.

Uri uri = new Uri(@"C:\Media\recording.mp4");
this.server.CreatePublishingPoint("vod1", uri.AbsoluteUri, VAST.Common.StreamingMode.Vod);

The StreamingMode.Vod parameter is required — it tells the server to generate VOD-compatible manifests and allow interactive playback.

Access URLs

Protocol URL
HLS http://server:8888/hls/vod1
MPEG-DASH http://server:8888/dash/vod1
Note

VOD is accessible via HLS and MPEG-DASH. RTSP VOD is also supported if the client supports RTSP playback commands.

3. VOD from User Stream

Serve VOD content from an in-memory stream instead of a file path. This is useful when the file content is loaded from a database, cloud storage, or generated dynamically.

VAST.File.ISO.IsoSource source = new VAST.File.ISO.IsoSource();
System.IO.Stream file = System.IO.File.Open(@"C:\Media\recording.mp4",
    System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite);
byte[] buffer = new byte[file.Length];
file.Read(buffer);
source.Stream = new System.IO.MemoryStream(buffer);

this.server.CreatePublishingPoint("vod2", source, VAST.Common.StreamingMode.Vod,
    new VAST.Network.PublishingPointParameters
    {
        IsTemporary = true,
        AllowedProtocols = VAST.Common.StreamingProtocol.HLS
    });
Important

When using a user-provided stream, the publishing point can support only one output protocol. Set AllowedProtocols to the desired protocol.

The IsTemporary flag causes the publishing point to be automatically deleted when the last client disconnects.

4. VOD Directory

Serve all media files in a directory as video-on-demand. Each file becomes accessible under the publishing point path with the filename appended.

Uri uri = new Uri(@"C:\Media\Videos");
string wildcardUri = uri.AbsoluteUri + "/*.mp4?recursive=1";
this.server.CreatePublishingPoint("library", wildcardUri, VAST.Common.StreamingMode.Vod);

The *.mp4 wildcard filters files by extension. The ?recursive=1 parameter enables access to files in subdirectories.

Access URLs

Protocol URL
HLS http://server:8888/hls/library/filename.mp4
MPEG-DASH http://server:8888/dash/library/filename.mp4

Where filename.mp4 is a file path relative to the source directory. For example, if the directory contains concert.mp4 and interviews/artist.mp4:

  • http://server:8888/hls/library/concert.mp4
  • http://server:8888/hls/library/interviews/artist.mp4

5. Loop File

Play a file in an endless loop as a live stream. Unlike VOD, the output behaves as a continuous live stream — clients cannot seek or pause.

VAST.File.FileSource source = new VAST.File.FileSource();
source.Uri = @"C:\Media\loop.mp4";
source.Loop = true;
this.server.CreatePublishingPoint("loop1", source);

The FileSource reads the file and restarts from the beginning when it reaches the end. Since no StreamingMode is specified, it defaults to Live.

FileSource Key Properties

Property Type Description
Uri string File path or URI to open
Loop bool Restart from beginning on end of file
PlaybackRate double Playback speed (1.0 = normal)

6. Image Source

Generate a video stream from a static image. The image is encoded into a continuous H.264 video stream at the specified resolution and framerate.

VAST.Image.ImageSource source = new VAST.Image.ImageSource();
source.SetImage(@"C:\Media\logo.png");
source.Open();

VAST.Common.MediaType mt = new VAST.Common.MediaType
{
    ContentType = VAST.Common.ContentType.Video,
    CodecId = VAST.Common.Codec.H264,
    Bitrate = 1000000,
    Width = 1280,
    Height = 720,
    Framerate = new VAST.Common.Rational(30),
};
source.SetDesiredOutputType(0, mt);

this.server.CreatePublishingPoint("image1", source);

Steps

  1. Create an ImageSource and load the image via SetImage(). The image can be set from a file path, a Stream, or a Bitmap object.
  2. Call Open() to initialize the source.
  3. Create a MediaType describing the desired output video format — codec, bitrate, resolution, and framerate.
  4. Call SetDesiredOutputType() to configure the encoding parameters.
  5. Pass the source to CreatePublishingPoint().

The image source is useful for placeholder streams, test patterns, or static overlays. The image can be updated at runtime by calling SetImage() again.

PublishingPointParameters

All CreatePublishingPoint overloads accept an optional PublishingPointParameters object for fine-tuning:

Property Type Default Description
Title string null Human-readable description
IsTemporary bool false Auto-delete when last client disconnects
AllowedProtocols StreamingProtocol All Restrict which output protocols can serve this stream
Loop bool false Loop the source (alternative to setting FileSource.Loop)
StartSuspended bool false Buffer samples but don't push to clients until Resume() is called
OpeningTimeout TimeSpan? null Destroy if no media received within this duration
NoClientsTimeout TimeSpan? null Destroy if no clients connect within this duration
BufferingType BufferingType None Buffering strategy: None, Memory, Disk, or Gop
BufferDuration TimeSpan? null Buffer duration when buffering is enabled
MaxVideoWidth int 0 Limit output video width (0 = no limit)
MaxVideoHeight int 0 Limit output video height (0 = no limit)
MaxVideoFramerate Rational null Limit output video framerate
UserData object null Attach custom data to the publishing point

See Also