Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Application crashes on start recording #1026

Closed
3 of 4 tasks
umar4911 opened this issue Apr 29, 2022 · 3 comments · Fixed by #1466
Closed
3 of 4 tasks

🐛 Application crashes on start recording #1026

umar4911 opened this issue Apr 29, 2022 · 3 comments · Fixed by #1466
Labels
🐛 bug Something isn't working

Comments

@umar4911
Copy link

umar4911 commented Apr 29, 2022

What were you trying to do?

I simply want to record a video nothing else but the application crashes whenever I trigger the start recording function

Reproduceable Code

/* Camera with Capture button Component */
 <Camera
          ref={CameraRef}
          style={StyleSheet.absoluteFill}
          device={device}
          isActive={isActive}
          preset="medium"
          video={true}
          audio={true}
          orientation="portrait"
          torch={supportsFlash ? flash : "off"}
          enableZoomGesture={true}
          onInitialized={() => setIsCameraInitialized(true)}
        />
<CaptureButton style={styles.captureButton} camera={CameraRef} />






/* Capture Button code */

const CaptureButton = (props) => {
  const { style, camera } = props;

  return (
    <>
      <TouchableOpacity
        style={[
          style,
          {
            width: BTN_SIZE,
            height: BTN_SIZE,
            zIndex: 4,
            alignItems: "center",
            justifyContent: "center",
            backgroundColor: "pink",
          },
        ]}
        onPress={() => {
          camera.current.startRecording({
            onRecordingFinished: (video) => console.log(video),
            onRecordingError: (error) => console.error(error),
          });
          setTimeout(() => {
            camera.current.stopRecording();
          }, 5000);
        }}
      />
    </>
  );

What happened instead?

I made this small code for debugging and testing the video component. After the camera component renders, I press that capture button to run that startrecording function and my application crashes without any error in the console

Relevant log output

No response

Device

Android

VisionCamera Version

2.13.2

Additional information

@umar4911 umar4911 added the 🐛 bug Something isn't working label Apr 29, 2022
@joshualongbrake
Copy link

joshualongbrake commented May 17, 2022

Experiencing this as well from a new build. No stack trace on the javascript side.

Java side:

2022-05-17 10:21:47.924 26216-29757/com.XXXXXX.XXXXXXX E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-1
    Process: com.XXXXXX.XXXXXXX, PID: 26216
    com.mrousavy.camera.ViewNotFoundError: [system/view-not-found] The given view (ID 2199) was not found in the view manager.
        at com.mrousavy.camera.CameraViewModule.findCameraView(CameraViewModule.kt:78)
        at com.mrousavy.camera.CameraViewModule.access$findCameraView(CameraViewModule.kt:27)
        at com.mrousavy.camera.CameraViewModule$startRecording$1.invokeSuspend(CameraViewModule.kt:105)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

On further investigation this is related to the modal issue, however, I am using react-native-actions-sheet which could very well use a modal under the covers... Pulling the camera out of this component solves the crash...

@ThinhNguyen2002
Copy link

I have the same issue. @mrousavy please help.

@mrousavy
Copy link
Owner

Hey! I've rewritten the entire Android codebase of VisionCamera from CameraX to Camera2 in the efforts of ✨ VisionCamera V3.

I just now completed the Camera2 rewrite and I believe the core structure is running, but there might be some edge cases to iron out. Can you try and test the PR #1674 for me to see if you can still reproduce this issue here?

Here's an instruction on how you can test that: #1674 (comment)

If the issue cannot be reproduced with that version/PR anymore, then hoorayy, I fixed it! 🎉
Otherwise please let me know and I'll keep this issue open to keep track of it.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants