File tree Expand file tree Collapse file tree 2 files changed +20
-11
lines changed
liveness/src/main/java/com/amplifyframework/ui/liveness Expand file tree Collapse file tree 2 files changed +20
-11
lines changed Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ internal class LivenessCoordinator(
120120 onMuxedSegment = { bytes, time ->
121121 livenessState.livenessSessionInfo?.sendVideoEvent(VideoEvent (bytes, Date (time)))
122122 }
123- )!!
123+ ) ? : throw IllegalStateException ( " Failed to start the encoder. " )
124124
125125 private val renderer = OpenGLRenderer ()
126126 .apply {
Original file line number Diff line number Diff line change @@ -166,16 +166,25 @@ internal fun ChallengeView(
166166 val showPhotosensitivityAlert = remember { mutableStateOf(false ) }
167167
168168 DisposableEffect (key) {
169- coordinator = LivenessCoordinator (
170- context,
171- lifecycleOwner,
172- sessionId,
173- region,
174- credentialsProvider,
175- disableStartView,
176- onChallengeComplete = { currentOnChallengeComplete() },
177- onChallengeFailed = { currentOnChallengeFailed.accept(it) }
178- )
169+ try {
170+ coordinator = LivenessCoordinator (
171+ context,
172+ lifecycleOwner,
173+ sessionId,
174+ region,
175+ credentialsProvider,
176+ disableStartView,
177+ onChallengeComplete = { currentOnChallengeComplete() },
178+ onChallengeFailed = { currentOnChallengeFailed.accept(it) }
179+ )
180+ } catch (e: Exception ) {
181+ currentOnChallengeFailed.accept(
182+ FaceLivenessDetectionException (
183+ message = " Failed to initialize video components required for Liveness check." ,
184+ throwable = e
185+ )
186+ )
187+ }
179188
180189 onDispose {
181190 coordinator?.destroy(context)
You can’t perform that action at this time.
0 commit comments