diff options
author | Lars Knoll <lars.knoll@qt.io> | 2021-09-10 10:35:04 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-09-10 12:14:52 +0000 |
commit | 3e8a6f6be2d4c07f5818811a4bfa6f8c2771360a (patch) | |
tree | 2b43e646cb46d68ccadb05aa5938a85db55e507d /examples | |
parent | dc09dc8b4dfef30d4432ac398ad3876eae4c83a4 (diff) |
Lock the Window orientation while recording in the recorder example
And document the best practice in QMediaPlayer::record().
Change-Id: I3f9c69e869d36e3267a2dd33fa86f0b290541227
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit be6eb6f0c7b0b0bfb036ed268069970c1c9f57dd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/multimedia/video/recorder/main.qml | 8 |
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(); } |