MediaDevice MediaDevice MediaDevice MediaDevice Class

Definition

Provides methods used to select devices for capturing and rendering audio, and for capturing video.

public : static class MediaDevice
public static class MediaDevice
Public Static Class MediaDevice
// This class does not provide a public constructor.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Methods

GetAudioCaptureSelector() GetAudioCaptureSelector() GetAudioCaptureSelector() GetAudioCaptureSelector()

Returns the identifier string of a device for capturing audio.

public : static Platform::String GetAudioCaptureSelector()
public static string GetAudioCaptureSelector()
Public Static Function GetAudioCaptureSelector() As string
var string = Windows.Media.Devices.MediaDevice.getAudioCaptureSelector();
Returns
Platform::String string string string

The identifier string of the audio capture device.

GetAudioRenderSelector() GetAudioRenderSelector() GetAudioRenderSelector() GetAudioRenderSelector()

Returns the identifier string of a device for rendering audio.

public : static Platform::String GetAudioRenderSelector()
public static string GetAudioRenderSelector()
Public Static Function GetAudioRenderSelector() As string
var string = Windows.Media.Devices.MediaDevice.getAudioRenderSelector();
Returns
Platform::String string string string

The identifier string of the audio rendering device.

GetDefaultAudioCaptureId(AudioDeviceRole) GetDefaultAudioCaptureId(AudioDeviceRole) GetDefaultAudioCaptureId(AudioDeviceRole) GetDefaultAudioCaptureId(AudioDeviceRole)

Returns the identifier string of the default device for capturing audio in the specified role.

public : static Platform::String GetDefaultAudioCaptureId(AudioDeviceRole role)
public static string GetDefaultAudioCaptureId(AudioDeviceRole role)
Public Static Function GetDefaultAudioCaptureId(role As AudioDeviceRole) As string
var string = Windows.Media.Devices.MediaDevice.getDefaultAudioCaptureId(role);
Parameters
role
AudioDeviceRole AudioDeviceRole AudioDeviceRole AudioDeviceRole

The specified audio device role (console, media, or communications).

Returns
Platform::String string string string

The identifier string of the default device.

GetDefaultAudioRenderId(AudioDeviceRole) GetDefaultAudioRenderId(AudioDeviceRole) GetDefaultAudioRenderId(AudioDeviceRole) GetDefaultAudioRenderId(AudioDeviceRole)

Returns the identifier string of the default device for rendering audio in the specified role.

public : static Platform::String GetDefaultAudioRenderId(AudioDeviceRole role)
public static string GetDefaultAudioRenderId(AudioDeviceRole role)
Public Static Function GetDefaultAudioRenderId(role As AudioDeviceRole) As string
var string = Windows.Media.Devices.MediaDevice.getDefaultAudioRenderId(role);
Parameters
role
AudioDeviceRole AudioDeviceRole AudioDeviceRole AudioDeviceRole

The specified audio device role (console, media, or communications).

Returns
Platform::String string string string

The identifier string of the default device.

GetVideoCaptureSelector() GetVideoCaptureSelector() GetVideoCaptureSelector() GetVideoCaptureSelector()

Returns the identifier string of a device for capturing video.

public : static Platform::String GetVideoCaptureSelector()
public static string GetVideoCaptureSelector()
Public Static Function GetVideoCaptureSelector() As string
var string = Windows.Media.Devices.MediaDevice.getVideoCaptureSelector();
Returns
Platform::String string string string

The identifier string of the video capture device.

Events

DefaultAudioCaptureDeviceChanged DefaultAudioCaptureDeviceChanged DefaultAudioCaptureDeviceChanged DefaultAudioCaptureDeviceChanged

Raised when the default audio capture device is changed.

public : event TypedEventHandler DefaultAudioCaptureDeviceChanged<Platform::Object, DefaultAudioCaptureDeviceChangedEventArgs>
public event TypedEventHandler DefaultAudioCaptureDeviceChanged<object, DefaultAudioCaptureDeviceChangedEventArgs>
Public Event TypedEventHandler DefaultAudioCaptureDeviceChanged( Of ( Of object ), ( Of DefaultAudioCaptureDeviceChangedEventArgs ))
function onDefaultAudioCaptureDeviceChanged(eventArgs){/* Your code */}


mediaDevice.addEventListener("defaultAudioCaptureDeviceChanged", onDefaultAudioCaptureDeviceChanged);
mediaDevice.removeEventListener("defaultAudioCaptureDeviceChanged", onDefaultAudioCaptureDeviceChanged);

DefaultAudioRenderDeviceChanged DefaultAudioRenderDeviceChanged DefaultAudioRenderDeviceChanged DefaultAudioRenderDeviceChanged

Raised when the default audio render device is changed.

public : event TypedEventHandler DefaultAudioRenderDeviceChanged<Platform::Object, DefaultAudioRenderDeviceChangedEventArgs>
public event TypedEventHandler DefaultAudioRenderDeviceChanged<object, DefaultAudioRenderDeviceChangedEventArgs>
Public Event TypedEventHandler DefaultAudioRenderDeviceChanged( Of ( Of object ), ( Of DefaultAudioRenderDeviceChangedEventArgs ))
function onDefaultAudioRenderDeviceChanged(eventArgs){/* Your code */}


mediaDevice.addEventListener("defaultAudioRenderDeviceChanged", onDefaultAudioRenderDeviceChanged);
mediaDevice.removeEventListener("defaultAudioRenderDeviceChanged", onDefaultAudioRenderDeviceChanged);