I've updated the code to the 2.6.1 build but have noticed that the camera will take 7-10 seconds to open and sometimes will not open at all. I'm testing on an iPhone 6s, iOS 11.2.5.
I'm having the same problem too. I'm testing on different iPhones, but mainly iPhone X.
@gdelarosa, @eddieespinal, @viktorgardart Yikes, I thought we had it in https://github.com/Yummypets/YPImagePicker/issues/25.
I have trouble reproducing it on my side (iPhone 6/X).
This looks like a threading issue, which explains the randomness & freeze.
I could surely use some help if you guys are willing to investigate :)
What helped me the first time was activating the Thread Sanitizer in Xcode.
Also what is your screens config ? mine is [.library, .photo, video]
Cheers,
Hi @s4cha , I enabled the thread sanitizer in Xcode. for my screens configuration I have,
public var screens: [YPPickerScreen] = [.library, .photo, .video] . Not sure if this matters but I am opening the camera (.photo) first and not the library.
Furthermore, I did take a look at issue #25 and tried using the different DispatchQueues but left it as DispatchQueue(label: "YPCameraVCSerialQueue", qos: .background) since that is how it is in the 2.6.1 build.
Hey @s4cha
I am experiencing this also, but only when open VIDEO.
config.screens = [.library, .photo, .video]
config.startOnScreen = .video
Any idea how to get this done ?
What I observed also is that delay may be because of hiding status bar: I mean I present picker, and its up, then it takes 5-7 seconds to hide status bar, after hide , camera can record.
And in this time, if I tap record, then it crashes.
Thanks a lot
Hey @s4cha
Any update on this ? any idea when we will see this fixed ?
Thanks a lot!
Hey @s4cha
I am using Using YPImagePicker (2.8.1) on my side, and I see the same issue like @nathankonrad1
Its happening only for config.startOnScreen = .video. Library and Photo are working very ok.
I am testing on iOS 11 + , on multiple devices and the same flow happening.
Any idea ?
Thanks in advance
@s4cha I just took a look into code for a while, and I think you should do the same qos: .background in YPVideoHelper class also.
//private let sessionQueue = DispatchQueue(label: "YPVideoVCSerialQueue")
private let sessionQueue = DispatchQueue(label: "YPVideoVCSerialQueue", qos: .background)
What do you think ?
@AndreiBoariu Thanks for the suggestion, I'm going to try that, It's very hard for me to debug since it's not happening every time :)
Still having the issue :/
Maybe we should use only one AVCaptureSession that would be shared among both photo and video. I think the issue lies in the fact that two session try to run in parallel, resulting in a race condition.
Going to try an alternative, will report back.
Same crash here, if remove .video the app doesn't crash. Works fine on simulator but append on device only (iPhone 7+)
Ok this is going to be very obscure! Get ready! 馃懟
I finally found a deterministic way to both trigger and solve the issue.
This is very esoteric though 馃憖
From my experience, it only happens with Video. And only if it is the first screen shown.
aka config.startOnScreen = .video
After much trial and error I have found that replacing tryToStartCamera in YPVideoVC by the following implementation does the trick.
public func tryToStartCamera() {
doAfterPermissionCheck { [weak self] in
if #available(iOS 10.0, *) {
Timer.scheduledTimer(withTimeInterval: 0.6, repeats: false) { _ in //0.6
self?.videoHelper.startCamera()
}
}
}
}
Essentially wrapping videoHelper.startCamera() with a Timer.
Weirdly enough (at leat on my device) a timer of 0.5 does NOT work --> camera takes 9s to load.
Using a timer of 0.6 though makes the camera preview load in 1.2s 馃帀
Obviously I'd love to understand why, but it looks like a step forward in this age long issue :)
If some of you could try it out and report that would be awesome !
Cheers,
Most helpful comment
Ok this is going to be very obscure! Get ready! 馃懟
I finally found a deterministic way to both trigger and solve the issue.
This is very esoteric though 馃憖
From my experience, it only happens with Video. And only if it is the first screen shown.
aka
config.startOnScreen = .videoAfter much trial and error I have found that replacing
tryToStartCamerainYPVideoVCby the following implementation does the trick.Essentially wrapping
videoHelper.startCamera()with a Timer.Weirdly enough (at leat on my device) a timer of 0.5 does NOT work --> camera takes 9s to load.
Using a timer of 0.6 though makes the camera preview load in 1.2s 馃帀
Obviously I'd love to understand why, but it looks like a step forward in this age long issue :)
If some of you could try it out and report that would be awesome !
Cheers,