detect disconnect webcam



  • hi
    how to detect disconnect webcam?
    i use many event for detect change state of webcam but does not work.
    and after disconnect camera i does not see any log.
    please guide me
    thanks

    Camera {
                                    id: camera
                                    captureMode: Camera.CaptureStillImage
    
    
                                    onErrorChanged: {
                                        console.log("neda");
                                    }
    
                                    onError: {
                                        console.log("neda");
                                    }
    
                                    onCameraStateChanged: {
                                        console.log("Camera State = " + camera.cameraState);
                                        if (camera.cameraState === Camera.LoadedState) {
    onsole.log("neda");
                                        }
    
                                        if (camera.cameraState === Camera.ActiveState) {
    onsole.log("neda");
                                        }
                                    }
    
                                    videoRecorder {
                                        id:vr
                                        
                                    }
                               onAvailabilityChanged: {
                                        console.log("Availability: ")
                                        if (availability == camera.ResourceMissing) {
                                            console.debug("neda: " + status);
                                        }
    
                                    }
    
                                    onCameraStatusChanged: {
                                        console.debug("Camera status changed: " + cameraState);
    
                                        if (cameraStatus == camera.UnavailableStatus) {
                                            console.debug("neda: " + status);
                                        }
    
                                        if (cameraStatus == Camera.ActiveStatus) {
    
                                            var fr = camera.supportedViewfinderFrameRateRanges();
                                            fpsList.model = fr;
    
                                            var res = camera.supportedViewfinderResolutions(15);
                                            resolutionList.model = res;
                                        }
                                    }                                
    
    
                                    flash.mode: Camera.FlashRedEyeReduction
                                    imageCapture {
                                        onImageCaptured: {
                                            photoPreview.source = preview
                                            stillControls.previewAvailable = true
                                            cameraUI.state = "PhotoPreview"
                                        }
                                    }
    
    
    
                                }
    
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.