Skip to main content
Version: 20 Mar 2024

NativeBindings

Native bindings for the MLWebRTC.Source struct.

Inherits from:
MagicLeapNativeBindings

Public Methods

MLResult.Code MLWebRTCSourceCreateAppDefinedAudioSourceEx

Creates the local source with the specified parameters.

public MLResult.Code MLWebRTCSourceCreateAppDefinedAudioSourceEx(
ref MLWebRTCAppDefinedSourceParams sourceParams,
out ulong sourceHandle
)

Parameters

TypeNameDescription
ref MLWebRTCAppDefinedSourceParamssourceParamsAudio source parameters
out ulongsourceHandleThe handle to the local source to return to the caller.

Returns: MLResult.Result will be MLResult.Code.Ok if the local source was successfully created. MLResult.Result will be MLResult.Code.PermissionDenied if necessary permission is missing. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to other internal error.


MLResult.Code MLWebRTCSourceCreateLocalSourceForCamera

Creates the local source that links to the user's MLCamera.

public MLResult.Code MLWebRTCSourceCreateLocalSourceForCamera(
in MLCamera.NativeBindings.MLCameraConnectContext inputContext,
out ulong sourceHandle
)

Parameters

TypeNameDescription
in MLCamera.NativeBindings.MLCameraConnectContextsourceHandleThe handle to the local source to return to the caller.
out ulongsourceHandle

Returns: MLResult.Result will be MLResult.Code.Ok if the local source was successfully created. MLResult.Result will be MLResult.Code.PermissionDenied if necessary permission is missing. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to other internal error.


MLResult.Code MLWebRTCSourceCreateLocalSourceForMicrophoneEx

Creates the local source with the specified track name that links to the user's microphone.

public MLResult.Code MLWebRTCSourceCreateLocalSourceForMicrophoneEx(
string trackName,
out ulong sourceHandle
)

Parameters

TypeNameDescription
stringtrackNameTrack name
out ulongsourceHandleThe handle to the local source to return to the caller.

Returns: MLResult.Result will be MLResult.Code.Ok if the local source was successfully created. MLResult.Result will be MLResult.Code.PermissionDenied if necessary permission is missing. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to other internal error.


MLResult.Code MLWebRTCSourceDestroy

Destroys the local source.

public MLResult.Code MLWebRTCSourceDestroy(
ulong sourceHandle
)

Parameters

TypeNameDescription
ulongsourceHandleThe handle to the local source to destroy.

Returns: MLResult.Result will be MLResult.Code.Ok if the local source was successfully destroyed. MLResult.Result will be MLResult.Code.PermissionDenied if necessary permission is missing. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to other internal error.


MLResult.Code MLWebRTCSourceGetTrackId

Gets the track Id of a source, call MLWebRTCSourceReleaseTrackId after.

public MLResult.Code MLWebRTCSourceGetTrackId(
ulong sourceHandle,
out IntPtr trackIdPtr
)

Parameters

TypeNameDescription
ulongsourceHandleThe handle of the media source.
out IntPtrtrackIdPtrDouble-pointer to the unmanaged trackId string.

Returns: MLResult.Result will be MLResult.Code.Ok if destroying all handles was successful. MLResult.Result will be MLResult.Code.MismatchingHandle if an incorrect handle was sent. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to other internal error.


MLResult.Code MLWebRTCSourceGetType

Checks if an video source is currently enabled.

public MLResult.Code MLWebRTCSourceGetType(
ulong sourceHandle,
out MLWebRTC.MediaStream.Track.Type sourceType
)

Parameters

TypeNameDescription
ulongsourceHandleThe handle of the video source.
out MLWebRTC.MediaStream.Track.TypesourceTypeType of the source.

Returns: MLResult.Result will be MLResult.Code.Ok if the video source status was queried successfully. MLResult.Result will be MLResult.Code.PermissionDenied if necessary permission is missing. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to other internal error.


MLResult.Code MLWebRTCSourceIsEnabled

Checks if an audio source is currently enabled.

public MLResult.Code MLWebRTCSourceIsEnabled(
ulong sourceHandle,
out bool enabled
)

Parameters

TypeNameDescription
ulongsourceHandleThe handle of the source.
out boolenabledTrue if source is enabled.

Returns: MLResult.Result will be MLResult.Code.Ok if the audio source status was queried successfully. MLResult.Result will be MLResult.Code.PermissionDenied if necessary permission is missing. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to other internal error.


MLResult.Code MLWebRTCSourceReleaseTrackId

Releases the memory created when calling MLWebRTCSourceGetTrackId.

public MLResult.Code MLWebRTCSourceReleaseTrackId(
ulong sourceHandle,
IntPtr trackId
)

Parameters

TypeNameDescription
ulongsourceHandleThe handle of the data channel.
IntPtrtrackIdPointer to the unmanaged trackId string.

Returns: MLResult.Result will be MLResult.Code.Ok if destroying all handles was successful. MLResult.Result will be MLResult.Code.MismatchingHandle if an incorrect handle was sent. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to other internal error.


MLResult.Code MLWebRTCSourceSetEnabled

Enables or disables a audio source.

public MLResult.Code MLWebRTCSourceSetEnabled(
ulong sourceHandle,
bool enabled
)

Parameters

TypeNameDescription
ulongsourceHandleThe handle of the audio source.
boolenabledSets the audio source to be enabled or disabled.

Returns: MLResult.Result will be MLResult.Code.Ok if the audio source was enabled/disabled successfully. MLResult.Result will be MLResult.Code.PermissionDenied if necessary permission is missing. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to other internal error.