Class MediaDeviceService
The media device service provides access to set the input and output audio devices as well as getting notifications about the added and removed devices.
To use the media device service, follow these steps:
- Get all current audio devices using the GetAudioDevicesAsync() method.
- Set the desired input audio device by calling the SetPreferredAudioInputDeviceAsync(AudioDevice) method.
- Set the desired output audio device by calling the SetPreferredAudioOutputDeviceAsync(AudioDevice) method.
- Subscribe to the AudioDeviceAdded, AudioDeviceRemoved, and AudioDeviceChanged events.
Inherited Members
Namespace: DolbyIO.Comms.Services
Assembly: DolbyIO.Comms.Sdk.dll
Syntax
public sealed class MediaDeviceService
Methods
| Improve this Doc View SourceGetAudioDevicesAsync()
Gets a list of all audio devices that are currently available in the system.
Declaration
public async Task<List<AudioDevice>> GetAudioDevicesAsync()
Returns
Type | Description |
---|---|
Task<List<AudioDevice>> | The Task<TResult> that represents the asynchronous operation. The Result property returns a list of audio devices that are currently available in the system. |
GetCurrentAudioInputDeviceAsync()
Gets the audio input device that is currently used by the system.
Declaration
public async Task<AudioDevice> GetCurrentAudioInputDeviceAsync()
Returns
Type | Description |
---|---|
Task<AudioDevice> | The Task<TResult> that represents the asynchronous operation. The Result property returns the audio device that is currently used by the system. |
GetCurrentAudioOutputDeviceAsync()
Gets the audio output device that is currently used by the system.
Declaration
public async Task<AudioDevice> GetCurrentAudioOutputDeviceAsync()
Returns
Type | Description |
---|---|
Task<AudioDevice> | The currently used output audio device. |
GetCurrentVideoDeviceAsync()
Gets the video device that is currently used by the system.
Declaration
public async Task<VideoDevice> GetCurrentVideoDeviceAsync()
Returns
Type | Description |
---|---|
Task<VideoDevice> | The Result property returns the video device that is currently used by the system. |
GetScreenShareSourcesAsync()
Get a list of all possible Screen Sharing sources. This can be both entire monitor screens or specific active application windows.
Declaration
public async Task<List<ScreenShareSource>> GetScreenShareSourcesAsync()
Returns
Type | Description |
---|---|
Task<List<ScreenShareSource>> | The Result property returns the screen share source list. |
GetVideoDevicesAsync()
Gets a list of all video devices that are currently available in the system.
Declaration
public async Task<List<VideoDevice>> GetVideoDevicesAsync()
Returns
Type | Description |
---|---|
Task<List<VideoDevice>> | The Task<TResult> that represents an asynchronous operation. The Result property returns a list of video devices that are currently available in the system. |
SetPreferredAudioInputDeviceAsync(AudioDevice)
Sets the preferred input audio device.
Declaration
public async Task SetPreferredAudioInputDeviceAsync(AudioDevice device)
Parameters
Type | Name | Description |
---|---|---|
AudioDevice | device | The AudioDevice object to set as preferred input device. |
Returns
Type | Description |
---|---|
Task | A Task that represents the asynchronous operation. |
SetPreferredAudioOutputDeviceAsync(AudioDevice)
Sets the preferred output audio device.
Declaration
public async Task SetPreferredAudioOutputDeviceAsync(AudioDevice device)
Parameters
Type | Name | Description |
---|---|---|
AudioDevice | device | The AudioDevice object to set as preferred output device. |
Returns
Type | Description |
---|---|
Task | A Task that represents the asynchronous operation. |
Events
| Improve this Doc View SourceAudioDeviceAdded
Sets the AudioDeviceAddedEventHandler that is raised when a new audio device is added to the system.
Declaration
public event AudioDeviceAddedEventHandler AudioDeviceAdded
Event Type
Type | Description |
---|---|
AudioDeviceAddedEventHandler | The AudioDeviceAddedEventHandler event handler. |
AudioDeviceChanged
Sets the AudioDeviceChangedEventHandler that is raised when the currently used input or output audio device has changed.
Declaration
public event AudioDeviceChangedEventHandler AudioDeviceChanged
Event Type
Type | Description |
---|---|
AudioDeviceChangedEventHandler | The AudioDeviceChangedEventHandler event handler. |
AudioDeviceRemoved
Sets the AudioDeviceRemovedEventHandler that is raised when an audio device is removed from the system.
Declaration
public event AudioDeviceRemovedEventHandler AudioDeviceRemoved
Event Type
Type | Description |
---|---|
AudioDeviceRemovedEventHandler | The AudioDeviceRemovedEventHandler event handler. |
VideoDeviceAdded
Sets the VideoDeviceAddedEventHandler that is raised when a new video device is added to the system.
Declaration
public event VideoDeviceAddedEventHandler VideoDeviceAdded
Event Type
Type | Description |
---|---|
VideoDeviceAddedEventHandler | The AudioDeviceAddedEventHandler event handler. |
VideoDeviceChanged
Sets the VideoDeviceChangedEventHandler that is raised when the currently used input or output video device has changed.
Declaration
public event VideoDeviceChangedEventHandler VideoDeviceChanged
Event Type
Type | Description |
---|---|
VideoDeviceChangedEventHandler | The VideoDeviceChangedEventHandler event handler. |
VideoDeviceRemoved
Sets the VideoDeviceRemovedEventHandler that is raised when a video device is removed from the system.
Declaration
public event VideoDeviceRemovedEventHandler VideoDeviceRemoved
Event Type
Type | Description |
---|---|
VideoDeviceRemovedEventHandler | The VideoDeviceRemovedEventHandler event handler. |