ResearchKit / ResearchKit

ResearchKit is an open source software framework that makes it easy to create apps for medical research or for other research projects.
https://www.researchandcare.org
Other
5.6k stars 1.16k forks source link

ORKVideoCaptureStep unusual behaviour if we go to Previous question #1364

Open majeedyaseen opened 4 years ago

majeedyaseen commented 4 years ago

I have a set of questions for a survey and one of them is video type question, when I initiate the survey and reach to the video type question. It works fine and I am able to record the video however after completion, if I go back to the previous question and come back to video question. I can see a blank screen with title top and unresponsive Start Recording button. Here is a short video for the same Video Link

I have tested on several devices and I am getting the same behaviour.

Here is what I get in the debugger

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2020-04-01 19:36:10.118058+0530 Web To RK Development[3310:2416080] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<NSLayoutConstraint:0x2813d9b30 H:|-(3392)-[ORKTintedImageView:0x14fe9ddf0](LTR)   (active, names: '|':ORKVideoCaptureCameraPreviewView:0x14feadb30 )>",
    "<NSLayoutConstraint:0x2813d9a40 ORKTintedImageView:0x14fe9ddf0.right == ORKVideoCaptureCameraPreviewView:0x14feadb30.right - 3392   (active)>",
    "<NSLayoutConstraint:0x2813b1720 H:|-(0)-[ORKVideoCaptureView:0x14fec9ad0](LTR)   (active, names: '|':UIView:0x14fd7a370 )>",
    "<NSLayoutConstraint:0x2813b29e0 ORKVideoCaptureView:0x14fec9ad0.right == UIView:0x14fd7a370.right   (active)>",
    "<NSLayoutConstraint:0x2813bf4d0 H:|-(0)-[AVPlayerView:0x14fec8350](LTR)   (active, names: '|':ORKVideoCaptureView:0x14fec9ad0 )>",
    "<NSLayoutConstraint:0x2813bd400 AVPlayerView:0x14fec8350.right == ORKVideoCaptureView:0x14fec9ad0.right   (active)>",
    "<NSLayoutConstraint:0x2813be490 ORKVideoCaptureCameraPreviewView:0x14feadb30.left == AVPlayerView:0x14fec8350.left   (active)>",
    "<NSLayoutConstraint:0x2813be760 ORKVideoCaptureCameraPreviewView:0x14feadb30.right == AVPlayerView:0x14fec8350.right   (active)>",
    "<NSLayoutConstraint:0x2813ae620 'UIView-Encapsulated-Layout-Width' UIView:0x14fd7a370.width == 375   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x2813d9a40 ORKTintedImageView:0x14fe9ddf0.right == ORKVideoCaptureCameraPreviewView:0x14feadb30.right - 3392   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
ZaidSA commented 4 years ago

@akshay-yadav-apple & @srinathtm-apple any updates on this issue?

allenzhu2000 commented 4 years ago

Same issue here. Any updates on resolution?

majeedyaseen commented 4 years ago

What I did is I added an instruction step in between any media type questions and for now it’s working now

On Sun, 12 Jul 2020 at 10:51 AM, allenzhu2000 notifications@github.com wrote:

Same issue here. Any updates on resolution?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ResearchKit/ResearchKit/issues/1364#issuecomment-657176916, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHIMXSMITSKAQUDKDX2MO73R3FB4ZANCNFSM4LY7Q7YA .

-- Yaseen Majeed https://www.twitter.com/iamyaseenmajeed https://www.linkedin.com/in/iamyaseenmajeed iOS Engineer at Applied Informatics https://www.linkedin.com/in/iamyaseenmajeed [image: T:] 7006127760 [image: E:] majeed@trilax.com https://www.twitter.com/iamyaseenmajeed https://www.linkedin.com/in/yaseenmajeed

allenzhu2000 commented 4 years ago

Thanks for your quick response! I'm already adding an instruction before my video capture step, to no success unfortunately. Is this the solution you implemented? Video Link `

    let instructionStep2 = ORKInstructionStep(identifier: "IntroStep2")
    instructionStep2.title = "Choose a Medical Decision Maker"
    instructionStep2.text = "Choose a medical decision maker."

    steps += [instructionStep2]

    let medicalDecisionMakerVideoStep = ORKVideoCaptureStep(identifier: "medicalDecisionMakerVideoStep")
    medicalDecisionMakerVideoStep.title = "Choose a Medical Decision Maker"
    medicalDecisionMakerVideoStep.text = "If you want, you can record a video explaining why you chose this person."
    medicalDecisionMakerVideoStep.accessibilityInstructions = "If you want, you can record a video explaining why you chose this person."
    medicalDecisionMakerVideoStep.accessibilityHint = "If you want, you can record a video explaining why you chose this person."
    medicalDecisionMakerVideoStep.devicePosition = .front

    steps += [medicalDecisionMakerVideoStep]
majeedyaseen commented 3 years ago

Unfortunately it's still happening, did you found any way around for this ? @allenzhu2000

majeedyaseen commented 3 years ago

I found a fix for the this issue Once I test it out I will let you know the solution @allenzhu2000

majeedyaseen commented 3 years ago

@allenzhu2000 you can go to the ORKVIdeoCaptureStepViewController.m inside there

go inside the viewWillAppear method and then add the below else condition to the already added if statement which is

if(!_fileURL) { 
......
}

add the below code snippet after the if end brace

 else {
     _fileURL = NULL;
      dispatch_async(_sessionQueue, ^{
       [_captureSession startRunning];
      });
}

the already captured file will be overwritten by the new capture so don't worry about that :) Let me know if it helped