mirror of
https://github.com/Myzel394/Alibi.git
synced 2025-06-19 07:15:25 +02:00
debug: Add PoC for recurring video
This commit is contained in:
parent
63198c316e
commit
0de720ccf4
@ -101,10 +101,25 @@ class VideoService : LifecycleService() {
|
|||||||
scope.launch {
|
scope.launch {
|
||||||
delay(15000)
|
delay(15000)
|
||||||
|
|
||||||
|
result.stop()
|
||||||
|
// Unbind use cases before rebinding
|
||||||
|
cameraProvider?.unbindAll()
|
||||||
|
// Bind use cases to camera
|
||||||
|
cameraProvider?.bindToLifecycle(this@VideoService, cameraSelector, videoCapture)
|
||||||
|
|
||||||
|
delay(5000)
|
||||||
|
|
||||||
|
val recording = videoCapture.output.prepareRecording(this@VideoService, options)
|
||||||
|
.withAudioEnabled()
|
||||||
|
val result = recording.start(ContextCompat.getMainExecutor(this@VideoService), {})
|
||||||
|
|
||||||
|
delay(15000)
|
||||||
|
|
||||||
result.stop()
|
result.stop()
|
||||||
|
|
||||||
cameraProvider.unbindAll()
|
|
||||||
stopSelf()
|
stopSelf()
|
||||||
|
stopForeground(STOP_FOREGROUND_REMOVE)
|
||||||
|
|
||||||
}
|
}
|
||||||
}, ContextCompat.getMainExecutor(this))
|
}, ContextCompat.getMainExecutor(this))
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
package app.myzel394.alibi.ui.screens
|
package app.myzel394.alibi.ui.screens
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
import androidx.compose.material3.Button
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import app.myzel394.alibi.services.VideoService
|
import app.myzel394.alibi.services.VideoService
|
||||||
@ -12,10 +16,12 @@ import app.myzel394.alibi.services.VideoService
|
|||||||
fun POCVideo() {
|
fun POCVideo() {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
|
||||||
LaunchedEffect(Unit) {
|
Box(modifier = Modifier.fillMaxSize()) {
|
||||||
|
Button(onClick = {
|
||||||
val intent = Intent(context, VideoService::class.java)
|
val intent = Intent(context, VideoService::class.java)
|
||||||
ContextCompat.startForegroundService(context, intent)
|
ContextCompat.startForegroundService(context, intent)
|
||||||
|
}) {
|
||||||
|
Text("Start")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Text(text = "POCVideo")
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user