summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2021-09-21 09:49:34 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-09-22 04:06:31 +0000
commitfdf5f8717a735efc4d196c7e8e1b4cc6d89eed54 (patch)
tree85f147f6f41b479cb2997f62366408958eb9cc37
parent0df6cc0151a6c6dc564b2cee2bcf34182baa5243 (diff)
Some fixes to the sample code in the MediaRecorder docs
Add some more explanations and remove the unrelated ImageCapture element. Change-Id: I72434f92d24f49a9e307a7f310962f96e3335145 Reviewed-by: Piotr Srebrny <piotr.srebrny@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 706e6904b44add6c3fa104cdfd93e5f2a3082579) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/multimedia/recording/qmediarecorder.cpp31
1 files changed, 13 insertions, 18 deletions
diff --git a/src/multimedia/recording/qmediarecorder.cpp b/src/multimedia/recording/qmediarecorder.cpp
index 8bf587afe..2115a9e28 100644
--- a/src/multimedia/recording/qmediarecorder.cpp
+++ b/src/multimedia/recording/qmediarecorder.cpp
@@ -82,48 +82,43 @@ QT_BEGIN_NAMESPACE
\ingroup multimedia_audio_qml
\ingroup multimedia_video_qml
+ The MediaRecorder element can be used within a CaptureSession to record and encode audio and
+ video captured from a microphone and camera
+
\since 6.2
- The code below shows how this qml is instantiated.
+ The code below shows a simple capture session containing a MediaRecorder using the default
+ camera and default audio input.
+
\qml
CaptureSession {
id: captureSession
camera: Camera {
id: camera
}
- imageCapture: ImageCapture {
- id: imageCapture
- }
-
+ audioInput: AudioInput {}
recorder: MediaRecorder {
id: recorder
}
}
\endqml
- The code below shows how some properties are used.
+ The code below shows how the recording can be started and stopped.
\qml
CameraButton {
text: "Record"
- visible: captureSession.recorder.status !== MediaRecorder.RecordingStatus
- onClicked: captureSession.recorder.record()
+ visible: recorder.status !== MediaRecorder.RecordingStatus
+ onClicked: recorder.record()
}
CameraButton {
id: stopButton
text: "Stop"
- visible: captureSession.recorder.status === MediaRecorder.RecordingStatus
- onClicked: captureSession.recorder.stop()
- }
-
- CameraButton {
- text: "View"
- onClicked: captureControls.previewSelected()
- //don't show View button during recording
- visible: captureSession.recorder.actualLocation && !stopButton.visible
+ visible: recorder.status === MediaRecorder.RecordingStatus
+ onClicked: recorder.stop()
}
\endqml
- \sa CaptureSession
+ \sa CaptureSession, Camera, AudioInput, ImageCapture
*/
QMediaRecorderPrivate::QMediaRecorderPrivate()
{