2020 API AWARDS WINNER - BEST IN MEDIA APIs LEARN MORE

MediaDeviceService

The MediaDeviceService allows the application to manage the devices that are used during the conference.

Typical application workflow:

1. The application calls the getEglContext method to get the WebRTC EglBaseContext that enables data rendering.

2. The application sets the MediaCryptoCallback through the setCryptoCallback method to internally register the component for encrypting and decrypting WebRTC communication packets.

3. Then, the application is able to attach the stream to the specific receiver using the attachMediaStream method. It can detach the stream by calling the unAttachMediaStream method.

4. The application can also call the isAudio3DEnabled method to check the state of 3D audio management. It can turn it on and off through the setAudio3DEnabled method.

5. The application can also check information about used cameras through the getCameraContext method. The switchCamera method enables the app to change the current camera to another one.

Available in the package com.voxeet.sdk.services.MediaDeviceService.

Methods

getEglContext

getEglContext(): EglBase.Context

Gets the WebRTC EglBaseContext.

It is used by SDK elements but it is also publically accessible.

Returns: @Nullable EglBase.Context - the current EglBaseContext or a null value if media are not created.

setCryptoCallback

setCryptoCallback(@Nullable callback: AbstractNativeMediaCryptoCallback): void

Sets the MediaCryptoCallback to use it before joining the conference.

Note: This method is not released automatically, it must be unset and set again before conferences.

Parameters

NameTypeDescription
callbackAbstractNativeMediaCryptoCallbacknullable callback, the null value unsets the callback

attachMediaStream

attachMediaStream(@NonNull stream: MediaStream, @NonNull videoSink: VideoSink): boolean

Attaches a stream to the given receiver.

Note: If a stream is already attached to the receiver, this method will detach it.

Parameters

NameTypeDescription
streamMediaStreamnon null valid media stream to attach
videoSinkVideoSinknon null videosink that will receive updates

Returns: boolean

unAttachMediaStream

unAttachMediaStream(@NonNull videoSink: VideoSink): boolean

Detaches the stream from the given videoSink.

Parameters

NameTypeDescription
videoSinkVideoSinknon null receiver instance

Returns: boolean - the release indicator.

isAudio3DEnabled

isAudio3DEnabled(): boolean

Checks the state of the 3D audio management.

Returns: boolean - the 3D management indicator.

setAudio3DEnabled

setAudio3DEnabled(enable: boolean): boolean

Turns on and off the 3D Audio management. If conferences or media are not initialized, the state will not change for the next calls. The SDK keeps the value, it must be recalled with the new value to be updated.

Parameters

NameTypeDescription
enablebooleannew state for 3D audio processing

Returns: boolean - true, a false value means that media are not initialized.

switchCamera

switchCamera(): Promise<Boolean>

Switches the current camera to another available camera that is connected to the device. On Android, the second camera exists by default but on other devices, there may be none, one, two, or even more cameras.

It updates the camera provider's information with the new camera type: front or back.

Returns: @NonNull Promise<Boolean> - the promise to resolve.

getCameraContext

getCameraContext(): CameraContext

Retrieves the instance of the camera information.

Returns: @NonNull CameraContext - the CameraContext