Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ggfan/e65e54320911fcd55443ef904dd05165 to your computer and use it in GitHub Desktop.
Save ggfan/e65e54320911fcd55443ef904dd05165 to your computer and use it in GitHub Desktop.
val recordingListener = Consumer<VideoRecordEvent> { event ->
when(event) {
is VideoRecordEvent.Start -> {
val msg = “Capture Started”
Toast.makeText(getActivity(), msg, Toast.LENGTH_SHORT)
.show()
// update app internal recording state
}
is VideoRecordEvent.Finalize -> {
val msg = if (!event.hasError()) {
// update app internal state
"Video capture succeeded: ${event.outputResults.outputUri}"
} else {
// update app state when the capture failed.
recording?.close()
recording = null
"Video capture ends with error: ${event.error}"
}
Toast.makeText(activity, msg, Toast.LENGTH_SHORT)
.show()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment