内容表

上一话题

QMediaPlaylist

下一话题

QMediaRecorderControl

QMediaRecorder

QMediaRecorder class is used for the recording of media content. 更多

Inheritance diagram of PySide2.QtMultimedia.QMediaRecorder

继承者: QAudioRecorder

概要

函数

信号

详细描述

QMediaRecorder class is a high level media recording class. It’s not intended to be used alone but for accessing the media recording functions of other media objects, like QRadioTuner ,或 QCamera .

recorder = new QMediaRecorder(camera);
QAudioEncoderSettings audioSettings;
audioSettings.setCodec("audio/amr");
audioSettings.setQuality(QMultimedia::HighQuality);
recorder->setAudioSettings(audioSettings);
recorder->setOutputLocation(QUrl::fromLocalFile(fileName));
recorder->record();
											

另请参阅

QAudioRecorder

class QMediaRecorder ( mediaObject [ , parent=None ] )
param parent

QObject

param mediaObject

QMediaObject

Constructs a media recorder which records the media produced by mediaObject .

parent 会被传递给 QMediaObject .

PySide2.QtMultimedia.QMediaRecorder. State

常量

描述

QMediaRecorder.StoppedState

The recorder is not active. If this is the state after recording then the actual created recording has finished being written to the final location and is ready on all platforms except on Android. On Android, due to platform limitations, there is no way to be certain that the recording has finished writing to the final location.

QMediaRecorder.RecordingState

The recording is requested.

QMediaRecorder.PausedState

The recorder is paused.

PySide2.QtMultimedia.QMediaRecorder. Status

常量

描述

QMediaRecorder.UnavailableStatus

The recorder is not available or not supported by connected media object.

QMediaRecorder.UnloadedStatus

The recorder is avilable but not loaded.

QMediaRecorder.LoadingStatus

The recorder is initializing.

QMediaRecorder.LoadedStatus

The recorder is initialized and ready to record media.

QMediaRecorder.StartingStatus

Recording is requested but not active yet.

QMediaRecorder.RecordingStatus

Recording is active.

QMediaRecorder.PausedStatus

Recording is paused.

QMediaRecorder.FinalizingStatus

Recording is stopped with media being finalized.

PySide2.QtMultimedia.QMediaRecorder. Error

常量

描述

QMediaRecorder.NoError

No Errors.

QMediaRecorder.ResourceError

Device is not ready or not available.

QMediaRecorder.FormatError

Current format is not supported.

QMediaRecorder.OutOfSpaceError

No space left on device.

PySide2.QtMultimedia.QMediaRecorder. actualLocation ( )
返回类型

QUrl

PySide2.QtMultimedia.QMediaRecorder. actualLocationChanged ( location )
参数

location QUrl

PySide2.QtMultimedia.QMediaRecorder. audioCodecDescription ( codecName )
参数

codecName – unicode

返回类型

unicode

Returns a description of an audio codec .

PySide2.QtMultimedia.QMediaRecorder. audioSettings ( )
返回类型

QAudioEncoderSettings

Returns the audio encoder settings being used.

PySide2.QtMultimedia.QMediaRecorder. availability ( )
返回类型

AvailabilityStatus

Returns the availability of this functionality.

PySide2.QtMultimedia.QMediaRecorder. availabilityChanged ( availability )
参数

availability AvailabilityStatus

PySide2.QtMultimedia.QMediaRecorder. availabilityChanged ( available )
参数

available bool

PySide2.QtMultimedia.QMediaRecorder. availableMetaData ( )
返回类型

字符串列表

返回元数据的可用键列表。

PySide2.QtMultimedia.QMediaRecorder. containerDescription ( format )
参数

format – unicode

返回类型

unicode

Returns a description of a container format .

PySide2.QtMultimedia.QMediaRecorder. containerFormat ( )
返回类型

unicode

Returns the selected container format.

PySide2.QtMultimedia.QMediaRecorder. duration ( )
返回类型

qint64

PySide2.QtMultimedia.QMediaRecorder. durationChanged ( duration )
参数

duration qint64

PySide2.QtMultimedia.QMediaRecorder. error ( )
返回类型

Error

返回当前错误状态。

另请参阅

errorString()

PySide2.QtMultimedia.QMediaRecorder. error ( error )
参数

error Error

PySide2.QtMultimedia.QMediaRecorder. errorString ( )
返回类型

unicode

Returns a string describing the current error state.

另请参阅

error()

PySide2.QtMultimedia.QMediaRecorder. isAvailable ( )
返回类型

bool

Returns true if media recorder service ready to use.

PySide2.QtMultimedia.QMediaRecorder. isMetaDataAvailable ( )
返回类型

bool

PySide2.QtMultimedia.QMediaRecorder. isMetaDataWritable ( )
返回类型

bool

PySide2.QtMultimedia.QMediaRecorder. isMuted ( )
返回类型

bool

PySide2.QtMultimedia.QMediaRecorder. metaData ( key )
参数

key – unicode

返回类型

object

返回的值关联元数据 key .

