catch and show exceptions thrown at starting recording

This commit is contained in:
tibbi 2018-06-18 21:22:19 +02:00
parent 7afa969505
commit 335529ccbb

View File

@ -33,6 +33,7 @@ import com.simplemobiletools.camera.helpers.*
import com.simplemobiletools.camera.interfaces.MyPreview
import com.simplemobiletools.camera.models.FocusArea
import com.simplemobiletools.camera.models.MySize
import com.simplemobiletools.commons.extensions.showErrorToast
import com.simplemobiletools.commons.helpers.isJellyBean1Plus
import java.io.File
import java.lang.IllegalArgumentException
@ -851,7 +852,12 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie
}
}
mCameraDevice!!.createCaptureSession(surfaces, captureCallback, mBackgroundHandler)
try {
mCameraDevice!!.createCaptureSession(surfaces, captureCallback, mBackgroundHandler)
} catch (e: Exception) {
mActivity.showErrorToast(e)
mCameraState = STATE_PREVIEW
}
}
private fun stopRecording() {