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

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