Video Player: Pause video when onDisappear

This commit is contained in:
Thomas Ricouard 2023-08-09 13:53:41 +02:00
parent 27164fa399
commit 04b5804c96

View file

@ -68,6 +68,9 @@ struct VideoPlayerView: View {
}.onAppear {
viewModel.preparePlayer(autoPlay: preferences.autoPlayVideo)
}
.onDisappear {
viewModel.pause()
}
.cornerRadius(4)
.onChange(of: scenePhase, perform: { scenePhase in
switch scenePhase {