-
- function startCamera() {
- if (error) {
- return;
- }
-
- if (!policy.acquire(currentPage.policyMode)) {
- console.log("Failed to acquire policy resources");
- return;
- }
-
- if (!camera.start()) {
- showError(qsTr("Failed to start camera. Please restart the application."));
- }
+ }
+
+ CameraResources {
+ id: policy
+ }
+
+ function startCamera() {
+ if (error) {
+ return
+ } else if ((currentPolicyMode == currentItem.policyMode) && camera.running) {
+ return
+ } else if (!policy.acquire(currentItem.policyMode)) {
+ console.log("Failed to acquire policy resources")
+ return
+ } else if (currentItem.policyMode == CameraResources.Player) {
+ currentPolicyMode = CameraResources.Player
+ camera.stop(true)
+ } else if (!camera.start()) {
+ showError(qsTr("Failed to start camera. Please restart the application."))
+ } else {
+ currentPolicyMode = currentItem.policyMode