Showing
1 changed file
with
7 additions
and
4 deletions
| @@ -213,18 +213,21 @@ public class MobileScanner: NSObject, AVCaptureVideoDataOutputSampleBufferDelega | @@ -213,18 +213,21 @@ public class MobileScanner: NSObject, AVCaptureVideoDataOutputSampleBufferDelega | ||
| 213 | 213 | ||
| 214 | backgroundQueue.async { | 214 | backgroundQueue.async { |
| 215 | self.captureSession.startRunning() | 215 | self.captureSession.startRunning() |
| 216 | - // Enable the torch if parameter is set and torch is available | ||
| 217 | - // torch should be set after 'startRunning' is called | 216 | + |
| 217 | + // Turn on the flashlight if requested, | ||
| 218 | + // but after the capture session started. | ||
| 218 | do { | 219 | do { |
| 219 | try self.toggleTorch(torch) | 220 | try self.toggleTorch(torch) |
| 220 | } catch { | 221 | } catch { |
| 221 | - print("Failed to set initial torch state.") | 222 | + // If the torch does not turn on, |
| 223 | + // continue with the capture session anyway. | ||
| 222 | } | 224 | } |
| 223 | 225 | ||
| 224 | do { | 226 | do { |
| 225 | try self.resetScale() | 227 | try self.resetScale() |
| 226 | } catch { | 228 | } catch { |
| 227 | - print("Failed to reset zoom scale") | 229 | + // If the zoom scale could not be reset, |
| 230 | + // continue with the capture session anyway. | ||
| 228 | } | 231 | } |
| 229 | 232 | ||
| 230 | if let device = self.device { | 233 | if let device = self.device { |
-
Please register or login to post a comment