MediaDevice MediaDevice MediaDevice MediaDevice Class

Definition

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

public : static class MediaDevicepublic static class MediaDevicePublic Static Class MediaDevice// You can use this class in JavaScript.
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// You can use this method in JavaScript.
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// You can use this method in JavaScript.
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// You can use this method in JavaScript.
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// You can use this method in JavaScript.
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// You can use this method in JavaScript.
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 : static event TypedEventHandler DefaultAudioCaptureDeviceChanged<object,  DefaultAudioCaptureDeviceChangedEventArgs>public static event TypedEventHandler DefaultAudioCaptureDeviceChanged<object,  DefaultAudioCaptureDeviceChangedEventArgs>Public Static Event DefaultAudioCaptureDeviceChanged<object,  DefaultAudioCaptureDeviceChangedEventArgs>// You can use this event in JavaScript.

DefaultAudioRenderDeviceChanged DefaultAudioRenderDeviceChanged DefaultAudioRenderDeviceChanged DefaultAudioRenderDeviceChanged

Raised when the default audio render device is changed.

public : static event TypedEventHandler DefaultAudioRenderDeviceChanged<object,  DefaultAudioRenderDeviceChangedEventArgs>public static event TypedEventHandler DefaultAudioRenderDeviceChanged<object,  DefaultAudioRenderDeviceChangedEventArgs>Public Static Event DefaultAudioRenderDeviceChanged<object,  DefaultAudioRenderDeviceChangedEventArgs>// You can use this event in JavaScript.