Class FacebookLiveSinkBlock
- Namespace
- VisioForge.Core.MediaBlocks.Sinks
- Assembly
- VisioForge.Core.dll
Implements a sink block for streaming live video and audio to Facebook Live. Enables real-time broadcasting to Facebook's streaming platform using RTMP protocol.
public class FacebookLiveSinkBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals, IMediaBlockDynamicInputsInheritance
Implements
Inherited Members
Extension Methods
Remarks
The FacebookLiveSinkBlock provides functionality to stream media content directly to Facebook Live. It supports: - H.264 video streaming with configurable bitrate and resolution - AAC audio streaming with adjustable quality - RTMP/RTMPS protocol for secure streaming - Multiple stream quality settings - Automatic reconnection on network failures
To use this block, you need: - A Facebook Live stream key from your Facebook account - Properly encoded video (H.264) and audio (AAC) streams - Stable internet connection with sufficient upload bandwidth
Common use cases include: - Live event broadcasting - Gaming streams - Educational content streaming - Live product demonstrations
Constructors
FacebookLiveSinkBlock(FacebookLiveSinkSettings)
Initializes a new instance of the VisioForge.Core.MediaBlocks.Sinks.FacebookLiveSinkBlock class.
public FacebookLiveSinkBlock(FacebookLiveSinkSettings settings)Parameters
settingsFacebookLiveSinkSettings-
The Facebook Live streaming configuration including stream key and quality settings.
Remarks
The stream key must be obtained from your Facebook Live Producer page. Ensure your account has live streaming permissions enabled.
Exceptions
- ArgumentNullException
-
Thrown when
settingsisnull.
Properties
Input
Gets the first input.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets the inputs.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the output.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets the outputs.
public override MediaBlockPad[] Outputs { get; }Property Value
Settings
Gets or sets the Facebook Live streaming configuration.
public FacebookLiveSinkSettings Settings { get; set; }Property Value
Remarks
The settings include:
- Stream key: Your unique Facebook Live stream key
- Server URL: Facebook's RTMP ingest server (usually automatic)
- Video settings: Resolution, framerate, bitrate
- Audio settings: Sample rate, channels, bitrate
- Network settings: Buffer sizes, timeout values
Type
Gets the type.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Builds this instance.
public override bool Build()Returns
- bool
-
trueif successfull,falseotherwise.
CleanUp()
Performs cleanup of resources used by the Facebook Live sink.
public void CleanUp()Remarks
This method releases the underlying streaming element and resets the build state. Any active stream connection will be terminated.
CreateNewInput(MediaBlockPadMediaType)
Creates a new input pad for the specified media type.
public MediaBlockPad CreateNewInput(MediaBlockPadMediaType mediaType)Parameters
mediaTypeMediaBlockPadMediaType-
The type of media stream (video or audio only).
Returns
- MediaBlockPad
-
A new VisioForge.Core.MediaBlocks.MediaBlockPad configured for the specified media type.
Remarks
Facebook Live supports one video stream and one audio stream. Video must be H.264 encoded and audio must be AAC encoded. Subtitle streams are not supported.
Dispose(bool)
Releases unmanaged and - optionally - managed resources.
protected override void Dispose(bool disposing)Parameters
disposingbool-
trueto release both managed and unmanaged resources;falseto release only unmanaged resources.
GetCore()
Gets core.
public BaseElement GetCore()Returns
- BaseElement
-
VisioForge.Core.GStreamer.Base.BaseElement.
GetElement()
Gets the element.
public Element GetElement()Returns
- Element
-
Gst.Element.
GetFilenameOrURL()
Gets the stream key or URL for Facebook Live streaming.
public string GetFilenameOrURL()Returns
- string
-
The Facebook Live stream key.
GetInput(MediaBlockPadMediaType)
Gets the existing input.
public MediaBlockPad GetInput(MediaBlockPadMediaType mediaType)Parameters
mediaTypeMediaBlockPadMediaType-
Type of the media.
Returns
- MediaBlockPad
-
MediaBlockPad.
IsAvailable()
Determines whether Facebook Live streaming functionality is available on the current platform.
public static bool IsAvailable()Returns
- bool
-
trueif Facebook Live sink is available; otherwise,false. Requires RTMP support and appropriate GStreamer plugins.
Remarks
This method checks for the presence of required GStreamer plugins (rtmpsink, flvmux) and network capabilities needed for Facebook Live streaming.
SetFilenameOrURL(string)
Sets the stream key or URL for Facebook Live streaming.
public void SetFilenameOrURL(string value)Parameters
valuestring-
The stream key value.
Exceptions
- NotImplementedException
-
This method is not implemented. Use Settings.Key instead.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the context.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The pipeline.