Table of Contents

Class FlvSink

Namespace
VAST.RTMP
Assembly
VAST.RTMP.dll

Provides a media sink for writing media streams to FLV (Flash Video) files. Supports file rotation and URI-based output configuration.

public class FlvSink : IMediaSink, IDisposable, IUriRotatable
Inheritance
FlvSink
Implements
Inherited Members

Constructors

FlvSink()

Creates a new instance of FlvSink.

public FlvSink()

Exceptions

UnauthorizedAccessException

Thrown when the license is invalid.

Properties

Capabilities

Gets the list of sink capabilities

public List<SinkCapability> Capabilities { get; }

Property Value

List<SinkCapability>

IsNetworkSink

Whether it's a network or local sink. Necessary to apply longer timeouts in media session processing logic.

public bool IsNetworkSink { get; }

Property Value

bool

NextUri

Function which returns next URI to be opened. Either Uri or NextUri shall be specified. Necessary for sinks with dynamically generated URI or file chunking. Exact URI syntax depends on the implementation.

public Func<string> NextUri { get; set; }

Property Value

Func<string>

Parameters

Gets or sets sink parameters

public SinkParameters Parameters { get; set; }

Property Value

SinkParameters

RotationPeriod

Rotation period in seconds after which the NextUri function will be called and sink will be re-created with the newly provided uri. Value 0 means no rotation

public int RotationPeriod { get; set; }

Property Value

int

State

Current sink state

public MediaState State { get; }

Property Value

MediaState

Stream

Output stream

public Stream Stream { get; set; }

Property Value

Stream

UniqueId

Unique id

public Guid UniqueId { get; set; }

Property Value

Guid

Uri

URI to be opened. Either Uri or NextUri shall be specified. Exact URI syntax depends on the implementation.

public string Uri { get; set; }

Property Value

string

Methods

AddStream(int, MediaType)

Add media stream for pushing

public void AddStream(int streamIndex, MediaType mediaType)

Parameters

streamIndex int

Stream index

mediaType MediaType

Stream media type

Dispose()

Disposes used resources

public void Dispose()

Open()

Open sink using specified URI

public void Open()

PushMedia(int, VersatileBuffer)

Push media sample

public void PushMedia(int streamIndex, VersatileBuffer sample)

Parameters

streamIndex int

Stream index

sample VersatileBuffer

Media sample

Start(bool)

Start media pushing

public void Start(bool delayedStart = false)

Parameters

delayedStart bool

False if media samples are expected immediately. True if first media sample is expected after significant time interval (e.g. tens of seconds)

Stop()

Stop media pushing

public void Stop()

Events

Error

Error occurred

public event EventHandler<ErrorEventArgs> Error

Event Type

EventHandler<ErrorEventArgs>

StateChanged

Sink state changed

public event EventHandler<MediaState> StateChanged

Event Type

EventHandler<MediaState>

UriRotated

Output URI has been rotated

public event EventHandler<UriRotatedEventArgs> UriRotated

Event Type

EventHandler<UriRotatedEventArgs>