Skip to content

Instantly share code, notes, and snippets.

@ananthrajsingh
Last active May 24, 2020 06:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ananthrajsingh/55ef90f8acc6c803ac1dd67716f7ed71 to your computer and use it in GitHub Desktop.
Save ananthrajsingh/55ef90f8acc6c803ac1dd67716f7ed71 to your computer and use it in GitHub Desktop.
private val surfaceTextureListenerFront = object : TextureView.SurfaceTextureListener {
override fun onSurfaceTextureAvailable(texture: SurfaceTexture, width: Int, height: Int) {
openCameraFront(width, height)
}
override fun onSurfaceTextureSizeChanged(texture: SurfaceTexture, width: Int, height: Int) {
configureTransformFront(width, height)
}
override fun onSurfaceTextureDestroyed(texture: SurfaceTexture) = true
override fun onSurfaceTextureUpdated(texture: SurfaceTexture) = Unit
}
private val surfaceTextureListenerRear = object : TextureView.SurfaceTextureListener {
override fun onSurfaceTextureAvailable(texture: SurfaceTexture, width: Int, height: Int) {
openCameraRear(width, height)
}
override fun onSurfaceTextureSizeChanged(texture: SurfaceTexture, width: Int, height: Int) {
configureTransformRear(width, height)
}
override fun onSurfaceTextureDestroyed(texture: SurfaceTexture) = true
override fun onSurfaceTextureUpdated(texture: SurfaceTexture) = Unit
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment