oakleychen0707 / flutter_camera_60fps_ios

Creating a video recording application with Flutter camera package that allows setting resolution and frame rates of 60fps and 120fps.
3 stars 0 forks source link

Issue with ios code #1

Closed kaciula closed 1 week ago

kaciula commented 5 months ago

Hi. Thank you for sharing the code to set the resolution and frame rate.

However, I've encountered an issue:

If I keep opening and closing the camera screen, after a few times, the app crashes with the following error:

[AVCaptureDevice setActiveVideoMinFrameDuration:] Unsupported frame duration - Supported ranges: ( "<AVFrameRateRange: 0x282eb8f40 1 - 30>" ), tried to set maxFrameRate to 60.000000

But the iphone does support 60fps. It works correctly when I don't keep opening and closing the camera.

Is there a way to improve the code to not crash in this situation?

oakleychen0707 commented 5 months ago

Sorry! I'm not quite following your question. Are you saying that sometimes the app crashes after repeatedly pressing record and stop recording?

I've tried recording 13 times, and I haven't encountered the situation you mentioned. Does it require more attempts to happen?

kaciula commented 5 months ago

It's not about recording, but about initialization of the camera and the frame rate. It happens if you quickly go back from the camera screen and return and go back again and return. Your example has only one screen so you cannot reproduce it this way.

oakleychen0707 commented 5 months ago

I see! So now you have two pages switching between each other? And one of them is the recording screen?

kaciula commented 5 months ago

Yes. But I don't even start the recording. I just switch back and forth between the pages.

If I comment out the setActiveVideoMinFrameDuration line, it does not crash no matter what I do. But then I don't have any guarantee that the actual frame rate is set to 60 fps.

oakleychen0707 commented 5 months ago

OK! I'll try to see what you mentioned in a few days.

VijayVignesh1 commented 5 months ago

Hi, Even I am facing this issue every time I use 4k/60fps. I am using an iPhone 14 pro max which supports it.

oakleychen0707 commented 5 months ago

@kaciula Hi , I uploaded a new file "second_page.dart". I tried creating two pages, but I didn't encounter the issue you mentioned.

oakleychen0707 commented 5 months ago

@VijayVignesh1 Hi, I also tested it using the iPhone 14 Pro Max at 4K/60fps and didn't encounter any issues.

kaciula commented 5 months ago

@kaciula Hi , I uploaded a new file "second_page.dart". I tried creating two pages, but I didn't encounter the issue you mentioned.

@oakleychen0707 You need to add await setCameraConfiguration(720); after initializing the camera in second_page.dart. I made it crash this way. Go back and forth between main and second page and it crashes.

Screenshot 2023-12-05 at 12 31 45

oakleychen0707 commented 1 month ago

@kaciula Hi , I uploaded a new file "second_page.dart". I tried creating two pages, but I didn't encounter the issue you mentioned.

@oakleychen0707 You need to add await setCameraConfiguration(720); after initializing the camera in second_page.dart. I made it crash this way. Go back and forth between main and second page and it crashes.

Screenshot 2023-12-05 at 12 31 45

@kaciula Hi, I tried adding the await setCameraConfiguration(720); you described, and no problems occurred.