Как добавить логотип / водяной знак в Camera2 Api Custom Video Recording Application - PullRequest
1 голос
/ 22 января 2020

Как добавить логотип / водяной знак в приложении Camera2 Api Custom Video Recording. Я хочу добавить логотип / водяной знак в свое приложение камеры в верхнем левом углу

private fun recordSession() {

    setupMediaRecorder()

    val surfaceTexture = previewTextureView.surfaceTexture
    surfaceTexture.setDefaultBufferSize(MAX_WIDTH, MAX_HEIGHT)
    val textureSurface = Surface(surfaceTexture)
    val recordSurface = mediaRecorder.surface

    captureRequestBuilder = cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_RECORD)
    captureRequestBuilder.addTarget(textureSurface)
    captureRequestBuilder.addTarget(recordSurface)

    val surfaces = ArrayList<Surface>().apply {
        add(textureSurface)
        add(recordSurface)
    }

    cameraDevice.createCaptureSession(surfaces, object : CameraCaptureSession.StateCallback() {
        override fun onConfigureFailed(p0: CameraCaptureSession) {
            Log.d("Error", "Failed Session")
        }

        override fun onConfigured(session: CameraCaptureSession) {
            if (session != null) {
                captureSession = session
                captureRequestBuilder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE)
                captureSession.setRepeatingRequest(captureRequestBuilder.build(), null, null)
                isRecording = true
                mediaRecorder.start()
            }
        }

    }, backgroundHandler)
}
...