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
Edouard Marquez
2023-08-06 10:48:15 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ad2ade10fe02a6ab394b69f75527d28326ab5205
ad2ade10
1 parent
4a35134d
In the SurfacePreview, ensure the camera is not stopped
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletions
android/src/main/kotlin/dev/steenbakker/mobile_scanner/MobileScanner.kt
android/src/main/kotlin/dev/steenbakker/mobile_scanner/MobileScanner.kt
View file @
ad2ade1
...
...
@@ -208,6 +208,10 @@ class MobileScanner(
// Preview
val surfaceProvider = Preview.SurfaceProvider { request ->
if (isStopped()) {
return@SurfaceProvider
}
val texture = textureEntry!!.surfaceTexture()
texture.setDefaultBufferSize(
request.resolution.width,
...
...
@@ -270,7 +274,7 @@ class MobileScanner(
* Stop barcode scanning.
*/
fun stop() {
if (
camera == null && preview == null
) {
if (
isStopped()
) {
throw AlreadyStopped()
}
...
...
@@ -285,6 +289,8 @@ class MobileScanner(
cameraProvider = null
}
private fun isStopped() = camera == null && preview == null
/**
* Toggles the flash light on or off.
*/
...
...
Please
register
or
login
to post a comment