C
Qt Cluster: Rendering and Recovery from Main UI Failure
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
// This file is part of the Qt Safe Renderer module
import QtQuick
import QtMultimedia
import ClusterDemo
Item {
property alias imageSource: overlay.source
visible: true
/* TODO replace with image */
MediaPlayer {
id: video
autoPlay: false
muted: true
//source: "file:///data/user/qt/qtcluster/video/reversing_video.3gp"
// Switch to still image after reversing video is finished, or an error occurs
onError: {
stillView.visible = true
console.log("Error playing video: " + error + ": " + errorString)
}
onStatusChanged: {
if (status === MediaPlayer.EndOfMedia)
stillView.visible = true
}
}
VideoOutput {
id: videoOutput
source: video //camera
anchors.centerIn: parent
height: 480 - 180
width: 1280 / 2.1
fillMode: Image.Stretch
Image {
id: stillView
visible: false
anchors.centerIn: parent
source: "image://etc/RearCameraStill.jpg"
height: videoOutput.height
width: videoOutput.width
}
Image {
id: overlay
visible: ValueSource.gear === -1
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
}
}
onVisibleChanged: {
if (visible) {
stillView.visible = false
video.play()
} else {
video.stop()
}
}
}