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
M. Yoga Nugraha
2022-02-24 15:14:27 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9a85b32b3cf61f22cb2309fa932f089b687e10be
9a85b32b
1 parent
717621a7
call unbind.all() before create the preview
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
6 deletions
android/src/main/kotlin/dev/steenbakker/mobile_scanner/MobileScanner.kt
android/src/main/kotlin/dev/steenbakker/mobile_scanner/MobileScanner.kt
View file @
9a85b32
...
...
@@ -113,7 +113,6 @@ class MobileScanner(private val activity: Activity, private val textureRegistry:
private var scanner = BarcodeScanning.getClient()
private lateinit var imageCapture: ImageCapture
@ExperimentalGetImage
private fun start(call: MethodCall, result: MethodChannel.Result) {
...
...
@@ -137,6 +136,7 @@ class MobileScanner(private val activity: Activity, private val textureRegistry:
future.addListener({
cameraProvider = future.get()
cameraProvider!!.unbindAll()
textureEntry = textureRegistry.createSurfaceTexture()
// Preview
...
...
@@ -162,14 +162,10 @@ class MobileScanner(private val activity: Activity, private val textureRegistry:
}
val analysis = analysisBuilder.build().apply { setAnalyzer(executor, analyzer) }
imageCapture = ImageCapture.Builder()
.setCaptureMode(ImageCapture.CAPTURE_MODE_MINIMIZE_LATENCY)
.build()
// Select the correct camera
val selector = if (facing == 0) CameraSelector.DEFAULT_FRONT_CAMERA else CameraSelector.DEFAULT_BACK_CAMERA
camera = cameraProvider!!.bindToLifecycle(activity as LifecycleOwner, selector, preview,
imageCapture
)
camera = cameraProvider!!.bindToLifecycle(activity as LifecycleOwner, selector, preview,
analysis
)
val analysisSize = analysis.resolutionInfo?.resolution ?: Size(0, 0)
val previewSize = preview.resolutionInfo?.resolution ?: Size(0, 0)
...
...
Please
register
or
login
to post a comment