summaryrefslogtreecommitdiffstats
path: root/examples/multimedia/video/recorder
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2021-09-10 10:35:04 +0200
committerLars Knoll <lars.knoll@qt.io>2021-09-10 11:24:21 +0200
commitbe6eb6f0c7b0b0bfb036ed268069970c1c9f57dd (patch)
treeefd615b1ffd2a06643c3cc6167f041b88817ec65 /examples/multimedia/video/recorder
parent0de80f19158d849b83426aacfaca289264751586 (diff)
Lock the Window orientation while recording in the recorder example
And document the best practice in QMediaPlayer::record(). Pick-to: 6.2 6.2.0 Change-Id: I3f9c69e869d36e3267a2dd33fa86f0b290541227 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Diffstat (limited to 'examples/multimedia/video/recorder')
-rw-r--r--examples/multimedia/video/recorder/main.qml8
1 files changed, 6 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(); }