Move stream start and stop into the title bar
This commit is contained in:
1 parent
07cd150b47
commit
cecbc682a0
1 file changed
+36
-36
@@ -164,45 +164,45 @@ private fun StreamPublishScreen(group: Long, channelName: String, onBack: () ->
|
||||
}
|
||||
}, navigationIcon = {
|
||||
IconButton(onClick = onBack) { Icon(Icons.AutoMirrored.Filled.ArrowBack, stringResource(R.string.back)) }
|
||||
}, actions = {
|
||||
val action = if (ongoing == null) R.string.stream_start
|
||||
else if (ongoing.phase == StreamPhase.STOPPING) R.string.stream_stopping else R.string.stream_stop
|
||||
CaptureControlButton(stringResource(action),
|
||||
enabled = if (ongoing != null) ongoing.phase != StreamPhase.STOPPING
|
||||
else !loadingModes && config != null && group != 0L && state?.ongoing != true,
|
||||
containerColor = if (ongoing != null) Color(0xFFB32632) else Color(0xFF24633D), onClick = {
|
||||
if (ongoing != null) {
|
||||
LogManager.addLog("INFO", "stream", "screen stop group=$group id=${ongoing.id} phase=${ongoing.phase}")
|
||||
StreamController.stop()
|
||||
} else if (!cameraGranted || (audio && !micGranted)) {
|
||||
LogManager.addLog("INFO", "stream", "screen permissions group=$group camera=$cameraGranted mic=$micGranted audio=$audio")
|
||||
permissions.launch(listOf(Manifest.permission.CAMERA)
|
||||
.plus(if (audio) listOf(Manifest.permission.RECORD_AUDIO) else emptyList()).toTypedArray())
|
||||
} else config?.let {
|
||||
LogManager.addLog("INFO", "stream", "screen start group=$group audio=$audio config=$it")
|
||||
StreamController.start(group, it, audio)
|
||||
}
|
||||
}) {
|
||||
Icon(if (ongoing != null) Icons.Filled.Stop else Icons.Filled.PlayArrow,
|
||||
contentDescription = null, modifier = Modifier.size(32.dp))
|
||||
}
|
||||
Spacer(Modifier.width(4.dp))
|
||||
})
|
||||
}) { padding ->
|
||||
Column(Modifier.fillMaxSize().padding(padding).padding(12.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp), verticalAlignment = Alignment.CenterVertically) {
|
||||
StreamCaptureToolbar(cameras, shownConfig, displayDegrees, Modifier.weight(1f),
|
||||
enabled = if (ongoing != null) ongoing.phase == StreamPhase.LIVE && ongoing.pendingConfig == null else !loadingModes,
|
||||
audio = shownAudio,
|
||||
audioEnabled = if (ongoing != null) ongoing.phase == StreamPhase.LIVE && ongoing.audioAvailable else !loadingModes,
|
||||
onAudioChange = {
|
||||
LogManager.addLog("INFO", "stream", "screen audio group=$group enabled=$it live=${ongoing != null}")
|
||||
if (ongoing != null) StreamController.setAudioEnabled(it)
|
||||
else { audio = it; StreamController.rememberSettings(audio = it) }
|
||||
}, onChange = {
|
||||
LogManager.addLog("INFO", "stream", "screen capture selection group=$group live=${ongoing != null} config=$it")
|
||||
if (ongoing != null) StreamController.change(it)
|
||||
else { config = it; StreamController.rememberSettings(config = it) }
|
||||
})
|
||||
val action = if (ongoing == null) R.string.stream_start
|
||||
else if (ongoing.phase == StreamPhase.STOPPING) R.string.stream_stopping else R.string.stream_stop
|
||||
CaptureControlButton(stringResource(action),
|
||||
enabled = if (ongoing != null) ongoing.phase != StreamPhase.STOPPING
|
||||
else !loadingModes && config != null && group != 0L && state?.ongoing != true,
|
||||
containerColor = if (ongoing != null) Color(0xFFB32632) else Color(0xFF24633D), onClick = {
|
||||
if (ongoing != null) {
|
||||
LogManager.addLog("INFO", "stream", "screen stop group=$group id=${ongoing.id} phase=${ongoing.phase}")
|
||||
StreamController.stop()
|
||||
} else if (!cameraGranted || (audio && !micGranted)) {
|
||||
LogManager.addLog("INFO", "stream", "screen permissions group=$group camera=$cameraGranted mic=$micGranted audio=$audio")
|
||||
permissions.launch(listOf(Manifest.permission.CAMERA)
|
||||
.plus(if (audio) listOf(Manifest.permission.RECORD_AUDIO) else emptyList()).toTypedArray())
|
||||
} else config?.let {
|
||||
LogManager.addLog("INFO", "stream", "screen start group=$group audio=$audio config=$it")
|
||||
StreamController.start(group, it, audio)
|
||||
}
|
||||
}) {
|
||||
Icon(if (ongoing != null) Icons.Filled.Stop else Icons.Filled.PlayArrow,
|
||||
contentDescription = null, modifier = Modifier.size(32.dp))
|
||||
}
|
||||
}
|
||||
StreamCaptureToolbar(cameras, shownConfig, displayDegrees, Modifier.fillMaxWidth(),
|
||||
enabled = if (ongoing != null) ongoing.phase == StreamPhase.LIVE && ongoing.pendingConfig == null else !loadingModes,
|
||||
audio = shownAudio,
|
||||
audioEnabled = if (ongoing != null) ongoing.phase == StreamPhase.LIVE && ongoing.audioAvailable else !loadingModes,
|
||||
onAudioChange = {
|
||||
LogManager.addLog("INFO", "stream", "screen audio group=$group enabled=$it live=${ongoing != null}")
|
||||
if (ongoing != null) StreamController.setAudioEnabled(it)
|
||||
else { audio = it; StreamController.rememberSettings(audio = it) }
|
||||
}, onChange = {
|
||||
LogManager.addLog("INFO", "stream", "screen capture selection group=$group live=${ongoing != null} config=$it")
|
||||
if (ongoing != null) StreamController.change(it)
|
||||
else { config = it; StreamController.rememberSettings(config = it) }
|
||||
})
|
||||
if (ongoing != null) {
|
||||
CaptureModeStatus(ongoing.config, ongoing.pendingConfig, ongoing.notice)
|
||||
if (ongoing.phase == StreamPhase.STOPPING) Text(stringResource(R.string.stream_stopping))
|
||||
|
||||
Reference in new issue
Block a user