check for automaticallyStartPlayback setting

This commit is contained in:
greenart7c3 2023-07-07 05:55:33 -03:00
parent f83a19260f
commit 3e615bb152
11 changed files with 164 additions and 33 deletions

View File

@ -179,11 +179,11 @@ fun ImageVideoPost(postViewModel: NewMediaModel, acc: Account) {
)
}
} else {
val showVideo = remember {
val automaticallyStartPlayback = remember {
mutableStateOf(true)
}
postViewModel.galleryUri?.let {
VideoView(it.toString(), showVideo = showVideo)
VideoView(it.toString(), automaticallyStartPlayback = automaticallyStartPlayback)
}
}
}

View File

@ -330,7 +330,7 @@ fun NewPostView(onClose: () -> Unit, baseReplyTo: Note? = null, quote: Note? = n
)
)
} else if (videoExtensions.any { removedParamsFromUrl.endsWith(it) }) {
VideoView(myUrlPreview, showVideo = remember { mutableStateOf(true) })
VideoView(myUrlPreview, automaticallyStartPlayback = remember { mutableStateOf(true) })
} else {
UrlPreview(myUrlPreview, myUrlPreview)
}
@ -966,7 +966,7 @@ fun ImageVideoDescription(
)
}
} else {
VideoView(uri.toString(), showVideo = remember { mutableStateOf(true) })
VideoView(uri.toString(), automaticallyStartPlayback = remember { mutableStateOf(true) })
}
}

View File

