diff options
author | Lars Knoll <lars.knoll@qt.io> | 2021-04-14 16:02:36 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2021-04-19 11:06:47 +0000 |
commit | 8d0cd064a0272b0d7a005738f0a08c5e3b8e7281 (patch) | |
tree | 441ab83b5f28bcdc4e09a8f7024d352064ccfd58 /examples/multimedia/video/qmlvideo/qml | |
parent | 45861b09e330d76b1663fa2f809dd1de0740699e (diff) |
Add error handling for QML Camera item
By adding some Q_PROPERTYs and a changed signal for errors.
And rename the QMediaPlayer::error() signal to errorOccurred().
This doesn't conflict with the error() getter and makes it
consistent with the Camera item.
Change-Id: I9d94d86df64066b5b6b2bfa9229d45b80b91b09f
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'examples/multimedia/video/qmlvideo/qml')
-rw-r--r-- | examples/multimedia/video/qmlvideo/qml/qmlvideo/CameraItem.qml | 12 | ||||
-rw-r--r-- | examples/multimedia/video/qmlvideo/qml/qmlvideo/VideoItem.qml | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/examples/multimedia/video/qmlvideo/qml/qmlvideo/CameraItem.qml b/examples/multimedia/video/qmlvideo/qml/qmlvideo/CameraItem.qml index 4bbe2f978..5e3fcf6bf 100644 --- a/examples/multimedia/video/qmlvideo/qml/qmlvideo/CameraItem.qml +++ b/examples/multimedia/video/qmlvideo/qml/qmlvideo/CameraItem.qml @@ -65,12 +65,12 @@ VideoOutput { camera: NCamera { id: camera -// onError: { -// if (Camera.NoError != error) { -// console.log("[qmlvideo] CameraItem.onError error " + error + " errorString " + errorString) -// root.fatalError() -// } -// } + onErrorOccurred: function(error, errorString) { + if (Camera.NoError !== error) { + console.log("[qmlvideo] CameraItem.onError error " + error + " errorString " + errorString) + root.fatalError() + } + } } videoOutput: root } diff --git a/examples/multimedia/video/qmlvideo/qml/qmlvideo/VideoItem.qml b/examples/multimedia/video/qmlvideo/qml/qmlvideo/VideoItem.qml index 759882b66..a7d4ef2f4 100644 --- a/examples/multimedia/video/qmlvideo/qml/qmlvideo/VideoItem.qml +++ b/examples/multimedia/video/qmlvideo/qml/qmlvideo/VideoItem.qml @@ -71,8 +71,8 @@ VideoOutput { id: mediaPlayer videoOutput: root; - onError: { - if (MediaPlayer.NoError != error) { + onErrorOccurred: function(error, errorString) { + if (MediaPlayer.NoError !== error) { console.log("[qmlvideo] VideoItem.onError error " + error + " errorString " + errorString) root.fatalError() } |