mirror of
https://github.com/Myzel394/Alibi.git
synced 2025-06-18 23:05:26 +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 {
|
||||
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()
|
||||
|
||||
cameraProvider.unbindAll()
|
||||
stopSelf()
|
||||
stopForeground(STOP_FOREGROUND_REMOVE)
|
||||
|
||||
}
|
||||
}, ContextCompat.getMainExecutor(this))
|
||||
}
|
||||
|
@ -1,9 +1,13 @@
|
||||
package app.myzel394.alibi.ui.screens
|
||||
|
||||
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.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.core.content.ContextCompat
|
||||
import app.myzel394.alibi.services.VideoService
|
||||
@ -12,10 +16,12 @@ import app.myzel394.alibi.services.VideoService
|
||||
fun POCVideo() {
|
||||
val context = LocalContext.current
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
val intent = Intent(context, VideoService::class.java)
|
||||
ContextCompat.startForegroundService(context, intent)
|
||||
Box(modifier = Modifier.fillMaxSize()) {
|
||||
Button(onClick = {
|
||||
val intent = Intent(context, VideoService::class.java)
|
||||
ContextCompat.startForegroundService(context, intent)
|
||||
}) {
|
||||
Text("Start")
|
||||
}
|
||||
}
|
||||
|
||||
Text(text = "POCVideo")
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user