swift3 - How to enable Stabilization and HDR in IOS Camera? -


what did:-

i have tried enable stabilization , hdr it's not working.i think in right path.when trying check current device supports stabilization , hdr in both case had got false case in devices.

please guide me if mistakes had done in below code snippet.

thanks in advance!!

my code snippet:-

func createavsession() throws -> avcapturesession {         applog.logfunction(object: log_start)          // start out low quality         let session = avcapturesession()         session.sessionpreset = avcapturesessionpresetphoto          // input video camera         let device = avcapturedevice.defaultdevice(withmediatype: avmediatypevideo)         let currentformat = device?.activeformat.isvideohdrsupported         try device?.lockforconfiguration()         if device?.activeformat.isvideohdrsupported == true {             device?.automaticallyadjustsvideohdrenabled = false             device?.isvideohdrenabled = true             print("device?.isvideohdrenabled\(device?.isvideohdrenabled)")         }          if (device?.isfocusmodesupported(.continuousautofocus))! {             device?.focusmode = avcapturefocusmode.continuousautofocus             print("device?.focusmode\(device?.focusmode.rawvalue)")         }         if (device?.issmoothautofocussupported)! {             device?.issmoothautofocusenabled = true             print("device?.issmoothautofocusenabled\(device?.issmoothautofocusenabled)")         }          if (device?.isexposuremodesupported(.continuousautoexposure))! {             device?.exposuremode = .continuousautoexposure             print("device?.exposuremode\(device?.exposuremode.rawvalue)")         }         device?.unlockforconfiguration()          let input = try avcapturedeviceinput(device: device)         {             try input.device.lockforconfiguration()             input.device.activevideomaxframeduration =  cmtimemake(1, 30)             input.device.activevideominframeduration =  cmtimemake(1, 30)             input.device.unlockforconfiguration()         }         catch {             print("failed set fps")         }          // output         let videooutput = avcapturevideodataoutput()          videooutput.videosettings = [ kcvpixelbufferpixelformattypekey anyhashable: kcvpixelformattype_32bgra]         videooutput.alwaysdiscardslatevideoframes = true         videooutput.setsamplebufferdelegate(self, queue: sessionqueue)          let stillimageoutput: avcapturestillimageoutput = avcapturestillimageoutput()         stillimageoutput.outputsettings = [avvideocodeckey: avvideocodecjpeg]          //stillimageoutput.ishighresolutionstillimageoutputenabled = true          if stillimageoutput.isstillimagestabilizationsupported {             stillimageoutput.automaticallyenablesstillimagestabilizationwhenavailable = true             print("stillimageoutput.isstillimagestabilizationactive\(stillimageoutput.isstillimagestabilizationactive)")         }          // join         session.addinput(input)         session.addoutput(videooutput)        if session.canaddoutput(stillimageoutput) {             session.addoutput(stillimageoutput)           self.stillimageoutput = stillimageoutput        }            if let connection = videooutput.connection(withmediatype: avmediatypevideo) {             if connection.isvideoorientationsupported {                 connection.videoorientation = .portrait             }             if connection.isvideostabilizationsupported {                 connection.preferredvideostabilizationmode = .standard                 print("connection.activevideostabilizationmode\(connection.activevideostabilizationmode.rawvalue)")             }         }           applog.logfunction(object: log_end)         return session     } 


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -