NEWDolby Interactivity APIs are now the Communications APIs Learn More >


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 to share WebRTC mechanisms with the application.

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. The application can detach the stream by calling the unAttachMediaStream method.

4. The application can also check information about the used cameras through the getCameraContext method. The switchCamera method enables the application to change the current camera to a different camera.

5. The application can check the selected comfort noise level for output devices in Dolby Voice conferences, and change the comfort noise level.

Available in the package



getEglContext(): EglBaseInteracts.Context

Gets EglBaseContext from WebRTC to share WebRTC mechanisms with the application.

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


setCryptoCallback(@Nullable callback: AbstractNativeMediaCryptoCallback): void

Enables MediaCryptoCallback.

Note: This method is disabled by default. Before joining conferences, turn setCryptoCallback off and on again.


callbackAbstractNativeMediaCryptoCallbacknullable callback, the null value disables the callback


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.


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

Returns: boolean


unAttachMediaStream(@NonNull videoSink: VideoSink): boolean

Detaches the stream from the given videoSink.


videoSinkVideoSinknon null receiver instance

Returns: boolean - the release indicator.


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(): CameraContext

Retrieves the instance of the camera information.

Returns: @NonNull CameraContext - the CameraContext


setComfortNoiseLevel(level: MediaEngine.ComfortNoiseLevel): void

Configures the comfort noise level for output devices in Dolby Voice conferences.


levelMediaEngine.ComfortNoiseLevelThe selected comfort noise level.


getComfortNoiseLevel(): MediaEngine.ComfortNoiseLevel

Retrieves the comfort noise level setting for output devices in Dolby Voice conferences.

Returns: MediaEngine.ComfortNoiseLevel - The comfort noise level.

Did this page help you?