Class MediaDevice

java.lang.Object
com.oorian.html.js.mediadevices.MediaDevice

public class MediaDevice extends Object
Represents information about a media input or output device.
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • MediaDevice

      public MediaDevice(String deviceId, String groupId, String kind, String label)
      Constructs a MediaDevice.
      Parameters:
      deviceId - The unique identifier for the device.
      groupId - The group identifier (devices in the same group are on the same physical device).
      kind - The kind of device: "audioinput", "audiooutput", or "videoinput".
      label - The human-readable label for the device.
  • Method Details

    • getDeviceId

      public String getDeviceId()
      Returns the unique identifier for this device.
      Returns:
      The device ID.
    • getGroupId

      public String getGroupId()
      Returns the group identifier.

      Devices with the same group ID are on the same physical device (e.g., a webcam with built-in microphone).

      Returns:
      The group ID.
    • getKind

      public String getKind()
      Returns the kind of device.
      Returns:
      "audioinput" for microphones, "audiooutput" for speakers, "videoinput" for cameras.
    • getLabel

      public String getLabel()
      Returns the human-readable label for the device.

      Note: This may be empty if the user hasn't granted permission to access media devices.

      Returns:
      The device label.
    • isAudioInput

      public boolean isAudioInput()
      Returns whether this device is an audio input (microphone).
      Returns:
      True if this is a microphone.
    • isAudioOutput

      public boolean isAudioOutput()
      Returns whether this device is an audio output (speaker/headphones).
      Returns:
      True if this is an audio output device.
    • isVideoInput

      public boolean isVideoInput()
      Returns whether this device is a video input (camera).
      Returns:
      True if this is a camera.
    • toString

      public String toString()
      Overrides:
      toString in class Object