Table of Contents

Class MediaDeviceInfo

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The MediaDeviceInfo interface of the {{domxref("Media Capture and Streams API", "", "", "nocode")}} contains information that describes a single media input or output device.

[Value("MediaDeviceInfo")]
public class MediaDeviceInfo
Inheritance
MediaDeviceInfo
Derived
Inherited Members

Remarks

The list of devices obtained by calling EnumerateDevices() is an array of MediaDeviceInfo objects, one per media device.

-WebRTC API
-EnumerateDevices()
-GetUserMedia(MediaStreamConstraints)

See also on MDN

Constructors

MediaDeviceInfo()

public MediaDeviceInfo()

Properties

DeviceId

The deviceId read-only property
of the MediaDeviceInfo interface returns a string
that is an identifier for the represented device and is persisted across
sessions.

[Value("deviceId")]
public string DeviceId { get; }

Property Value

string

A string.

Remarks

It is un-guessable by other applications, and unique to the origin of
the calling application. It is reset when the user clears cookies. For private browsing,
a different identifier is used that is not persisted across sessions.

See also on MDN

GroupId

The groupId read-only property of
the MediaDeviceInfo interface returns a string that
is a group identifier.

[Value("groupId")]
public string GroupId { get; }

Property Value

string

A string which uniquely identifies the group of related devices to
which this device belongs.

Remarks

Two devices have the same group identifier if they
belong to the same physical device; for example, a monitor with both a built-in camera
and microphone.

See also on MDN

Kind

The kind read-only property of
the MediaDeviceInfo interface returns an enumerated value, that is
either "videoinput", "audioinput" or "audiooutput".

[Value("kind")]
public MediaDeviceKind Kind { get; }

Property Value

MediaDeviceKind

One of "videoinput", "audioinput" or "audiooutput".

Remarks

Label

The label read-only
property of the MediaDeviceInfo interface returns a
string describing this device (for example
"External USB Webcam").

[Value("label")]
public string Label { get; }

Property Value

string

A string which describes the media device. For security reasons, the
label is always an empty string ("") if the user has not
obtained permission to use at least one media device, either by starting a stream from
the microphone or camera, or by persistent permissions being granted.

Remarks

Only available during active MediaStream
use, or when persistent permissions have been granted.

See also on MDN

Methods

ToJSON()

The toJSON() method of the MediaDeviceInfo interface is a {{Glossary("Serialization","serializer")}}; it returns a JSON representation of the MediaDeviceInfo object.

[Value("toJSON")]
public Object ToJSON()

Returns

Object

A {{jsxref("JSON")}} object that is the serialization of the MediaDeviceInfo object.

Remarks