From cc9c08001242838c6988613243b32b76b408bd46 Mon Sep 17 00:00:00 2001 From: "Urko." Date: Wed, 31 Jan 2024 07:40:49 +0100 Subject: [PATCH] =?UTF-8?q?record=20=C3=A7audio=20on=20video=20recording?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/urkob/wittrail_android/RecordingService.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/urkob/wittrail_android/RecordingService.kt b/app/src/main/java/com/urkob/wittrail_android/RecordingService.kt index 80617f2..948c50c 100644 --- a/app/src/main/java/com/urkob/wittrail_android/RecordingService.kt +++ b/app/src/main/java/com/urkob/wittrail_android/RecordingService.kt @@ -1,5 +1,6 @@ package com.urkob.wittrail_android +import android.annotation.SuppressLint import android.app.Notification import android.app.NotificationChannel import android.app.NotificationManager @@ -93,7 +94,6 @@ class RecordingService : LifecycleService() { } } - private fun createNotification(): Notification { val notificationIntent = Intent(this, MainActivity::class.java) val pendingIntent = PendingIntent.getActivity( @@ -157,6 +157,7 @@ class RecordingService : LifecycleService() { } // Implements VideoCapture use case, including start and stop capturing. + @SuppressLint("MissingPermission") private fun captureVideo() { if (!isCameraInitialized) { Log.e(tag, "Camera not initialized yet.") @@ -199,6 +200,9 @@ class RecordingService : LifecycleService() { Log.e(tag, "mediaStoreOutputOptions") recording = videoCapture.output .prepareRecording(this, mediaStoreOutputOptions) + .apply { + withAudioEnabled() + } .start(ContextCompat.getMainExecutor(this)) { recordEvent -> when(recordEvent) { is VideoRecordEvent.Start -> {