summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/multimedia/video/recorder/main.qml8
-rw-r--r--src/multimedia/recording/qmediarecorder.cpp14
2 files changed, 20 insertions, 2 deletions
diff --git a/examples/multimedia/video/recorder/main.qml b/examples/multimedia/video/recorder/main.qml
index 6e32dfc80..c7e625f0e 100644
--- a/examples/multimedia/video/recorder/main.qml
+++ b/examples/multimedia/video/recorder/main.qml
@@ -89,10 +89,14 @@ Window {
id: recorder
onRecorderStateChanged:
(state) => {
- if (state === MediaRecorder.StoppedState)
+ if (state === MediaRecorder.StoppedState) {
+ root.contentOrientation = Qt.PrimaryOrientation
mediaList.append()
- else if (state === MediaRecorder.RecordingState && captureSession.camera)
+ } else if (state === MediaRecorder.RecordingState && captureSession.camera) {
+ // lock orientation while recording and create a preview image
+ root.contentOrientation = root.screen.orientation;
videoOutput.grabToImage(function(res) { mediaList.mediaThumbnail = res.url })
+ }
}
onActualLocationChanged: (url) => { mediaList.mediaUrl = url }
onErrorOccurred: { recorderErrorText.text = recorder.errorString; recorderError.open(); }
diff --git a/src/multimedia/recording/qmediarecorder.cpp b/src/multimedia/recording/qmediarecorder.cpp
index c90c88ba2..afa189c89 100644
--- a/src/multimedia/recording/qmediarecorder.cpp
+++ b/src/multimedia/recording/qmediarecorder.cpp
@@ -330,6 +330,13 @@ qint64 QMediaRecorder::duration() const
If recording fails, the error() signal is emitted with recorder state being
reset back to \c{QMediaRecorder.StoppedState}.
+
+ \note On mobile devices, recording will happen in the orientation the
+ device had when calling record and is locked for the duration of the recording.
+ To avoid artifacts on the user interface, we recommend to keep the user interface
+ locked to the same orientation as long as the recording is ongoing using
+ the contentOrientation property of the Window and unlock it again once the recording
+ is finished.
*/
/*!
Start recording.
@@ -339,6 +346,13 @@ qint64 QMediaRecorder::duration() const
If recording fails error() signal is emitted with recorder state being
reset back to \c{QMediaRecorder::StoppedState}.
+
+ \note On mobile devices, recording will happen in the orientation the
+ device had when calling record and is locked for the duration of the recording.
+ To avoid artifacts on the user interface, we recommend to keep the user interface
+ locked to the same orientation as long as the recording is ongoing using
+ the contentOrientation property of QWindow and unlock it again once the recording
+ is finished.
*/
void QMediaRecorder::record()