Fix memory leak related to video #1925

This commit is contained in:
Thomas Ricouard 2024-01-27 10:20:12 +01:00
parent 1299202bba
commit 9cf16b2f30

View file

@ -50,6 +50,12 @@ import Models
isPlaying = false
player?.pause()
}
func stop() {
isPlaying = false
player?.pause()
player = nil
}
func play() {
isPlaying = true
@ -96,7 +102,7 @@ public struct MediaUIAttachmentVideoView: View {
viewModel.mute(preferences.muteVideo)
}
.onDisappear {
viewModel.pause()
viewModel.stop()
}
.onTapGesture {
if !preferences.autoPlayVideo && !viewModel.isPlaying {