File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
packages/camera/ios/Classes Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -424,6 +424,9 @@ - (instancetype)initWithRegistry:(NSObject<FlutterTextureRegistry> *)registry
424424
425425- (void )handleMethodCall : (FlutterMethodCall *)call result : (FlutterResult)result {
426426 if ([@" init" isEqualToString: call.method]) {
427+ if (_camera) {
428+ [_camera close ];
429+ }
427430 result (nil );
428431 } else if ([@" availableCameras" isEqualToString: call.method]) {
429432 AVCaptureDeviceDiscoverySession *discoverySession = [AVCaptureDeviceDiscoverySession
@@ -462,6 +465,9 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
462465 if (error) {
463466 result ([error flutterError ]);
464467 } else {
468+ if (_camera) {
469+ [_camera close ];
470+ }
465471 int64_t textureId = [_registry registerTexture: cam];
466472 _camera = cam;
467473 cam.onFrameAvailable = ^{
You can’t perform that action at this time.
0 commit comments