@ -58,6 +58,16 @@ fun ExpandableRichTextViewer(
)
}
val automaticallyStartPlayback = remember {
mutableStateOf(
when (settings?.automaticallyStartPlayback) {
true -> !isMobile
false -> false
else -> true
}
)
}
var showFullText by remember { mutableStateOf(false) }
val whereToCut = remember(content) {
@ -87,6 +97,7 @@ fun ExpandableRichTextViewer(
backgroundColor,
accountViewModel,
showImage,
automaticallyStartPlayback,
nav
)

View File

@ -109,13 +109,14 @@ fun RichTextViewer(
backgroundColor: MutableState<Color>,
accountViewModel: AccountViewModel,
showImage: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>,
nav: (String) -> Unit
) {
Column(modifier = modifier) {
if (remember(content) { isMarkdown(content) }) {
RenderContentAsMarkdown(content, tags, nav)
} else {
RenderRegular(content, tags, canPreview, backgroundColor, accountViewModel, showImage, nav)
RenderRegular(content, tags, canPreview, backgroundColor, accountViewModel, showImage, automaticallyStartPlayback, nav)
}
}
}
@ -129,6 +130,7 @@ private fun RenderRegular(
backgroundColor: MutableState<Color>,
accountViewModel: AccountViewModel,
showImage: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>,
nav: (String) -> Unit
) {
val state by remember(content) {
@ -159,6 +161,7 @@ private fun RenderRegular(
textStyle,
accountViewModel,
showImage,
automaticallyStartPlayback,
nav
)
}
@ -239,10 +242,11 @@ private fun RenderWordWithPreview(
style: TextStyle,
accountViewModel: AccountViewModel,
showImage: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>,
nav: (String) -> Unit
) {
when (word) {
is ImageSegment -> ZoomableContentView(word.segmentText, state, showImage)
is ImageSegment -> ZoomableContentView(word.segmentText, state, showImage, automaticallyStartPlayback)
is LinkSegment -> UrlPreview(word.segmentText, word.segmentText)
is EmojiSegment -> RenderCustomEmoji(word.segmentText, state)
is InvoiceSegment -> MayBeInvoicePreview(word.segmentText)
@ -260,9 +264,14 @@ private fun RenderWordWithPreview(
}
@Composable
private fun ZoomableContentView(word: String, state: RichTextViewerState, showImage: MutableState<Boolean>) {
private fun ZoomableContentView(
word: String,
state: RichTextViewerState,
showImage: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>
) {
state.imagesForPager[word]?.let {
ZoomableContentView(it, state.imageList, showImage)
ZoomableContentView(it, state.imageList, showImage, automaticallyStartPlayback)
}
}

View File

@ -112,11 +112,11 @@ fun VideoView(
videoUri: String,
description: String? = null,
thumb: VideoThumb? = null,
showVideo: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>,
onDialog: ((Boolean) -> Unit)? = null
) {
val (value, elapsed) = measureTimedValue {
VideoView1(videoUri, description, thumb, onDialog, showVideo)
VideoView1(videoUri, description, thumb, onDialog, automaticallyStartPlayback)
}
Log.d("Rendering Metrics", "VideoView $elapsed $videoUri")
}
@ -127,7 +127,7 @@ fun VideoView1(
description: String? = null,
thumb: VideoThumb? = null,
onDialog: ((Boolean) -> Unit)? = null,
showVideo: MutableState<Boolean>
automaticallyStartPlayback: MutableState<Boolean>
) {
var exoPlayerData by remember { mutableStateOf<VideoPlayer?>(null) }
val defaultToStart by remember { mutableStateOf(DefaultMutedSetting.value) }
@ -142,7 +142,7 @@ fun VideoView1(
}
exoPlayerData?.let {
VideoView(videoUri, description, it, defaultToStart, thumb, onDialog, showVideo = showVideo)
VideoView(videoUri, description, it, defaultToStart, thumb, onDialog, automaticallyStartPlayback = automaticallyStartPlayback)
}
DisposableEffect(Unit) {
@ -161,10 +161,10 @@ fun VideoView(
defaultToStart: Boolean = false,
thumb: VideoThumb? = null,
onDialog: ((Boolean) -> Unit)? = null,
showVideo: MutableState<Boolean>
automaticallyStartPlayback: MutableState<Boolean>
) {
val (value, elapsed) = measureTimedValue {
VideoView1(videoUri, description, exoPlayerData, defaultToStart, thumb, onDialog, showVideo)
VideoView1(videoUri, description, exoPlayerData, defaultToStart, thumb, onDialog, automaticallyStartPlayback)
}
Log.d("Rendering Metrics", "VideoView $elapsed $videoUri")
}
@ -177,7 +177,7 @@ fun VideoView1(
defaultToStart: Boolean = false,
thumb: VideoThumb? = null,
onDialog: ((Boolean) -> Unit)? = null,
showVideo: MutableState<Boolean>
automaticallyStartPlayback: MutableState<Boolean>
) {
val lifecycleOwner = rememberUpdatedState(LocalLifecycleOwner.current)
@ -207,7 +207,7 @@ fun VideoView1(
prepare()
}
RenderVideoPlayer(exoPlayerData, thumb, showVideo, onDialog)
RenderVideoPlayer(exoPlayerData, thumb, automaticallyStartPlayback, onDialog)
DisposableEffect(Unit) {
val observer = LifecycleEventObserver { _, event ->
@ -241,7 +241,7 @@ data class VideoThumb(
private fun RenderVideoPlayer(
playerData: VideoPlayer,
thumbData: VideoThumb?,
showVideo: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>,
onDialog: ((Boolean) -> Unit)?
) {
val context = LocalContext.current
@ -253,10 +253,10 @@ private fun RenderVideoPlayer(
.defaultMinSize(minHeight = 70.dp)
.align(Alignment.Center)
.onVisibilityChanges { visible ->
if (!showVideo.value) {
if (!automaticallyStartPlayback.value) {
playerData.exoPlayer.stop()
}
if (!showVideo.value && visible && !playerData.exoPlayer.isPlaying) {
if (!automaticallyStartPlayback.value && visible && !playerData.exoPlayer.isPlaying) {
playerData.exoPlayer.pause()
} else if (visible && !playerData.exoPlayer.isPlaying) {
playerData.exoPlayer.play()

View File

@ -171,7 +171,12 @@ fun figureOutMimeType(fullUrl: String): ZoomableContent {
@Composable
@OptIn(ExperimentalFoundationApi::class)
fun ZoomableContentView(content: ZoomableContent, images: ImmutableList<ZoomableContent> = listOf(content).toImmutableList(), showImage: MutableState<Boolean>) {
fun ZoomableContentView(
content: ZoomableContent,
images: ImmutableList<ZoomableContent> = listOf(content).toImmutableList(),
showImage: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>
) {
val clipboardManager = LocalClipboardManager.current
// store the dialog open or close state
@ -199,11 +204,11 @@ fun ZoomableContentView(content: ZoomableContent, images: ImmutableList<Zoomable
when (content) {
is ZoomableUrlImage -> UrlImageView(content, mainImageModifier, showImage)
is ZoomableUrlVideo -> VideoView(content.url, content.description, showVideo = showImage) { dialogOpen = true }
is ZoomableUrlVideo -> VideoView(content.url, content.description, automaticallyStartPlayback = automaticallyStartPlayback) { dialogOpen = true }
is ZoomableLocalImage -> LocalImageView(content, mainImageModifier, showImage)
is ZoomableLocalVideo ->
content.localFile?.let {
VideoView(it.toUri().toString(), content.description, showVideo = showImage) { dialogOpen = true }
VideoView(it.toUri().toString(), content.description, automaticallyStartPlayback = automaticallyStartPlayback) { dialogOpen = true }
}
}
@ -552,11 +557,11 @@ fun ZoomableImageDialog(imageUrl: ZoomableContent, allImages: ImmutableList<Zoom
pagerState = pagerState,
itemsCount = allImages.size,
itemContent = { index ->
RenderImageOrVideo(allImages[index], remember { mutableStateOf(true) })
RenderImageOrVideo(allImages[index], remember { mutableStateOf(true) }, remember { mutableStateOf(true) })
}
)
} else {
RenderImageOrVideo(imageUrl, remember { mutableStateOf(true) })
RenderImageOrVideo(imageUrl, remember { mutableStateOf(true) }, remember { mutableStateOf(true) })
}
Row(
@ -581,7 +586,7 @@ fun ZoomableImageDialog(imageUrl: ZoomableContent, allImages: ImmutableList<Zoom
}
@Composable
fun RenderImageOrVideo(content: ZoomableContent, showImage: MutableState<Boolean>) {
fun RenderImageOrVideo(content: ZoomableContent, showImage: MutableState<Boolean>, automaticallyStartPlayback: MutableState<Boolean>) {
val mainModifier = Modifier
.fillMaxSize()
.zoomable(rememberZoomState())
@ -590,14 +595,14 @@ fun RenderImageOrVideo(content: ZoomableContent, showImage: MutableState<Boolean
UrlImageView(content = content, mainImageModifier = mainModifier, showImage)
} else if (content is ZoomableUrlVideo) {
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxSize(1f)) {
VideoView(content.url, content.description, showVideo = showImage)
VideoView(content.url, content.description, automaticallyStartPlayback = automaticallyStartPlayback)
}
} else if (content is ZoomableLocalImage) {
LocalImageView(content = content, mainImageModifier = mainModifier, showImage)
} else if (content is ZoomableLocalVideo) {
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxSize(1f)) {
content.localFile?.let {
VideoView(it.toUri().toString(), content.description, showVideo = showImage)
VideoView(it.toUri().toString(), content.description, automaticallyStartPlayback = automaticallyStartPlayback)
}
}
}

View File

@ -108,6 +108,16 @@ fun ChannelCardCompose(
)
}
val automaticallyStartPlayback = remember {
mutableStateOf(
when (settings?.automaticallyStartPlayback) {
true -> !isMobile
false -> false
else -> true
}
)
}
Crossfade(targetState = isBlank) {
if (it) {
LongPressToQuickAction(baseNote = baseNote, accountViewModel = accountViewModel) { showPopup ->
@ -129,6 +139,7 @@ fun ChannelCardCompose(
parentBackgroundColor,
accountViewModel,
showImage,
automaticallyStartPlayback,
nav
)
}
@ -143,6 +154,7 @@ fun CheckHiddenChannelCardCompose(
parentBackgroundColor: MutableState<Color>? = null,
accountViewModel: AccountViewModel,
showImage: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>,
nav: (String) -> Unit
) {
val isHidden by accountViewModel.accountLiveData.map {
@ -158,6 +170,7 @@ fun CheckHiddenChannelCardCompose(
parentBackgroundColor,
accountViewModel,
showImage,
automaticallyStartPlayback,
nav
)
}
@ -172,6 +185,7 @@ fun LoadedChannelCardCompose(
parentBackgroundColor: MutableState<Color>? = null,
accountViewModel: AccountViewModel,
showImage: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>,
nav: (String) -> Unit
) {
var state by remember {
@ -204,6 +218,7 @@ fun LoadedChannelCardCompose(
parentBackgroundColor,
accountViewModel,
showImage,
automaticallyStartPlayback,
nav
)
}
@ -218,6 +233,7 @@ fun RenderChannelCardReportState(
parentBackgroundColor: MutableState<Color>? = null,
accountViewModel: AccountViewModel,
showImage: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>,
nav: (String) -> Unit
) {
var showReportedNote by remember { mutableStateOf(false) }
@ -240,6 +256,7 @@ fun RenderChannelCardReportState(
parentBackgroundColor,
accountViewModel,
showImage,
automaticallyStartPlayback,
nav
)
}
@ -254,6 +271,7 @@ fun NormalChannelCard(
parentBackgroundColor: MutableState<Color>? = null,
accountViewModel: AccountViewModel,
showImage: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>,
nav: (String) -> Unit
) {
LongPressToQuickAction(baseNote = baseNote, accountViewModel = accountViewModel) { showPopup ->
@ -264,6 +282,7 @@ fun NormalChannelCard(
parentBackgroundColor,
accountViewModel,
showImage,
automaticallyStartPlayback,
showPopup,
nav
)
@ -278,6 +297,7 @@ private fun CheckNewAndRenderChannelCard(
parentBackgroundColor: MutableState<Color>? = null,
accountViewModel: AccountViewModel,
showImage: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>,
showPopup: () -> Unit,
nav: (String) -> Unit
) {
@ -336,6 +356,7 @@ private fun CheckNewAndRenderChannelCard(
baseNote = baseNote,
accountViewModel = accountViewModel,
showImage,
automaticallyStartPlayback,
nav = nav
)
}
@ -346,6 +367,7 @@ fun InnerChannelCardWithReactions(
baseNote: Note,
accountViewModel: AccountViewModel,
showImage: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>,
nav: (String) -> Unit
) {
Column(StdPadding) {
@ -367,11 +389,12 @@ private fun RenderNoteRow(
baseNote: Note,
accountViewModel: AccountViewModel,
showImage: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>,
nav: (String) -> Unit
) {
when (remember { baseNote.event }) {
is LiveActivitiesEvent -> {
RenderLiveActivityThumb(baseNote, accountViewModel, showImage, nav)
RenderLiveActivityThumb(baseNote, accountViewModel, showImage, automaticallyStartPlayback, nav)
}
is CommunityDefinitionEvent -> {
RenderCommunitiesThumb(baseNote, accountViewModel, nav)
@ -383,7 +406,13 @@ private fun RenderNoteRow(
}
@Composable
fun RenderLiveActivityThumb(baseNote: Note, accountViewModel: AccountViewModel, showImage: MutableState<Boolean>, nav: (String) -> Unit) {
fun RenderLiveActivityThumb(
baseNote: Note,
accountViewModel: AccountViewModel,
showImage: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>,
nav: (String) -> Unit
) {
val noteEvent = baseNote.event as? LiveActivitiesEvent ?: return
val eventUpdates by baseNote.live().metadata.observeAsState()
@ -521,6 +550,7 @@ fun RenderLiveActivityThumb(baseNote: Note, accountViewModel: AccountViewModel,
},
accountViewModel = accountViewModel,
showImage = showImage,
automaticallyStartPlayback = automaticallyStartPlayback,
nav = nav
)
}

View File

@ -225,6 +225,16 @@ fun NoteCompose(
)
}
val automaticallyStartPlayback = remember {
mutableStateOf(
when (settings?.automaticallyStartPlayback) {
true -> !isMobile
false -> false
else -> true
}
)
}
Crossfade(targetState = isBlank) {
if (it) {
LongPressToQuickAction(baseNote = baseNote, accountViewModel = accountViewModel) { showPopup ->
@ -251,6 +261,7 @@ fun NoteCompose(
parentBackgroundColor,
accountViewModel,
showImage,
automaticallyStartPlayback,
nav
)
}
@ -270,6 +281,7 @@ fun CheckHiddenNoteCompose(
parentBackgroundColor: MutableState<Color>? = null,
accountViewModel: AccountViewModel,
showImage: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>,
nav: (String) -> Unit
) {
val isHidden by accountViewModel.accountLiveData.map {
@ -290,6 +302,7 @@ fun CheckHiddenNoteCompose(
parentBackgroundColor,
accountViewModel,
showImage,
automaticallyStartPlayback,
nav
)
}
@ -316,6 +329,7 @@ fun LoadedNoteCompose(
parentBackgroundColor: MutableState<Color>? = null,
accountViewModel: AccountViewModel,
showImage: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>,
nav: (String) -> Unit
) {
var state by remember {
@ -353,6 +367,7 @@ fun LoadedNoteCompose(
parentBackgroundColor,
accountViewModel,
showImage,
automaticallyStartPlayback,
nav
)
}
@ -372,6 +387,7 @@ fun RenderReportState(
parentBackgroundColor: MutableState<Color>? = null,
accountViewModel: AccountViewModel,
showImage: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>,
nav: (String) -> Unit
) {
var showReportedNote by remember { mutableStateOf(false) }
@ -402,6 +418,7 @@ fun RenderReportState(
parentBackgroundColor,
accountViewModel,
showImage,
automaticallyStartPlayback,
nav
)
}
@ -438,6 +455,7 @@ fun NormalNote(
parentBackgroundColor: MutableState<Color>? = null,
accountViewModel: AccountViewModel,
showImage: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>,
nav: (String) -> Unit
) {
when (baseNote.event) {
@ -447,6 +465,7 @@ fun NormalNote(
showBottomDiviser = true,
accountViewModel = accountViewModel,
showImage = showImage,
automaticallyStartPlayback = automaticallyStartPlayback,
nav = nav
)
is CommunityDefinitionEvent -> CommunityHeader(
@ -473,6 +492,7 @@ fun NormalNote(
parentBackgroundColor,
accountViewModel,
showImage,
automaticallyStartPlayback,
showPopup,
nav
)
@ -771,6 +791,7 @@ private fun CheckNewAndRenderNote(
parentBackgroundColor: MutableState<Color>? = null,
accountViewModel: AccountViewModel,
showImage: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>,
showPopup: () -> Unit,
nav: (String) -> Unit
) {
@ -836,6 +857,7 @@ private fun CheckNewAndRenderNote(
canPreview = canPreview,
accountViewModel = accountViewModel,
showImage = showImage,
automaticallyStartPlayback = automaticallyStartPlayback,
nav = nav
)
}
@ -887,6 +909,7 @@ fun InnerNoteWithReactions(
canPreview: Boolean,
accountViewModel: AccountViewModel,
showImage: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>,
nav: (String) -> Unit
) {
val notBoostedNorQuote = !isBoostedNote && !isQuotedNote
@ -926,6 +949,7 @@ fun InnerNoteWithReactions(
backgroundColor = backgroundColor,
accountViewModel = accountViewModel,
showImage = showImage,
automaticallyStartPlayback = automaticallyStartPlayback,
nav = nav
)
}
@ -972,6 +996,7 @@ private fun NoteBody(
backgroundColor: MutableState<Color>,
accountViewModel: AccountViewModel,
showImage: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>,
nav: (String) -> Unit
) {
FirstUserInfoRow(
@ -998,6 +1023,7 @@ private fun NoteBody(
backgroundColor,
accountViewModel,
showImage,
automaticallyStartPlayback,
nav
)
}
@ -2100,6 +2126,7 @@ private fun ReplyRow(
backgroundColor: MutableState<Color>,
accountViewModel: AccountViewModel,
showImage: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>,
nav: (String) -> Unit
) {
val noteEvent = note.event
@ -2136,6 +2163,7 @@ private fun ReplyRow(
modifier = remember { Modifier.padding(vertical = 5.dp) },
accountViewModel = accountViewModel,
showImage = showImage,
automaticallyStartPlayback = automaticallyStartPlayback,
nav = nav
)
@ -3086,7 +3114,7 @@ fun AudioTrackHeader(noteEvent: AudioTrackEvent, accountViewModel: AccountViewMo
?: VideoView(
videoUri = media,
description = noteEvent.subject(),
showVideo = remember { mutableStateOf(true) }
automaticallyStartPlayback = remember { mutableStateOf(true) }
)
}
}
@ -3211,7 +3239,7 @@ fun RenderLiveActivityEventInner(baseNote: Note, accountViewModel: AccountViewMo
VideoView(
videoUri = media,
description = subject,
showVideo = remember { mutableStateOf(true) }
automaticallyStartPlayback = remember { mutableStateOf(true) }
)
}
} else {

View File

@ -258,6 +258,16 @@ fun NoteMaster(
)
}
val automaticallyStartPlayback = remember {
mutableStateOf(
when (settings?.automaticallyStartPlayback) {
true -> !isMobile
false -> false
else -> true
}
)
}
var showHiddenNote by remember { mutableStateOf(false) }
val context = LocalContext.current
@ -412,7 +422,15 @@ fun NoteMaster(
) {
Column() {
if ((noteEvent is ChannelCreateEvent || noteEvent is ChannelMetadataEvent) && note.channelHex() != null) {
ChannelHeader(channelHex = note.channelHex()!!, showVideo = true, showBottomDiviser = false, accountViewModel = accountViewModel, showImage = showImage, nav = nav)
ChannelHeader(
channelHex = note.channelHex()!!,
showVideo = true,
showBottomDiviser = false,
accountViewModel = accountViewModel,
showImage = showImage,
automaticallyStartPlayback = automaticallyStartPlayback,
nav = nav
)
} else if (noteEvent is FileHeaderEvent) {
FileHeaderDisplay(baseNote, accountViewModel)
} else if (noteEvent is FileStorageHeaderEvent) {

View File

@ -214,6 +214,16 @@ fun ChannelScreen(
)
}
val automaticallyStartPlayback = remember {
mutableStateOf(
when (settings?.automaticallyStartPlayback) {
true -> !isMobile
false -> false
else -> true
}
)
}
LaunchedEffect(Unit) {
NostrChannelDataSource.start()
feedViewModel.invalidateData()
@ -255,6 +265,7 @@ fun ChannelScreen(
showBottomDiviser = true,
accountViewModel = accountViewModel,
showImage = showImage,
automaticallyStartPlayback = automaticallyStartPlayback,
nav = nav
)
@ -535,6 +546,7 @@ fun ChannelHeader(
modifier: Modifier = StdPadding,
accountViewModel: AccountViewModel,
showImage: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>,
nav: (String) -> Unit
) {
val channelHex by remember {
@ -549,6 +561,7 @@ fun ChannelHeader(
showBottomDiviser = showBottomDiviser,
accountViewModel = accountViewModel,
showImage = showImage,
automaticallyStartPlayback = automaticallyStartPlayback,
nav = nav
)
}
@ -563,6 +576,7 @@ fun ChannelHeader(
modifier: Modifier = StdPadding,
accountViewModel: AccountViewModel,
showImage: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>,
nav: (String) -> Unit
) {
var baseChannel by remember { mutableStateOf(LocalCache.channels[channelHex]) }
@ -584,6 +598,7 @@ fun ChannelHeader(
modifier,
accountViewModel,
showImage,
automaticallyStartPlayback,
nav
)
}
@ -598,6 +613,7 @@ fun ChannelHeader(
modifier: Modifier = StdPadding,
accountViewModel: AccountViewModel,
showImage: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>,
nav: (String) -> Unit
) {
Column(Modifier.fillMaxWidth()) {

View File

@ -206,6 +206,17 @@ fun RenderPage(
}
)
}
val automaticallyStartPlayback = remember {
mutableStateOf(
when (settings?.automaticallyStartPlayback) {
true -> !isMobile
false -> false
else -> true
}
)
}
Box() {
Column {
Crossfade(
@ -227,6 +238,7 @@ fun RenderPage(
pagerState,
accountViewModel,
showImage,
automaticallyStartPlayback,
nav
)
}
@ -247,6 +259,7 @@ fun SlidingCarousel(
pagerState: PagerState,
accountViewModel: AccountViewModel,
showImage: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>,
nav: (String) -> Unit
) {
VerticalPager(
@ -259,7 +272,7 @@ fun SlidingCarousel(
}
) { index ->
feed.value.getOrNull(index)?.let { note ->
RenderVideoOrPictureNote(note, accountViewModel, showImage, nav)
RenderVideoOrPictureNote(note, accountViewModel, showImage, automaticallyStartPlayback, nav)
}
}
}
@ -269,6 +282,7 @@ private fun RenderVideoOrPictureNote(
note: Note,
accountViewModel: AccountViewModel,
showImage: MutableState<Boolean>,
automaticallyStartPlayback: MutableState<Boolean>,
nav: (String) -> Unit
) {
Column(remember { Modifier.fillMaxSize(1f) }) {