另请参阅

setMetaData()

PySide2.QtMultimedia.QMediaRecorder. metaDataAvailableChanged ( available )
参数

available bool

PySide2.QtMultimedia.QMediaRecorder. metaDataChanged ( )
PySide2.QtMultimedia.QMediaRecorder. metaDataChanged ( key , value )
参数
  • key – unicode

  • value – object

PySide2.QtMultimedia.QMediaRecorder. metaDataWritableChanged ( writable )
参数

writable bool

PySide2.QtMultimedia.QMediaRecorder. mutedChanged ( muted )
参数

muted bool

PySide2.QtMultimedia.QMediaRecorder. outputLocation ( )
返回类型

QUrl

PySide2.QtMultimedia.QMediaRecorder. pause ( )

Pause recording.

The recorder state is changed to PausedState .

Depending on platform recording pause may be not supported, in this case the recorder state stays unchanged.

PySide2.QtMultimedia.QMediaRecorder. record ( )

Start recording.

While the recorder state is changed immediately to RecordingState , recording may start asynchronously, with statusChanged ( RecordingStatus ) signal emitted when recording starts.

If recording fails error() signal is emitted with recorder state being reset back to StoppedState .

PySide2.QtMultimedia.QMediaRecorder. setAudioSettings ( audioSettings )
参数

audioSettings QAudioEncoderSettings

Sets the audio encoder settings .

If some parameters are not specified, or null settings are passed, the encoder will choose default encoding parameters, depending on media source properties.

It’s only possible to change settings when the encoder is in the QMediaEncoder::StoppedState state.

PySide2.QtMultimedia.QMediaRecorder. setContainerFormat ( container )
参数

container – unicode

Sets the media container 格式。

If the container format is not specified, the encoder will choose format, depending on media source properties and encoding settings selected.

It’s only possible to change settings when the encoder is in the QMediaEncoder::StoppedState state.

PySide2.QtMultimedia.QMediaRecorder. setEncodingSettings ( audioSettings [ , videoSettings=QVideoEncoderSettings() [ , containerMimeType="" ] ] )
参数

设置 audio and video encoder settings and container 格式。

If some parameters are not specified, or null settings are passed, the encoder will choose default encoding parameters, depending on media source properties.

It’s only possible to change settings when the encoder is in the QMediaEncoder::StoppedState state.

PySide2.QtMultimedia.QMediaRecorder. setMetaData ( key , value )
参数
  • key – unicode

  • value – object

设置 value for a meta-data key .

注意

To ensure that meta data is set corretly, it should be set before starting the recording. Once the recording is stopped, any meta data set will be attached to the next recording.

另请参阅

metaData()

PySide2.QtMultimedia.QMediaRecorder. setMuted ( muted )
参数

muted bool

另请参阅

isMuted()

PySide2.QtMultimedia.QMediaRecorder. setOutputLocation ( location )
参数

location QUrl

返回类型

bool

另请参阅

outputLocation()

PySide2.QtMultimedia.QMediaRecorder. setVideoSettings ( videoSettings )
参数

videoSettings QVideoEncoderSettings

Sets the video encoder settings .

If some parameters are not specified, or null settings are passed, the encoder will choose default encoding parameters, depending on media source properties.

It’s only possible to change settings when the encoder is in the QMediaEncoder::StoppedState state.

PySide2.QtMultimedia.QMediaRecorder. setVolume ( volume )
参数

volume qreal

另请参阅

volume()

PySide2.QtMultimedia.QMediaRecorder. state ( )
返回类型

State

Returns the current media recorder state.

另请参阅

State

PySide2.QtMultimedia.QMediaRecorder. stateChanged ( state )
参数

state State

PySide2.QtMultimedia.QMediaRecorder. status ( )
返回类型

Status

Returns the current media recorder status.

另请参阅

Status

PySide2.QtMultimedia.QMediaRecorder. statusChanged ( status )
参数

status Status

PySide2.QtMultimedia.QMediaRecorder. stop ( )

Stop recording.

The recorder state is changed to StoppedState .

PySide2.QtMultimedia.QMediaRecorder. supportedAudioCodecs ( )
返回类型

字符串列表

Returns a list of supported audio codecs.

PySide2.QtMultimedia.QMediaRecorder. supportedContainers ( )
返回类型

字符串列表

Returns a list of supported container formats.

PySide2.QtMultimedia.QMediaRecorder. supportedVideoCodecs ( )
返回类型

字符串列表

Returns a list of supported video codecs.

PySide2.QtMultimedia.QMediaRecorder. videoCodecDescription ( codecName )
参数

codecName – unicode

返回类型

unicode

Returns a description of a video codec .

PySide2.QtMultimedia.QMediaRecorder. videoSettings ( )
返回类型

QVideoEncoderSettings

Returns the video encoder settings being used.

PySide2.QtMultimedia.QMediaRecorder. volume ( )
返回类型

qreal

另请参阅

setVolume()

PySide2.QtMultimedia.QMediaRecorder. volumeChanged ( volume )
参数

volume qreal