MediaDevices provides information about available multimedia input and output devices. 更多...
导入语句: | import QtMultimedia |
实例化: | QMediaDevices |
The MediaDevices type provides information about the available multimedia devices and the system defaults. It monitors the following three groups:
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 } }
另请参阅 Camera , AudioInput ,和 VideoOutput .
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.
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.
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.
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.
defaultVideoInput : cameraDevice |
Returns the default camera on the system.
注意: 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.
videoInputs : list < cameraDevice > |
Contains a list of cameras on the system.