Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
mobile_scanner
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Navaron Bracke
2023-11-29 19:34:01 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e634239fc5e472ff1be609bcf0fc462f8862916e
e634239f
1 parent
07daf490
check if torch mode is supported on iOS
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
ios/Classes/MobileScanner.swift
ios/Classes/MobileScanner.swift
View file @
e634239
...
...
@@ -286,12 +286,18 @@ public class MobileScanner: NSObject, AVCaptureVideoDataOutputSampleBufferDelega
device
=
nil
}
/// Toggle the flashlight between on and off.
/// Set the torch mode.
///
/// This method should be called on the main DispatchQueue.
func
toggleTorch
(
_
torch
:
AVCaptureDevice
.
TorchMode
)
throws
{
if
(
device
==
nil
||
!
device
.
hasTorch
||
!
device
.
isTorchAvailable
)
{
guard
let
device
=
self
.
device
else
{
return
}
if
(
!
device
.
hasTorch
||
!
device
.
isTorchAvailable
||
!
device
.
isTorchModeSupported
(
torch
))
{
return
}
if
(
device
.
torchMode
!=
torch
)
{
try
device
.
lockForConfiguration
()
device
.
torchMode
=
torch
...
...
Please
register
or
login
to post a comment