Skip to content

Commit

Permalink
Query for device's torchActive should be after device unlock
Browse files Browse the repository at this point in the history
  • Loading branch information
marqroldan committed Mar 12, 2021
1 parent c9f3b3d commit 01141f7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ios/RCTTWVideoModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,9 @@ - (bool)_setLocalVideoEnabled:(bool)enabled {
} else {
[device setTorchMode:AVCaptureTorchModeOff];
}
BOOL isFlashOn = device.torchActive;
[device unlockForConfiguration];
[body addEntriesFromDictionary:@{ @"isFlashOn" : [NSNumber numberWithBool:!isFlashOn] }];
BOOL isFlashOn = device.torchActive;
[body addEntriesFromDictionary:@{ @"isFlashOn" : [NSNumber numberWithBool:isFlashOn] }];
} else {
[body addEntriesFromDictionary:@{ @"error" : @"Flash is not supported in current camera mode" }];
}
Expand Down

0 comments on commit 01141f7

Please sign in to comment.