Class StreamingServer
Represents the main streaming server that manages publishing points, protocol-specific sub-servers (RTMP, RTSP, SRT, WebRTC, HLS, MPEG-DASH, etc.), sources, sinks, and client connections.
public class StreamingServer
- Inheritance
-
StreamingServer
- Inherited Members
Constructors
StreamingServer(int)
Initializes a new instance of the StreamingServer class.
public StreamingServer(int maxConnectionCount = 1000)
Parameters
maxConnectionCountintThe maximum number of simultaneous connections allowed. Default is
1000.
Properties
ApiServerParameters
Gets or sets the API server parameters.
public ApiServerParameters ApiServerParameters { get; set; }
Property Value
CacheFolder
Gets or sets cache folder used to write files to by default. Also used to resolve $(CacheFolder) macro in API request.
public string CacheFolder { get; set; }
Property Value
CertificateThumbprint
Gets or sets the SSL/TLS certificate thumbprint used by protocol servers that support encryption.
public string CertificateThumbprint { get; set; }
Property Value
DashServerParameters
Gets or sets the MPEG-DASH server parameters.
public DashServerParameters DashServerParameters { get; set; }
Property Value
EnableFileCache
Gets or sets a value indicating whether the file cache is enabled for VOD publishing points.
public bool EnableFileCache { get; set; }
Property Value
EnableHls
Gets or sets a value indicating whether the HLS server is enabled.
public bool EnableHls { get; set; }
Property Value
EnableHttp
Gets or sets a value indicating whether the HTTP server is enabled.
public bool EnableHttp { get; set; }
Property Value
EnableJsonApi
Gets or sets a value indicating whether the JSON API server is enabled.
public bool EnableJsonApi { get; set; }
Property Value
EnableMjpeg
Gets or sets a value indicating whether the MJPEG server is enabled.
public bool EnableMjpeg { get; set; }
Property Value
EnableMpegDash
Gets or sets a value indicating whether the MPEG-DASH server is enabled.
public bool EnableMpegDash { get; set; }
Property Value
EnableRtmp
Gets or sets a value indicating whether the RTMP server is enabled.
public bool EnableRtmp { get; set; }
Property Value
EnableRtsp
Gets or sets a value indicating whether the RTSP server is enabled.
public bool EnableRtsp { get; set; }
Property Value
EnableSrt
Gets or sets a value indicating whether the SRT server is enabled.
public bool EnableSrt { get; set; }
Property Value
EnableStat
Gets or sets a value indicating whether server performance statistics collection is enabled.
public bool EnableStat { get; set; }
Property Value
EnableTcpServer
Gets or sets a value indicating whether the raw TCP server is enabled.
public bool EnableTcpServer { get; set; }
Property Value
EnableTsHttp
Gets or sets a value indicating whether the TS over HTTP server is enabled.
public bool EnableTsHttp { get; set; }
Property Value
EnableWebRtc
Gets or sets a value indicating whether the WebRTC server is enabled.
public bool EnableWebRtc { get; set; }
Property Value
EnableWebTransport
Gets or sets a value indicating whether the WebTransport server is enabled.
public bool EnableWebTransport { get; set; }
Property Value
EnableWsPcm
Gets or sets a value indicating whether the WebSocket PCM audio server is enabled.
public bool EnableWsPcm { get; set; }
Property Value
FileTransferRequestedHandler
Gets or sets the delegate that handles file transfer requests.
public FileTransferRequestedDelegate FileTransferRequestedHandler { get; set; }
Property Value
HlsServerParameters
Gets or sets the HLS server parameters.
public HlsServerParameters HlsServerParameters { get; set; }
Property Value
HttpServer
Gets the HTTP server instance used by this streaming server.
public HttpServer HttpServer { get; }
Property Value
HttpServerParameters
Gets or sets the HTTP server parameters.
public HttpServerParameters HttpServerParameters { get; set; }
Property Value
MjpegServerParameters
Gets or sets the MJPEG server parameters.
public MjpegServerParameters MjpegServerParameters { get; set; }
Property Value
RtmpServerParameters
Gets or sets the RTMP server parameters.
public RtmpServerParameters RtmpServerParameters { get; set; }
Property Value
RtspServerParameters
Gets or sets the RTSP server parameters.
public RtspServerParameters RtspServerParameters { get; set; }
Property Value
SrtServerParameters
Gets or sets the SRT server parameters.
public SrtServerParameters SrtServerParameters { get; set; }
Property Value
Stat
Gets the server performance statistics collector.
public StreamingServerStat Stat { get; }
Property Value
TcpServerParameters
Gets or sets the TCP server parameters.
public TcpServerParameters TcpServerParameters { get; set; }
Property Value
TsHttpServerParameters
Gets or sets the TS over HTTP server parameters.
public TsHttpServerParameters TsHttpServerParameters { get; set; }
Property Value
WebRtcServerParameters
Gets or sets the WebRTC server parameters.
public WebRtcServerParameters WebRtcServerParameters { get; set; }
Property Value
WebTransportServerParameters
Gets or sets the WebTransport server parameters.
public WebTransportServerParameters WebTransportServerParameters { get; set; }
Property Value
WsPcmServerParameters
Gets or sets the WebSocket PCM audio server parameters.
public WsPcmServerParameters WsPcmServerParameters { get; set; }
Property Value
Methods
CreatePublishingPoint(string, string, StreamingMode, PublishingPointParameters)
Create new publishing point with the pull source (eg RTSP pull).
public Guid CreatePublishingPoint(string publishingPath, string sourceUri, StreamingMode streamingMode, PublishingPointParameters additionalParameters = null)
Parameters
publishingPathstringPath to use for publishing point. It'll be used for example to serve client request rtmp://server/live/publishingPath
sourceUristringSource URI to pull media data from
streamingModeStreamingModeStreaming mode
additionalParametersPublishingPointParametersOptional additional parameters
Returns
CreatePublishingPoint(string, string, PublishingPointParameters)
Create new publishing point with the pull source (eg RTSP pull).
public Guid CreatePublishingPoint(string publishingPath, string sourceUri, PublishingPointParameters additionalParameters = null)
Parameters
publishingPathstringPath to use for publishing point. It'll be used for example to serve client request rtmp://server/live/publishingPath
sourceUristringSource URI to pull media data from
additionalParametersPublishingPointParametersOptional additional parameters
Returns
CreatePublishingPoint(string, IMediaSource, StreamingMode, PublishingPointParameters)
Create new publishing point with the provided source
public Guid CreatePublishingPoint(string publishingPath, IMediaSource source, StreamingMode streamingMode, PublishingPointParameters additionalParameters = null)
Parameters
publishingPathstringPath to use for publishing point. It'll be used for example to serve client request rtmp://server/live/publishingPath
sourceIMediaSourceSource to pull media data from
streamingModeStreamingModeStreaming mode
additionalParametersPublishingPointParametersOptional additional parameters
Returns
CreatePublishingPoint(string, IMediaSource, PublishingPointParameters)
Create new publishing point with the provided source
public Guid CreatePublishingPoint(string publishingPath, IMediaSource source, PublishingPointParameters additionalParameters = null)
Parameters
publishingPathstringPath to use for publishing point. It'll be used for example to serve client request rtmp://server/live/publishingPath
sourceIMediaSourceSource to pull media data from
additionalParametersPublishingPointParametersOptional additional parameters
Returns
GetConnectedClient(Guid)
Gets client based on its connection id
public ConnectedClient GetConnectedClient(Guid connectionId)
Parameters
connectionIdGuidConnection id of client
Returns
- ConnectedClient
Client if found, null otherwise
GetPublishingPoint(Guid)
Gets publishing point (published stream) based on its connection id
public PublishingPoint GetPublishingPoint(Guid connectionId)
Parameters
connectionIdGuidConnection id of the source
Returns
- PublishingPoint
Publishing point if found, null otherwise
GetPublishingPoint(string)
Gets publishing point (published stream) based on its publishing path
public PublishingPoint GetPublishingPoint(string publishingPath)
Parameters
publishingPathstringPublishing path
Returns
- PublishingPoint
Publishing point if found, null otherwise
GetPublishingPoints()
Gets immediate snapshot of active publishing points
public List<PublishingPoint> GetPublishingPoints()
Returns
- List<PublishingPoint>
List of active publishing points
GetSource(Guid)
Gets a media source by its unique identifier.
public IMediaSource GetSource(Guid sourceId)
Parameters
sourceIdGuidThe unique identifier of the source.
Returns
- IMediaSource
The media source if found; otherwise,
null.
IsPublishingPointInUse(Guid)
Checks if publishing point is in use, i.e. has at least one connected client
public bool IsPublishingPointInUse(Guid connectionId)
Parameters
connectionIdGuidConnection id of the source
Returns
- bool
True if publishing point is in use, false otherwise
IsPublishingPointInUse(string)
Checks if publishing point is in use, i.e. has at least one connected client
public bool IsPublishingPointInUse(string publishingPath)
Parameters
publishingPathstringPublishing path
Returns
- bool
True if publishing point is in use, false otherwise
ResolveMacros(string)
Resolves macro placeholders in the specified string, such as $(CacheFolder).
public string ResolveMacros(string stringToResolve)
Parameters
stringToResolvestringThe string containing macros to resolve.
Returns
- string
The string with all macros replaced by their actual values.
Start()
Starts the streaming server with all enabled protocol sub-servers.
public void Start()
Start(HttpListener)
Starts the streaming server using the specified HTTP listener.
public void Start(HttpListener httpListener)
Parameters
httpListenerHttpListenerThe HTTP listener to use for HTTP-based protocols.
Start(HttpServer)
Starts the streaming server using the specified HTTP server instance.
public void Start(HttpServer httpServer)
Parameters
httpServerHttpServerThe HTTP server instance to use, or
nullto create a new one if HTTP is enabled.
Stop()
Stops the streaming server, shutting down all publishing points and protocol sub-servers, and releasing all resources.
public void Stop()
Update()
Updates the streaming server settings by detecting changes to protocol configurations, stopping affected sub-servers, and restarting them with the new settings.
public void Update()
Events
Authorize
Occurs when a connection requires authorization.
public event StreamingServer.AuthorizeHandler Authorize
Event Type
ClientConnected
Occurs when a client has connected to a publishing point.
public event StreamingServer.ClientConnectedHandler ClientConnected
Event Type
Disconnected
Occurs when a connection is disconnected.
public event StreamingServer.DisconnectedHandler Disconnected
Event Type
Error
Occurs when an error is encountered during connection processing.
public event StreamingServer.ErrorHandler Error
Event Type
PublisherConnected
Occurs when a publisher has connected and a publishing point has been created.
public event StreamingServer.PublisherConnectedHandler PublisherConnected
Event Type
PublishingPointDisposing
Occurs when a publishing point is about to be disposed.
public event StreamingServer.PublishingPointDisposingHandler PublishingPointDisposing
Event Type
PublishingPointRequested
Occurs when a new publishing point is requested by a client connection.
public event StreamingServer.PublishingPointRequestedHandler PublishingPointRequested
Event Type
ReceivedApiCommand
Occurs when an unknown API command is received by the server.
public event StreamingServer.ReceivedCommandHandler ReceivedApiCommand