More fixes to video

This commit is contained in:
Thomas Ricouard 2024-01-07 16:49:49 +01:00
parent 71d12aec15
commit 7a7066baa4

View file

@ -80,6 +80,10 @@ public struct MediaUIAttachmentVideoView: View {
viewModel.pause()
}
.onTapGesture {
if !preferences.autoPlayVideo && !viewModel.isPlaying {
viewModel.play()
return
}
isFullScreen = true
}
.fullScreenCover(isPresented: $isFullScreen) {
@ -93,6 +97,16 @@ public struct MediaUIAttachmentVideoView: View {
}
}
}
.onAppear {
if isCompact || !preferences.autoPlayVideo {
viewModel.play()
}
}
.onDisappear {
if isCompact || !preferences.autoPlayVideo {
viewModel.pause()
}
}
}
.cornerRadius(4)
.onChange(of: scenePhase) { _, newValue in