- Qt 6.4
- Qt Multimedia
- QML Types
- MediaDevices
- Qt 6.4.2 Reference Documentation

# MediaDevices QML Type

MediaDevices provides information about available multimedia input and output devices. More...

Import Statement: | import QtMultimedia
Instantiates: | QMediaDevices

- List of all members, including inherited members

## Properties

- audioInputs : list<audioDevice>
- audioOutputs : list<audioDevice>
- defaultAudioInput : audioDevice
- defaultAudioOutput : audioDevice
- defaultVideoInput : cameraDevice
- videoInputs : list<cameraDevice>

## Detailed Description

The MediaDevices type provides information about the available multimedia devices and the system defaults. It monitors the following three groups:

- Audio input devices (Microphones)
- Audio output devices (Speakers, Headsets)
- Video input devices (Cameras)

MediaDevices provides a separate list for each device group. If it detects that a new device has been connected to the system or an attached device has been disconnected from the system, it will update the corresponding device list and emit a signal notifying about the change.

MediaDevices monitors the system defaults for each device group. It will notify about any changes done through the system settings. For example, if the user selects a new default audio output in the system settings, MediaDevices will update the default audio output accordingly and emit a signal. If the system does not provide a default for a camera or an audio input, MediaDevices will select the first device from the list as the default device.

While using the default input and output devices is often sufficient for playing back or recording multimedia, there is often a need to explicitly select the device to be used.

For example, the snippet below will ensure that the media player always uses the systems default audio output device for playback:

     MediaDevices {
         id: devices
     }
     MediaPlayer {
         ...
         audioOutput: AudioOutput {
             device: devices.defaultAudioOutput
         }
     }

See also Camera, AudioInput, and VideoOutput.

## Property Documentation

[read-only] audioInputs : list<audioDevice>

Contains a list of available audio input devices on the system.

Those devices are usually microphones. Devices can be either built-in, or connected through for example USB or Bluetooth.

[read-only] audioOutputs : list<audioDevice>

Contains a list of available audio output devices on the system.

Those devices are usually loudspeakers or head sets. Devices can be either built-in, or connected through for example USB or Bluetooth.

[read-only] defaultAudioInput : audioDevice

Returns the default audio input device.

The default device can change during the runtime of the application. The value of this property will automatically adjust itself to such changes.

[read-only] defaultAudioOutput : audioDevice

Returns the default audio output device.

The default device can change during the runtime of the application. The value of this property will automatically adjust itself to such changes.

[read-only] defaultVideoInput : cameraDevice

Returns the default camera on the system.

Note: The returned object should be checked using isNull() before being used, in case there is no camera available.

The default device can change during the runtime of the application. The value of this property will automatically adjust itself to such changes.

[read-only] videoInputs : list<cameraDevice>

Contains a list of cameras on the system.