Table of Contents

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, IMediaBlockDynamicInputs

Inheritance

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

settings FacebookLiveSinkSettings

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 settings is null.

Properties

Input

Gets the first input.

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

Inputs

Gets the inputs.

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

Output

Gets the output.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets the outputs.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

Settings

Gets or sets the Facebook Live streaming configuration.

public FacebookLiveSinkSettings Settings { get; set; }

Property Value

FacebookLiveSinkSettings

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

MediaBlockType

Methods

Build()

Builds this instance.

public override bool Build()

Returns

bool

true if successfull, false otherwise.

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

mediaType MediaBlockPadMediaType

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

disposing bool

true to release both managed and unmanaged resources; false to 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

mediaType MediaBlockPadMediaType

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

true if 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

value string

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

pipeline MediaBlocksPipeline

The pipeline.

See Also