I am using camera API to recorder video.
After pressing ‘recorder’ button, it calls
const video = await this.camera.recordAsync(options);
and then press ‘stop’ button, is calls
the video is successfully created.
But after ‘stopRecording()’ is called, the screen is dark, then I press ‘recorder’ button again, the app return exception saying ’ Camera is not running’
Please help me.
Could you share a Snack link of your code so I can troubleshoot more effectively?
Thanks for replying. I couldn’t make it work on snack, it always complains
Invariant Violation: Text strings must be rendered with a Component
can you please get code from
and run ‘npm start’, on the screen click the only item.
Seems like your
isRecording value might be off. In line 73 of videoRecorder.js, you call
recordAsync(), but then set
I’d go through and ensure that value is what you’re expecting it to be, especially after multiple button presses.
According to the document, recordAsync() returns when the user stops recording or recording time is up. So code after ‘recordAsync()’ all happen after recording is stopped. So I don’t think setting isRecording be falsy is wrong.
@charliecruzan , do you have any comments on my last reply?
You’re correct, that was my misunderstanding. Sorry about that.
I’m working on an example snack that should give you a good example to follow to get the
recordAsync() function to run properly, after already having called it once.
Here is a snack example using
recordAsync(), recording a new video after already having recorded one before works here. From here it should be easy to spot differences in your code, and why you’re getting the ‘Camera is not running’ error message.
Let me know if you have any more questions
Thanks for these!
When I click the ‘START RECORDING’ button, I saw black screen, and nothing happens. My phone is in a different network with expo.io. Not sure if this is the reason.
I am using Andorid version 9. Device is Android one MI A1.
I will try if in the same network later.
Thank you again
I tested in the same network (phone and computer), after I click ‘START recording’, I saw black screen, and the app screen was freezing.
@wang, I am looking into this now. Works on my iPhone, but since camera cannot be accessed through the simulator, it’s hard for me to test why Android isn’t functioning properly.
Will get back to you soon!
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.