Skip to main content
Version: 20 Mar 2024

VideoSink

Class that represents a video sink used by the MLWebRTC API. Video sinks are fed data by media sources and produces frames to render. More...

Inherits from:
Sink,
Sink

Detailed Description

public class VideoSink : Sink 

Details*

Class that represents a source used by the MLWebRTC API.


Public Methods

bool AcquireNextAvailableFrame

public bool AcquireNextAvailableFrame(
out Frame newFrame
)

Parameters

TypeNameDescription
out FramenewFrameStruct representing a captured camera frame.

VideoSink Create

Creates an initialized VideoSink object.

public static VideoSink Create(
out MLResult result
)

Parameters

TypeNameDescription
out MLResultresultThe MLResult object of the inner platform call(s).

Returns: An initialized VideoSink object.


override MLResult Destroy

Destroys the video sink.

public virtual override MLResult Destroy()

Returns: MLResult.Result will be MLResult.Code.Ok if destroying all handles was successful. MLResult.Result will be MLResult.Code.WebRTCResultInstanceNotCreated if MLWebRTC instance was not created. MLResult.Result will be MLResult.Code.WebRTCResultMismatchingHandle if an incorrect handle was sent.

Reimplements: Destroy


bool IsNewFrameAvailable

public bool IsNewFrameAvailable()

delegate void OnDestroySinkDelegate

public delegate void OnDestroySinkDelegate(
VideoSink videoSink
)

Parameters

TypeNameDescription
VideoSinkvideoSinkClass that represents a video sink used by the MLWebRTC API. Video sinks are fed data by media sources and produces frames to render.

delegate void OnFrameResolutionChangedDelegate

public delegate void OnFrameResolutionChangedDelegate(
uint newWidth,
uint newHeight
)

Parameters

TypeNameDescription
uintnewWidth
uintnewHeight

delegate void OnStreamChangedDelegate

public delegate void OnStreamChangedDelegate(
MediaStream stream
)

Parameters

TypeNameDescription
MediaStreamstreamClass that represents a media stream object.

void ReleaseFrame

public void ReleaseFrame()

MLResult SetStream

Sets the stream of the video sink sink.

public MLResult SetStream(
MediaStream stream
)

Parameters

TypeNameDescription
MediaStreamstreamThe stream to use.

Returns: MLResult.Result will be MLResult.Code.Ok if destroying all handles was successful. MLResult.Result will be MLResult.Code.WebRTCResultInstanceNotCreated if MLWebRTC instance was not created. MLResult.Result will be MLResult.Code.WebRTCResultMismatchingHandle if an incorrect handle was sent.


Protected Methods

SetTrack

Sets the track of the video sink.

protected override MLResult SetTrack(
MediaStream.Track track
)

Parameters

TypeNameDescription
MediaStream.TracktrackThe track to use.

Returns: MLResult.Result will be MLResult.Code.Ok if destroying all handles was successful. MLResult.Result will be MLResult.Code.WebRTCResultInstanceNotCreated if MLWebRTC instance was not created. MLResult.Result will be MLResult.Code.WebRTCResultMismatchingHandle if an incorrect handle was sent.


Public Events

OnDestroySink

public OnDestroySinkDelegate OnDestroySink()

OnFrameResolutionChanged

public OnFrameResolutionChangedDelegate OnFrameResolutionChanged()

OnStreamChanged

public OnStreamChangedDelegate OnStreamChanged()